:root {
    /* Light mode (default) */
    --primary-bg: #e8e8ed;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --error-color: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-border: rgba(239, 68, 68, 0.3);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --input-bg: white;
    --input-text: #1f2937;
    --input-border: #d1d5db;
    --input-focus-shadow: rgba(99, 102, 241, 0.1);
    --disabled-bg: #9ca3af;
    --card-bg: white;
    --border-radius-sm: 8px;
    --border-radius-full: 9999px;
    --input-radius: 24px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 40px;
    --font-family-sans: 'TT Neoris', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-bold: 700;
    /* Background image - set by JavaScript based on branding config and color mode */
    --background-image: url('/assets/unily-bg-light.svg');
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-bg: var(--rds-t3-background-surface-inverse, #000);
        --primary-color: var(--rds-t3-ink-on-background-inverse-interactive, #818cf8);
        --primary-hover: #a5b4fc;
        --error-color: #f87171;
        --error-bg: rgba(248, 113, 113, 0.15);
        --error-border: rgba(248, 113, 113, 0.4);
        --text-primary: var(--rds-t3-ink-on-background-inverse-subtle, #f1f5f9);
        --text-secondary: #94a3b8;
        --input-border: #334155;
        --input-focus-shadow: rgba(129, 140, 248, 0.2);
        --disabled-bg: var(--rds-t3-component-button-inverse-primary-disabled-fill, #5d5d5d);
        --card-bg: #000;
        /* Note: --background-image is set by JavaScript for dynamic branding */
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-sans);
    background: var(--primary-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.login-container {
    text-align: center;
    width: 100%;
    max-width: 440px;
    padding: var(--spacing-xl);
    background: transparent;
}

.login-logo {
    width: 180px;
    height: auto;
    margin-block-end: var(--spacing-xl);
}

.ip__title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.ip__subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-xl) 0;
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
}

.form-group {
    margin-block-end: var(--spacing-md);
    text-align: start;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-block-end: var(--spacing-sm);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.ip__email-input {
    max-width: 360px;
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    background: var(--input-bg);
    color: var(--input-text);
    outline: none;
    transition: all 0.2s ease;
    font-family: var(--font-family-sans);
}

.ip__email-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.ip__email-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.ip__check-box {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: var(--text-primary);
    font-size: 14px;
    gap: var(--spacing-sm);
    margin-block-end: var(--spacing-xl);
    text-align: start;
}

.ip__check-box input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.ip__check-box label {
    cursor: pointer;
    margin: 0;
    user-select: none;
    color: var(--text-primary);
    font-weight: var(--font-weight-normal);
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--border-radius-full);
    font-size: 15px;
    font-weight: var(--font-weight-normal);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-block-end: var(--spacing-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-family-sans);
    background: var(--primary-color);
    color: white;
}

.btn:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn:disabled {
    background: var(--disabled-bg);
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.footer-links {
    margin-block-start: var(--spacing-xl);
    text-align: center;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.error {
    color: var(--error-color);
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-block-end: var(--spacing-lg);
    font-size: 14px;
    display: none;
    text-align: start;
}

.error[aria-hidden="false"] {
    display: block;
}

@media (max-width: 480px) {
    .login-container {
        padding: var(--spacing-lg);
        max-width: 100%;
    }
    
    .login-logo {
        width: 150px;
    }
    
    .ip__email-input,
    .btn {
        width: 100%;
    }
    
    .ip__title {
        font-size: 28px;
    }
}

/* Option 2 */
.option-2 {
    background: var(--background-image) no-repeat center center;
    background-size: cover;
}

.option-2 .login-container {
    background: var(--card-bg);
    border-radius: var(--border-radius-sm);
}

/* Option 3 - Split Screen with Image */
.option-3 {
    background: var(--card-bg);
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0;
    align-items: stretch;
}

.option-3::after {
    content: '';
    background: var(--background-image) no-repeat center center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

.option-3 .login-container {
    background: var(--card-bg);
    max-width: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 60px 40px;
}

.option-3 .login-container > * {
    max-width: 400px;
    width: 100%;
}

.option-3 .login-logo {
    width: 160px;
    margin-block-end: 40px;
}

.option-3 .ip__title {
    font-size: 24px;
    font-weight: var(--font-weight-normal);
    color: var(--text-primary);
    margin-block-end: 8px;
}

.option-3 .ip__subtitle {
    color: var(--text-secondary);
    margin-block-end: 32px;
    font-size: 14px;
}

.option-3 .form-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    margin-block-end: 8px;
}

.option-3 .ip__email-input {
    width: 100%;
    border-radius: 4px;
    border: 1px solid var(--input-border);
    padding: 12px 16px 12px 44px;
}

.option-3 .ip__check-box {
    margin-block-end: 24px;
}

.option-3 .ip__check-box input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1px solid var(--input-border);
}

.option-3 .btn {
    width: auto;
    padding: 12px 32px;
    border-radius: 4px;
    background: #5a6872;
    font-weight: var(--font-weight-normal);
}

.option-3 .btn:hover:not(:disabled) {
    background: #4a5862;
}

.option-3 .footer-links {
    margin-block-start: 24px;
}

.option-3 .footer-link {
    font-size: 13px;
    color: #0066cc;
}

.option-3 .footer-link:hover {
    color: #004499; 
}

@media (max-width: 768px) {
    .option-3 {
        grid-template-columns: 1fr;
    }

    .option-3::after {
        display: none;
    }

    .option-3 .login-container {
        padding: 40px 24px;
    }
}

/* ==========================================================================
   Identity Provider Buttons
   ========================================================================== */

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Identity Provider Buttons Container */
.idp-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
}

/* Individual IdP Button */
.idp-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #ffffff;
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.idp-button:hover {
    border-color: var(--primary-color, #0066cc);
    background-color: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.idp-button:focus {
    outline: 2px solid var(--primary-color, #0066cc);
    outline-offset: 2px;
}

.idp-button:focus:not(:focus-visible) {
    outline: none;
}

.idp-button:focus-visible {
    outline: 2px solid var(--primary-color, #0066cc);
    outline-offset: 2px;
}

.idp-button:active {
    transform: translateY(0);
}

/* IdP Button Icon */
.idp-button-icon {
    width: 20px;
    height: 20px;
    /* Use CSS mask instead of background-image for proper currentColor support */
    /* Default lock icon for unknown providers */
    -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"%3E%3Crect x="3" y="11" width="18" height="11" rx="2" ry="2"%3E%3C/rect%3E%3Cpath d="M7 11V7a5 5 0 0 1 10 0v4"%3E%3C/path%3E%3C/svg%3E') center/contain no-repeat;
    mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"%3E%3Crect x="3" y="11" width="18" height="11" rx="2" ry="2"%3E%3C/rect%3E%3Cpath d="M7 11V7a5 5 0 0 1 10 0v4"%3E%3C/path%3E%3C/svg%3E') center/contain no-repeat;
    background-color: currentColor;
}

/* Azure B2C provider icon - shield with checkmark for enterprise authentication */
.idp-button.azure-b2c .idp-button-icon,
.idp-button.azure-b2c-button .idp-button-icon {
    -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"%3E%3Cpath d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"%3E%3C/path%3E%3Cpath d="m9 12 2 2 4-4"%3E%3C/path%3E%3C/svg%3E') center/contain no-repeat;
    mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"%3E%3Cpath d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"%3E%3C/path%3E%3Cpath d="m9 12 2 2 4-4"%3E%3C/path%3E%3C/svg%3E') center/contain no-repeat;
    background-color: currentColor;
}

/* Okta provider icon - key for SSO authentication */
.idp-button.okta .idp-button-icon,
.idp-button.okta-button .idp-button-icon,
.idp-button.okta-custom .idp-button-icon {
    -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"%3E%3Cpath d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"%3E%3C/path%3E%3C/svg%3E') center/contain no-repeat;
    mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"%3E%3Cpath d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"%3E%3C/path%3E%3C/svg%3E') center/contain no-repeat;
    background-color: currentColor;
}

/* IdP Button Text */
.idp-button-text {
    flex: 1;
    text-align: center;
}

/* Login Separator */
.login-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: #666;
    font-size: 14px;
}

.login-separator::before,
.login-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e0e0;
}

.login-separator span {
    padding: 0 16px;
}

.login-separator.hidden {
    display: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .idp-button {
        background-color: #2a2a2a;
        color: #ffffff;
        border-color: #404040;
    }

    .idp-button:hover {
        background-color: #353535;
        border-color: var(--primary-color, #4da6ff);
    }

    .login-separator {
        color: #aaa;
    }

    .login-separator::before,
    .login-separator::after {
        border-bottom-color: #404040;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .idp-button {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .idp-button {
        border-width: 2px;
    }

    .idp-button:focus-visible {
        outline-width: 3px;
    }
}