/* ========================================
   AUTHENTICATION PAGES STYLES
   AquaCore
   ======================================== */
/* ALLOWLIST: branded-auth-page - standalone login page with custom design */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --auth-primary: #0ea5e9;
    --auth-primary-hover: #0284c7;
    --auth-success: #10b981;
    --auth-error: #ef4444;
    --auth-warning: #f59e0b;
    --auth-text: #1e293b;
    --auth-text-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-bg: #f8fafc;
    --auth-card-bg: #ffffff;
    --auth-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --auth-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
}

/* ========================================
   MAIN CONTAINER
   ======================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* ALLOWLIST: branding gradient (intentional) */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    padding: 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ========================================
   AUTH CARD
   ======================================== */
.auth-card {
    background: var(--auth-card-bg);
    color: var(--auth-text);
    border-radius: 24px;
    box-shadow: var(--auth-shadow-lg);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 460px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@media (max-width: 576px) {
    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }
}

/* ========================================
   LOGO SECTION
   ======================================== */
.auth-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo img {
    height: 60px;
    max-width: 100%;
    margin-bottom: 1rem;
}

.auth-subtitle {
    color: var(--auth-text-muted);
    font-size: 1rem;
    margin: 0;
    font-weight: 400;
}

/* ========================================
   ALERT MESSAGES
   ======================================== */
.auth-alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease;
    text-align: center;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-alert::before {
    content: '';
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-alert-error::before {
    content: '✕';
    background: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.auth-alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.auth-alert-success::before {
    content: '✓';
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.auth-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.auth-alert-info {
    background: rgba(14, 165, 233, 0.1);
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.auth-alert-info::before {
    content: 'i';
    background: #0ea5e9;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    font-style: italic;
}

/* ========================================
   FORM STYLES
   ======================================== */
.auth-form {
    margin-bottom: 1.5rem;
}

.auth-form-group {
    margin-bottom: 1.5rem;
}

.auth-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--auth-text);
    margin-bottom: 0.5rem;
}

.auth-form-label i {
    color: var(--auth-primary);
}

.auth-input-wrapper {
    position: relative;
}

.auth-form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 3rem;
    font-size: 1rem;
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    background: #fafafa;
    color: var(--auth-text);
    transition: all 0.2s ease;
    font-family: inherit;
}

.auth-form-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.auth-form-input::placeholder {
    color: #94a3b8;
}

.auth-input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.125rem;
    transition: color 0.2s ease;
    cursor: pointer;
}

.auth-form-input:focus + .auth-input-icon {
    color: var(--auth-primary);
}

/* ========================================
   REMEMBER ME CHECKBOX
   ======================================== */
.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.auth-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    border-radius: 4px;
}

.auth-remember label {
    font-size: 0.875rem;
    color: var(--auth-text-muted);
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* ========================================
   SUBMIT BUTTON
   ======================================== */
.auth-submit-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--auth-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.auth-submit-btn:hover:not(:disabled) {
    background: var(--auth-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.3);
}

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

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

.auth-submit-btn .btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.auth-submit-btn .spinner {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.auth-submit-btn.loading .btn-text {
    opacity: 0;
}

.auth-submit-btn.loading .spinner {
    display: block;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Auth card entry animation */
.auth-card.animate-in {
    animation: authCardSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes authCardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   FOOTER
   ======================================== */
.auth-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--auth-border);
}

.auth-footer-note {
    margin: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 400;
}

.auth-footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--auth-text-muted);
}

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

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

/* ========================================
   DARK MODE SUPPORT
   ========================================
   Uses [data-bs-theme="dark"] to match app theme toggle.
   v3.0.9: Changed from @media (prefers-color-scheme: dark)
   ======================================== */
[data-bs-theme="dark"] {
    /* Override auth variables for dark mode */
    --auth-text: #f1f5f9;
    --auth-text-muted: #94a3b8;
    --auth-border: #334155;
    --auth-bg: #0f172a;
    --auth-card-bg: #1e293b;

    /* Auth container - darker gradient */
    & .auth-container {
        background: linear-gradient(135deg, #4c1d95 0%, #1e1b4b 100%);
    }

    /* Auth card */
    & .auth-card {
        background: var(--auth-card-bg);
        color: var(--auth-text);
        border-color: var(--auth-border);
    }

    /* Form inputs */
    & .auth-form-input {
        background: #0f172a;
        color: #f1f5f9;
        border-color: var(--auth-border);
    }

    & .auth-form-input:focus {
        background: #1e293b;
    }

    & .auth-form-input::placeholder {
        color: #64748b;
    }

    /* Labels */
    & .auth-form-label {
        color: var(--auth-text);
    }

    & .auth-subtitle {
        color: var(--auth-text-muted);
    }

    /* Remember me */
    & .auth-remember label {
        color: var(--auth-text-muted);
    }

    /* Footer */
    & .auth-footer {
        border-top-color: var(--auth-border);
    }

    & .auth-footer p {
        color: var(--auth-text-muted);
    }

    & .auth-footer-note {
        color: #64748b;
    }

    /* Alert colors for dark mode - ensure readable contrast */
    & .auth-alert-error {
        background: rgba(239, 68, 68, 0.2);
        color: #fca5a5;
        border-color: rgba(239, 68, 68, 0.4);
    }

    & .auth-alert-success {
        background: rgba(16, 185, 129, 0.2);
        color: #6ee7b7;
        border-color: rgba(16, 185, 129, 0.4);
    }

    & .auth-alert-warning {
        background: rgba(245, 158, 11, 0.2);
        color: #fcd34d;
        border-color: rgba(245, 158, 11, 0.4);
    }

    & .auth-alert-info {
        background: rgba(14, 165, 233, 0.2);
        color: #7dd3fc;
        border-color: rgba(14, 165, 233, 0.4);
    }

    /* Bootstrap text-body-secondary override for auth pages */
    & .auth-card .text-body-secondary {
        color: var(--auth-text-muted) !important;
    }

    /* Input icon */
    & .auth-input-icon {
        color: #64748b;
    }
}

/* ========================================
   ERROR STATE ICON
   ======================================== */
.auth-error-icon {
    font-size: 4rem;
    display: block;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.auth-form-input:focus-visible,
.auth-submit-btn:focus-visible,
.auth-remember input:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .auth-card {
        border: 2px solid currentColor;
    }

    .auth-form-input {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   404 ERROR PAGE
   ======================================== */
.error-gif {
    max-height: 200px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ALLOWLIST: branding gradient for 404 page */
.error-code {
    font-size: 6rem;
    background: linear-gradient(135deg, var(--auth-primary) 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 576px) {
    .error-code {
        font-size: 4rem;
    }
    .error-gif {
        max-height: 150px;
    }
}
