/* ============================================================
   NASHRA - Authentication Pages Stylesheet
   Styles for login, password change, and unauthorized pages
   ============================================================ */

/* ============================================================
   AUTH BODY & CONTAINER
   ============================================================ */
.auth-body {
    min-height: 100vh;
    background: var(--color-bg);
    overflow-x: hidden;
}

.auth-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

/* ============================================================
   TOP BAR ELEMENTS (Theme toggle & back link)
   ============================================================ */
.auth-theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.auth-back-link {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.5rem 1rem;
    background: var(--color-surface);
    color: var(--color-text-muted);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid var(--color-border);
}

.auth-back-link:hover {
    color: var(--color-primary);
    transform: translateX(-2px);
}

/* ============================================================
   BRAND PANEL (Left side)
   ============================================================ */
.auth-brand-panel {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: var(--space-2xl);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.auth-brand-inner {
    position: relative;
    z-index: 2;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: var(--space-lg) 0;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: white;
    margin-bottom: var(--space-2xl);
}

.auth-logo .logo-mark {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.auth-logo .logo-mark-inner {
    color: white;
}

.auth-logo .logo-title {
    color: white;
    font-size: 1.25rem;
}

.auth-logo .logo-sub {
    color: rgba(255, 255, 255, 0.7);
}

.auth-brand-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-brand-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: white;
    line-height: 1.1;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.auth-brand-accent {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
}

.auth-brand-subtitle {
    font-size: 1.0625rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin-bottom: var(--space-2xl);
    max-width: 460px;
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.auth-brand-feature {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.auth-brand-feature:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(4px);
}

.auth-brand-feature-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
}

.auth-brand-feature strong {
    display: block;
    color: white;
    font-weight: 700;
    font-size: 0.9375rem;
    margin-bottom: 2px;
}

.auth-brand-feature p {
    margin: 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.auth-brand-footer {
    margin-top: var(--space-2xl);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125rem;
}

.auth-brand-footer p {
    margin: 0;
}

/* Decorative background shapes */
.auth-brand-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    pointer-events: none;
}

.auth-shape-1 {
    width: 500px;
    height: 500px;
    top: -150px;
    right: -150px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.4) 0%, transparent 70%);
    animation: floatShape 15s ease-in-out infinite;
}

.auth-shape-2 {
    width: 400px;
    height: 400px;
    bottom: -100px;
    left: -100px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.35) 0%, transparent 70%);
    animation: floatShape 18s ease-in-out infinite reverse;
}

@keyframes floatShape {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.1); }
}

.auth-brand-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    pointer-events: none;
}

/* ============================================================
   FORM PANEL (Right side)
   ============================================================ */
.auth-form-panel {
    background: var(--color-bg);
    padding: var(--space-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.auth-form-inner {
    width: 100%;
    max-width: 440px;
}

.auth-mobile-logo {
    display: none;
    justify-content: center;
    margin-bottom: var(--space-xl);
}

.auth-form-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-form-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
}

.auth-form-subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   ALERT MESSAGES (in-form errors / success)
   ============================================================ */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 0.9375rem;
    line-height: 1.5;
    border-left: 4px solid;
    animation: slideDown 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-alert-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    line-height: 1.3;
}

.auth-alert-message {
    flex: 1;
    color: var(--color-text);
    font-weight: 500;
}

.auth-alert-error {
    background: var(--color-danger-pale);
    border-color: var(--color-danger);
}

.auth-alert-success {
    background: var(--color-success-pale);
    border-color: var(--color-success);
}

.auth-alert-info {
    background: var(--color-info-pale);
    border-color: var(--color-info);
}

.auth-alert-warning {
    background: var(--color-warning-pale);
    border-color: var(--color-warning);
}

/* ============================================================
   FORM
   ============================================================ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.label-with-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.label-with-link .form-label {
    margin-bottom: 0;
}

.form-link {
    font-size: 0.8125rem;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.form-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ============================================================
   INPUTS WITH ICONS
   ============================================================ */
.input-with-icon {
    position: relative;
    display: block;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.form-control.input-has-icon {
    padding-left: 2.75rem;
}

.form-control.input-has-toggle {
    padding-right: 3rem;
}

/* Highlight icon color when input is focused */
.input-with-icon:focus-within .input-icon {
    color: var(--color-primary);
}

/* ============================================================
   PASSWORD TOGGLE BUTTON
   ============================================================ */
.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    z-index: 2;
}

.password-toggle:hover {
    background: var(--color-surface-hover);
}

