/* Legal AI Custom Theme */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #475569;
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --error-color: #dc2626;
    --success-color: #16a34a;
}

/* Background */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Login Container */
.login-pf body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#kc-header {
    display: none;
}

.login-pf-page {
    background: transparent;
}

#kc-container {
    max-width: 450px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

#kc-container-wrapper {
    background: var(--card-background);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 48px 40px;
}

/* Header */
#kc-header-wrapper {
    text-align: center;
    margin-bottom: 32px;
}

#kc-page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.kc-logo-text {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

/* Form */
#kc-form {
    margin-top: 32px;
}

.form-group {
    margin-bottom: 24px;
}

#kc-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#kc-form input[type="text"],
#kc-form input[type="password"],
#kc-form input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: var(--background);
}

#kc-form input[type="text"]:focus,
#kc-form input[type="password"]:focus,
#kc-form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Submit Button */
#kc-form-buttons {
    margin-top: 32px;
}

#kc-login,
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#kc-login:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#kc-login:active,
.btn-primary:active {
    transform: translateY(0);
}

/* Remember Me / Forgot Password */
#kc-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    font-size: 14px;
}

#kc-form-options a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

#kc-form-options a:hover {
    color: var(--primary-dark);
}

.checkbox {
    display: flex;
    align-items: center;
}

.checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

.checkbox label {
    margin: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Info / Error Messages */
.alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-error,
.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Social Login (if needed later) */
#kc-social-providers {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

#kc-social-providers ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#kc-social-providers li {
    margin-bottom: 12px;
}

#kc-social-providers button {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#kc-social-providers button:hover {
    border-color: var(--primary-color);
    background: var(--background);
}

/* Registration / Back to Login */
#kc-registration {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

#kc-registration a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}

#kc-registration a:hover {
    color: var(--primary-dark);
}

/* Info Section */
#kc-info {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

#kc-info-wrapper {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Required Fields Indicator */
.required {
    color: var(--error-color);
}

/* Input Error State */
.has-error input {
    border-color: var(--error-color);
}

.has-error .help-block {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 6px;
}

/* Loading State */
.btn-primary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #kc-container {
        padding: 12px;
    }

    #kc-container-wrapper {
        padding: 32px 24px;
    }

    #kc-page-title {
        font-size: 24px;
    }

    .kc-logo-text {
        font-size: 28px;
    }
}

/* Additional Keycloak-specific overrides */
.login-pf .container {
    background: transparent;
    padding: 0;
}

#kc-content {
    width: 100%;
}

#kc-form-wrapper {
    width: 100%;
}

/* Password Field with Toggle Button */
.pf-c-form-control-wrapper,
.pf-v5-c-form-control-wrapper {
    position: relative !important;
    display: block !important;
}

.pf-c-form-control-wrapper input[type="password"],
.pf-c-form-control-wrapper input[type="text"],
.pf-v5-c-form-control-wrapper input[type="password"],
.pf-v5-c-form-control-wrapper input[type="text"] {
    width: 100% !important;
    padding-right: 48px !important;
}

/* Password toggle button */
.pf-c-button.pf-m-control,
.pf-v5-c-button.pf-m-control,
button[data-password-toggle],
.password-toggle {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    padding: 8px !important;
    cursor: pointer !important;
    color: var(--text-secondary) !important;
    transition: color 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    height: auto !important;
    width: auto !important;
    min-width: unset !important;
    margin: 0 !important;
}

.pf-c-button.pf-m-control:hover,
.pf-v5-c-button.pf-m-control:hover,
button[data-password-toggle]:hover,
.password-toggle:hover {
    color: var(--primary-color) !important;
    background: transparent !important;
}

.pf-c-button.pf-m-control:focus,
.pf-v5-c-button.pf-m-control:focus,
button[data-password-toggle]:focus,
.password-toggle:focus {
    outline: none !important;
    color: var(--primary-color) !important;
    box-shadow: none !important;
}

.pf-c-button svg,
.pf-c-button i,
.pf-v5-c-button svg,
.pf-v5-c-button i {
    width: 20px !important;
    height: 20px !important;
}

/* Input Group (password with button) */
.input-group,
.pf-c-input-group,
.pf-v5-c-input-group {
    position: relative !important;
    display: block !important;
}

.input-group input,
.pf-c-input-group input,
.pf-v5-c-input-group input {
    width: 100% !important;
    padding-right: 48px !important;
}

/* Form group */
.form-group,
.pf-c-form-group,
.pf-v5-c-form-group {
    position: relative !important;
}
