/* ============================================================
   AUTH PAGES (Login / Register) - extracted from app.css
   Load order preserved: tokens.css -> app.css -> THIS -> mud-overrides.css
   ============================================================ */

/* Split layout */
.auth-page {
    display: flex;
    min-height: 100vh;
}

/* ── Left brand panel ── */
.auth-brand {
    flex: 0 0 70%;
    max-width: 70%;
    background: linear-gradient(160deg, #060d1a 0%, #0c1a33 25%, #142d5c 55%, var(--brand-blue-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Corner ribbon */
.auth-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    overflow: hidden;
    z-index: 10;
    pointer-events: none;
}

.auth-ribbon span {
    position: absolute;
    display: block;
    width: 220px;
    padding: 8px 0;
    background: linear-gradient(135deg, #F18A25 0%, #E07B1A 50%, #D4943C 100%);
    box-shadow: none;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    top: 32px;
    right: -55px;
    transform: rotate(45deg);
}

/* Animated background layer */
.auth-brand-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

/* Subtle grid overlay */
.auth-grid {
    position: absolute;
    inset: 0;
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 20%, transparent 70%);
}

/* Floating geometric shapes */
.auth-geo {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
}

.auth-geo-1 {
    width: 300px;
    height: 300px;
    background: rgba(35, 81, 158, 0.25);
    top: -8%;
    right: -10%;
    animation: geoFloat1 12s ease-in-out infinite;
}

.auth-geo-2 {
    width: 200px;
    height: 200px;
    background: rgba(241, 138, 37, 0.12);
    bottom: 10%;
    left: -5%;
    animation: geoFloat2 10s ease-in-out infinite;
}

.auth-geo-3 {
    width: 120px;
    height: 120px;
    background: rgba(91, 155, 213, 0.15);
    top: 40%;
    right: 15%;
    animation: geoFloat3 14s ease-in-out infinite;
}

.auth-geo-4 {
    width: 80px;
    height: 80px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    top: 20%;
    left: 20%;
    transform: rotate(45deg);
    animation: geoRotate 20s linear infinite;
    filter: none;
}

.auth-geo-5 {
    width: 60px;
    height: 60px;
    border: 1px solid rgba(241, 138, 37, 0.1);
    border-radius: 12px;
    bottom: 25%;
    right: 25%;
    transform: rotate(15deg);
    animation: geoRotate 25s linear infinite reverse;
    filter: none;
}

/* Brand content */
.auth-brand-content {
    position: relative;
    z-index: 3;
    text-align: center;
    animation: authBrandIn 0.8s ease;
}

.auth-brand-inline {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.auth-brand-logo {
    width: 220px;
    height: auto;
    filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.4));
}

.auth-brand-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.25);
}

.auth-brand-version {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.auth-brand-version__label {
    font-size: 1.4rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.auth-brand-version__number {
    font-size: 1.4rem;
    font-weight: 700;
    color: #F18A25;
    letter-spacing: 1px;
}

/* Carousel */
.auth-carousel {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.auth-carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 2s ease;
}

.auth-carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.auth-carousel-slide.leaving {
    opacity: 0;
    z-index: 0;
}

.auth-carousel-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.08);
    transition: transform 12s ease;
}

.auth-carousel-slide.active .auth-carousel-img {
    transform: scale(1);
}

.auth-carousel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        160deg,
        rgba(6, 13, 26, 0.88) 0%,
        rgba(18, 34, 68, 0.82) 30%,
        rgba(26, 61, 122, 0.78) 60%,
        rgba(35, 81, 158, 0.75) 100%
    );
}

/* Carousel dots */
.auth-carousel-dots {
    position: absolute;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.auth-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-dot.active {
    background: #F18A25;
    width: 20px;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(241, 138, 37, 0.4);
}

/* Regions footer */
.auth-brand-regions {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    z-index: 3;
    text-align: center;
    animation: authBrandIn 1s ease 0.3s both;
}

.auth-regions-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
}

.auth-regions-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 1.5rem;
}

.auth-region {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s, border-color 0.2s;
}

.auth-region:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(241, 138, 37, 0.2);
}

.auth-region .mud-icon-root {
    color: #F18A25 !important;
    font-size: 0.85rem !important;
}

.auth-region span {
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.02em;
}

.auth-region-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
}

/* ── Right form panel ── */
.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f8fa;
    padding: 2rem;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 400px;
    animation: authFormIn 0.6s ease;
}

.auth-mobile-logo {
    display: none;
}

.auth-form-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 2.5rem 2rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e8eaed;
}

.auth-form-header {
    margin-bottom: 1.75rem;
}

.auth-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.auth-form-desc {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* ── Form fields ── */
.auth-field {
    margin-bottom: 1rem;
}

.auth-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.auth-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* MudTextField overrides inside auth */
.auth-field .mud-input-outlined .mud-input-outlined-border {
    border-color: #d1d5db !important;
    border-radius: 8px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: #9ca3af !important;
}

.auth-field .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: #23519E !important;
    box-shadow: 0 0 0 3px rgba(35, 81, 158, 0.1) !important;
}