.password-toggle-icon {
    font-size: 1.125rem;
    line-height: 1;
    filter: grayscale(0.5);
    opacity: 0.8;
    user-select: none;
}

.password-toggle.showing .password-toggle-icon {
    filter: none;
    opacity: 1;
}

/* ============================================================
   BUTTON LOADING STATE
   ============================================================ */
#loginButton,
.auth-form button[type="submit"] {
    margin-top: var(--space-sm);
    position: relative;
}

.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn .nashra-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

.btn:disabled .btn-text {
    opacity: 0.7;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.auth-divider {
    text-align: center;
    margin: var(--space-xl) 0 var(--space-md);
    position: relative;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 60px);
    height: 1px;
    background: var(--color-border);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

.auth-divider span {
    background: var(--color-bg);
    padding: 0 var(--space-md);
    position: relative;
    z-index: 1;
}

/* ============================================================
   HELP LINKS
   ============================================================ */
.auth-help-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.auth-help-link {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--transition-base);
}

.auth-help-link:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--color-text);
}

.auth-help-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1.2;
}

.auth-help-link strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
    line-height: 1.3;
}

.auth-help-link p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.3;
}

/* ============================================================
   FORM FOOTER (legal text)
   ============================================================ */
.auth-form-footer {
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.75rem;
    line-height: 1.5;
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-divider);
}

.auth-form-footer p {
    margin: 0;
}

/* ============================================================
   PASSWORD STRENGTH INDICATOR (used on password-change page)
   ============================================================ */
.password-strength {
    margin-top: var(--space-sm);
}

.password-strength-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.password-strength-segment {
    flex: 1;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    transition: background var(--transition-base);
}

.password-strength-segment.filled-weak {
    background: var(--color-danger);
}

.password-strength-segment.filled-fair {
    background: var(--color-warning);
}

.password-strength-segment.filled-good {
    background: #eab308;
}

.password-strength-segment.filled-strong {
    background: var(--color-success);
}

.password-strength-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.password-strength-label strong {
    font-weight: 700;
}

/* Password requirements checklist */
.password-requirements {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-sm);
}

.password-req {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    padding: 4px 0;
    transition: color var(--transition-fast);
}

.password-req-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.password-req.satisfied {
    color: var(--color-success);
}

.password-req.satisfied .password-req-icon {
    background: var(--color-success);
    color: white;
}

/* ============================================================
   RESPONSIVE - HIDE BRAND PANEL ON MOBILE/TABLET
   ============================================================ */
@media (max-width: 900px) {
    .auth-container {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-mobile-logo {
        display: flex;
    }

    .auth-form-panel {
        min-height: 100vh;
        padding: var(--space-xl) var(--space-md);
    }

    .auth-back-link,
    .auth-theme-toggle {
        top: 16px;
    }

    .auth-back-link {
        left: 16px;
    }

    .auth-theme-toggle {
        right: 16px;
    }
}

@media (max-width: 640px) {
    .auth-form-panel {
        padding: var(--space-lg) var(--space-md);
    }

    .auth-form-inner {
        padding-top: var(--space-xl);
    }

    .auth-form-title {
        font-size: 1.625rem;
    }

    .auth-help-links {
        grid-template-columns: 1fr;
    }

    .auth-back-link span,
    .auth-back-link {
        font-size: 0.8125rem;
        padding: 0.4rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .auth-form-title {
        font-size: 1.5rem;
    }

    .auth-form-subtitle {
        font-size: 0.9375rem;
    }

    .form-control.input-has-icon {
        padding-left: 2.5rem;
    }

    .input-icon {
        left: 0.75rem;
    }
}

/* ============================================================
   DARK MODE ADJUSTMENTS
   ============================================================ */
[data-theme="dark"] .auth-brand-feature {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .auth-brand-feature:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .auth-divider span {
    background: var(--color-bg);
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .auth-brand-shape {
        animation: none;
    }

    .auth-alert {
        animation: none;
    }

    .auth-brand-feature:hover,
    .auth-help-link:hover,
    .auth-back-link:hover {
        transform: none;
    }
}

/* ============================================================
   USER INFO BANNER (shown on change-password page)
   ============================================================ */
.auth-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-primary-pale);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.auth-user-info-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.auth-user-info-text {
    flex: 1;
    min-width: 0;
}

.auth-user-info-name {
    font-weight: 700;
    color: var(--color-text);
    font-size: 0.9375rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-user-info-email {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}