:root {
    --auth-bg: var(--bg-soft);
    --auth-card-bg: var(--white);
    --auth-primary: var(--primary);
    --auth-primary-hover: var(--primary-hover);
    --auth-text: var(--text);
    --auth-text-muted: var(--text-muted);
    --auth-border: var(--border);
    --auth-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --auth-radius: var(--radius-xl, 16px);
}

.auth-page {
    box-sizing: border-box;
    background: var(--auth-bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(var(--primary-rgb), 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(var(--purple-rgb), 0.03) 0px, transparent 50%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--auth-text);
    padding: 20px;
}

.auth-page *, .auth-page *::before, .auth-page *::after {
    box-sizing: border-box;
}

.auth-card {
    background: var(--auth-card-bg);
    width: 100%;
    max-width: 440px;
    padding: var(--space-10);
    border-radius: 24px;
    box-shadow: var(--auth-shadow);
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo {
    height: 52px;
    width: auto;
    margin-bottom: 28px;
    transition: transform 0.3s ease;
}

.auth-logo:hover {
    transform: scale(1.05);
}

.auth-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--auth-text);
    letter-spacing: -0.025em;
}

.auth-subtitle {
    color: var(--auth-text-muted);
    font-size: 15px;
    line-height: 1.5;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--auth-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.form-header .form-label {
    margin-bottom: 0;
}

.form-link {
    font-size: 13px;
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

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

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-soft);
}

.form-control:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
    background: var(--white);
    transform: translateY(-1px);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.password-toggle:hover {
    color: var(--auth-primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background: var(--auth-primary);
    color: white;
    border: none;
    border-radius: var(--auth-radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 6px -1px rgba(var(--primary-rgb), 0.2), 0 2px 4px -1px rgba(var(--primary-rgb), 0.1);
}

.btn-auth:hover {
    background: var(--auth-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(var(--primary-rgb), 0.3), 0 4px 6px -2px rgba(var(--primary-rgb), 0.1);
}

.btn-auth:active {
    transform: translateY(0);
}

.btn-auth:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-footer {
    margin-top: 40px;
    text-align: center;
    font-size: 15px;
    color: var(--auth-text-muted);
    border-top: 1px solid var(--auth-border);
    padding-top: 32px;
}

.auth-footer a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s;
}

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

.alert {
    padding: 14px 20px;
    border-radius: var(--auth-radius);
    margin-bottom: 28px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
}

.alert--error {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.alert--success {
    background: #f0fdf4;
    color: #166534;
    border-color: #dcfce7;
}

/* Custom Selection Control */
.auth-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

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

.auth-remember span {
    font-size: 14px;
    color: var(--auth-text-muted);
    font-weight: 500;
}

.form-hint {
    font-size: 12px;
    color: var(--auth-text-muted);
    margin-top: 8px;
    display: block;
}

.auth-actions {
    margin-top: 32px;
}

@media (max-width: 640px) {
    .auth-actions {
        margin-top: 24px;
    }
}

/* Test Credentials Styles */
.test-credentials {
    margin-top: 24px;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 16px;
    border: 1px dashed var(--auth-border);
    padding: 20px;
    font-size: 13px;
}

.test-credentials-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    color: var(--auth-text);
    font-weight: 700;
    margin-bottom: 0;
    transition: margin 0.3s;
}

.test-credentials.active .test-credentials-header {
    margin-bottom: 16px;
}

.test-credentials-header i {
    transition: transform 0.3s;
    color: var(--auth-text-muted);
}

.test-credentials.active .test-credentials-header i {
    transform: rotate(180deg);
}

.test-credentials-content {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.test-credentials.active .test-credentials-content {
    display: grid;
}

.test-cred-item {
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--auth-border);
    cursor: pointer;
    transition: all 0.2s;
}

.test-cred-item:hover {
    border-color: var(--auth-primary);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.test-cred-role {
    display: block;
    font-weight: 700;
    color: var(--auth-primary);
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.test-cred-email {
    display: block;
    color: var(--auth-text);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.test-cred-pass {
    display: block;
    color: var(--auth-text-muted);
    font-size: 11px;
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mobile Improvements */
@media (max-width: 640px) {
    .auth-page {
        padding: 16px;
        justify-content: flex-start;
        padding-top: 40px;
        min-height: 100vh;
        overflow-x: hidden;
    }

    .auth-card {
        padding: 32px 20px;
        border-radius: 20px;
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
    }

    .auth-header {
        margin-bottom: 32px;
    }

    .auth-logo {
        height: 44px;
        margin-bottom: 20px;
    }

    .auth-title {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .auth-subtitle {
        font-size: 14px;
    }

    .alert {
        padding: 12px 16px;
        margin-bottom: 24px;
    }

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

    .form-control {
        padding: 12px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .btn-auth {
        padding: 14px;
        font-size: 16px;
    }

    .auth-footer {
        margin-top: 32px;
        padding-top: 24px;
        font-size: 14px;
    }

    .test-credentials {
        padding: 16px;
        margin-top: 24px;
        max-width: 100%;
    }

    .test-credentials-content {
        grid-template-columns: 1fr;
    }
}