.auth-field .mud-input-adornment-start .mud-icon-root {
    color: #9ca3af;
    font-size: 1.1rem;
}

.auth-field .mud-input-adornment-end .mud-icon-root {
    color: #9ca3af;
}

.auth-field .mud-input-root-adorned-start {
    padding-left: 0.75rem !important;
}

.auth-field .mud-input-outlined:not(:has(.mud-input-adornment-start)) .mud-input-slot {
    padding-left: 0.75rem;
}

/* ── Submit button ── */
.auth-submit-btn {
    margin-top: 1rem !important;
    height: 48px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    letter-spacing: 0.03em !important;
}

/* ── Password policy ── */
.auth-password-policy {
    background: #f8f9fb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 1rem;
}

.auth-password-policy-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--brand-blue-dark);
    margin: 0 0 10px 0;
}

.auth-password-policy-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-password-policy-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #9ca3af;
    transition: color 0.2s;
}

.auth-password-policy-list li .mud-icon-root {
    font-size: 1rem !important;
    color: #d1d5db;
    transition: color 0.2s;
}

.auth-password-policy-list li.auth-policy-pass {
    color: #059669;
}

.auth-password-policy-list li.auth-policy-pass .mud-icon-root {
    color: #059669 !important;
}

/* ── Alerts ── */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    line-height: 1.3;
}

.auth-alert span {
    flex: 1;
}

.auth-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-alert-error .mud-icon-root {
    color: #dc2626;
}

.auth-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-alert-success .mud-icon-root {
    color: #16a34a;
}

.auth-alert-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: flex;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.auth-alert-close:hover {
    opacity: 1;
}

.auth-alert-close .mud-icon-root {
    font-size: 1rem;
}

/* ── Switch link ── */
.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.82rem;
    color: #6b7280;
}

.auth-switch a {
    color: #23519E;
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
    transition: color 0.15s;
}

.auth-switch a:hover {
    color: var(--brand-blue-dark);
    text-decoration: underline;
}

.auth-forgot-link {
    color: #23519E;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
}

.auth-forgot-link:hover {
    color: var(--brand-blue-dark);
    text-decoration: underline;
}

/* ── Legal footer ── */
.auth-legal {
    text-align: center;
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 1.5rem;
}

/* ── Responsive: mobile ── */
@media (max-width: 768px) {
    /* Stack: brand panel out, form takes the whole screen */
    .auth-page {
        display: block;
    }

    .auth-brand {
        display: none;
    }

    .auth-form-side {
        box-sizing: border-box;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 2rem 1.25rem;
    }

    .auth-form-wrapper {
        box-sizing: border-box;
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }

    /* Mobile logo: same light treatment as the desktop form (revealed only here) */
    .auth-mobile-logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.4rem;
        margin-bottom: 1.5rem;
        animation: authFormIn 0.6s ease;
    }

    .auth-mobile-logo img {
        width: 150px;
        height: auto;
    }

    .auth-mobile-version {
        display: inline-flex;
        align-items: baseline;
        gap: 0.4rem;
    }

    .auth-mobile-version__label {
        font-size: 0.95rem;
        font-weight: 400;
        letter-spacing: 2px;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.55);
    }

    .auth-mobile-version__number {
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: 1px;
        color: #F18A25;
    }

    .auth-form-card {
        box-sizing: border-box;
        padding: 1.75rem 1.25rem;
    }

    /* Register's two-up rows collapse to a single column */
    .auth-fields-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    .auth-form-side {
        padding: 1.5rem 0.875rem;
    }

    .auth-form-card {
        padding: 1.5rem 1rem;
    }

    .auth-mobile-logo img {
        width: 135px;
    }
}

@media (max-width: 900px) {
    .auth-brand {
        display: none;
    }

    .auth-form-side {
        flex: 1 1 100%;
        max-width: 100%;
        background: linear-gradient(160deg, #0a1628 0%, #122244 30%, var(--brand-blue-dark) 60%, #23519E 100%);
        padding: 1.5rem;
    }

    .auth-mobile-logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        margin-bottom: 1.5rem;
    }

    .auth-mobile-logo img {
        width: 160px;
        height: auto;
        filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.3));
    }

    .auth-mobile-version {
        display: inline-flex;
        align-items: baseline;
        gap: 0.4rem;
    }

    .auth-mobile-version__label {
        font-size: 0.95rem;
        font-weight: 400;
        letter-spacing: 2px;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.55);
    }

    .auth-mobile-version__number {
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: 1px;
        color: #F18A25;
    }

    .auth-form-card {
        border: none;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    }

    .auth-legal {
        color: rgba(255, 255, 255, 0.35);
    }
}
