/* Custom CSS for Keycloak Login Theme - Consens Zeiterfassung - Dark Theme */

:root {
    --primary-color: #1F529A;
    --secondary-color: #163d73;
    --accent-color: #2968b8;
    --text-color: #ffffff;
    --background-color: #000000;
    --card-background: #1a1a1a;
    --error-color: #ef4444;
    --success-color: #10b981;
    --border-color: #333333;
}

/* Force black background everywhere */
html,
html.login-pf,
body,
.login-pf body {
    background-color: #000000 !important;
    background-image: none !important;
    background: #000000 !important;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-color);
}

/* Login card customization */
.login-pf-page {
    background-color: #000000 !important;
    background-image: none !important;
    background: #000000 !important;
}

.card-pf {
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    padding: 2.5rem;
    border: 1px solid var(--border-color);
}

/* Logo customization */
#kc-header-wrapper {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0;
    color: transparent;
}

#kc-logo {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: initial;
}

#kc-logo img,
#kc-logo-wrapper img {
    max-width: 280px;
    width: 280px;
    height: auto;
    margin: 0 auto;
    display: block;
}

#kc-header {
    display: none;
}

/* Realm display name styling */
#kc-page-title {
    font-size: 0;
    color: transparent;
    line-height: 0;
}

/* Hide realm name at top of page */
.login-pf-page .login-pf-page-header,
#kc-container-wrapper > div:first-child {
    display: none !important;
}

/* Form elements */
input[type="text"],
input[type="password"],
input[type="email"],
.pf-c-form-control {
    background-color: #2a2a2a;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 8px 12px; /* balanced vertical padding */
    font-size: 16px;   /* consistent font metrics */
    line-height: 24px; /* centers text visually */
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
.pf-c-form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 82, 154, 0.3);
    outline: none;
    background-color: #333333;
}

/* Button customization */
.pf-c-button.pf-m-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.pf-c-button.pf-m-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.pf-c-button.pf-m-primary:active {
    transform: translateY(0);
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Alert messages */
.pf-c-alert.pf-m-danger {
    background-color: #fef2f2;
    border-left: 4px solid var(--error-color);
    border-radius: 8px;
}

.pf-c-alert.pf-m-success {
    background-color: #f0fdf4;
    border-left: 4px solid var(--success-color);
    border-radius: 8px;
}

.pf-c-alert.pf-m-info {
    background-color: #eff6ff;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
}

/* Form labels */
label,
.pf-c-form__label {
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Checkbox styling */
input[type="checkbox"],
.pf-c-check__input {
    background-color: #2a2a2a;
    border: 1px solid var(--border-color);
}

input[type="checkbox"]:checked,
.pf-c-check__input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox label {
    color: var(--text-color);
}

/* Footer */
#kc-info {
    margin-top: 2rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-pf {
        padding: 1.5rem;
    }
    
    #kc-logo-wrapper img {
        max-width: 150px;
    }
}

/* Loading spinner */
.pf-c-spinner {
    color: var(--primary-color);
}

/* Social providers */
#kc-social-providers {
    margin-top: 2rem;
}

#kc-social-providers hr {
    border-color: var(--border-color);
    margin: 1.25rem 0 0.75rem 0;
}

#kc-social-providers h4 {
    color: #d1d5db;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.5rem 0 1rem 0;
}

/* Social providers buttons (robust selectors to match base + custom markup) */
#kc-social-providers ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#kc-social-providers li {
    border: 0 !important;            /* ensure no list separators */
}

#kc-social-providers li + li {
    margin-top: 0.75rem;
}

#kc-social-providers a[id^="social-"] {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: #2a2a2a;
    color: var(--text-color);
    text-decoration: none;
    padding: 0.75rem 1rem;            /* taller button for readability */
    min-height: 44px;                 /* comfortable touch target */
    transition: background-color 0.2s, border-color 0.2s, transform 0.08s;
}

#kc-social-providers a[id^="social-"]:hover {
    background-color: #333333;
    border-color: var(--primary-color);
}

#kc-social-providers a[id^="social-"]:active {
    transform: translateY(0.5px);
}

#kc-social-providers a[id^="social-"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(31, 82, 154, 0.3);
}

#kc-social-providers i {
    font-size: 1.25rem;
}

#kc-social-providers .kc-social-icon-text,
#kc-social-providers .pf-c-button__text {
    flex: 1;
    text-align: center;
    font-weight: 500;
}

/* --- Required Action: UPDATE_PASSWORD - fix white edges, enforce dark inputs --- */
/* Ensure all PatternFly form controls are dark and override base theme */
.login-pf input[type="text"],
.login-pf input[type="password"],
.login-pf input[type="email"],
.login-pf .pf-c-form-control {
    background-color: #2a2a2a !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}

/* Input group (password + show/hide button) */
.login-pf .pf-c-input-group,
.login-pf .pf-c-input-group::before,
.login-pf .pf-c-input-group::after {
    background: transparent !important;
    box-shadow: none !important;
}

.login-pf .pf-c-input-group > .pf-c-form-control {
    background-color: #2a2a2a !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
    border-right: 0 !important; /* avoid center seam */
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.login-pf .pf-c-input-group > .pf-c-button.pf-m-control,
.login-pf .pf-c-input-group > .pf-c-button.pf-m-plain {
    background-color: #2a2a2a !important;
    color: #e5e7eb !important;
    border: 1px solid var(--border-color) !important;
    border-left: 0 !important; /* avoid center seam */
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* Hover/Focus states */
.login-pf .pf-c-form-control:hover {
    background-color: #2f2f2f !important;
}

.login-pf .pf-c-form-control:focus,
.login-pf .pf-c-input-group > .pf-c-form-control:focus,
.login-pf .pf-c-input-group > .pf-c-button.pf-m-control:focus,
.login-pf .pf-c-input-group > .pf-c-button.pf-m-plain:focus {
    background-color: #333333 !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(31, 82, 154, 0.3) !important;
    outline: none !important;
}

/* Placeholders */
.login-pf .pf-c-form-control::placeholder,
.login-pf input::placeholder {
    color: #a3a3a3 !important;
    opacity: 1 !important;
}

/* Autofill (Chrome/Edge) */
.login-pf input:-webkit-autofill,
.login-pf input:-webkit-autofill:hover,
.login-pf input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-color) !important;
    caret-color: var(--text-color);
    -webkit-box-shadow: 0 0 0px 1000px #2a2a2a inset !important;
    box-shadow: 0 0 0px 1000px #2a2a2a inset !important;
    transition: background-color 9999s ease-in-out 0s;
}

/* Validation/error state on dark background */
.login-pf .pf-c-form-control.pf-m-error,
.login-pf .pf-m-error > .pf-c-form-control,
.login-pf .pf-m-invalid > .pf-c-form-control,
.login-pf .pf-c-form-control:invalid {
    border-color: var(--error-color) !important;
}

/* Ensure the update password action title remains readable if shown */
.login-pf .pf-c-title, 
.login-pf h1, 
.login-pf h2 {
    color: var(--text-color);
}

/* Inline password toggle inside input */
.kc-password-wrapper {
    position: relative;
}

.kc-password-input {
    padding-right: 2.5rem !important; /* leave space for icon */
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.kc-password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #e5e7eb;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.kc-password-toggle:hover,
.kc-password-toggle:focus {
    color: #ffffff;
    outline: none;
}

.kc-password-toggle svg {
    pointer-events: none;
}

/* Ensure username input matches password field vertical alignment */
.login-pf #kc-form-login #username {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    font-size: 16px !important;
    line-height: 24px !important;
}
