/* Authentication pages — scoped to .auth-root */

.auth-root {
    --site-radius: 0.75rem;
    --site-background: #fcfcfc;
    --site-foreground: #1a1a22;
    --site-muted-fg: #6b7280;
    --site-accent: #d10024;
    --site-accent-fg: #ffffff;
    --site-border: #e5e7eb;
    --site-input: #e5e7eb;
    --site-sidebar: #1a1a22;
    --site-gradient-accent: linear-gradient(135deg, #d10024 0%, #a8001c 100%);
    --site-shadow-glow: 0 0 60px -10px rgba(209, 0, 36, 0.35);
    --site-font: 'Cairo', ui-sans-serif, system-ui, sans-serif;
    --site-font-display: 'Sora', 'Cairo', sans-serif;

    font-family: var(--site-font);
    color: var(--site-foreground);
    background: #fff;
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .auth-shell {
        grid-template-columns: 1fr 1fr;
    }
}

.auth-brand-panel {
    display: none;
    position: relative;
    overflow: hidden;
    background: var(--site-sidebar);
}

@media (min-width: 1024px) {
    .auth-brand-panel {
        display: block;
    }
}

.auth-brand-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
}

.auth-brand-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(26, 26, 34, 0.95) 0%, rgba(26, 26, 34, 0.55) 55%, transparent 100%);
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    padding: 3rem;
    color: #fff;
}

.auth-brand-logo,
.auth-mobile-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    color: inherit;
    text-decoration: none;
    font-family: var(--site-font-display);
    font-size: 1.25rem;
    font-weight: 700;
}

.auth-mobile-logo {
    margin-bottom: 2rem;
    color: var(--site-foreground);
}

.auth-mobile-logo .auth-brand-logo-image {
    height: 2.35rem;
    width: auto;
    max-height: 2.35rem;
    background: transparent;
    object-fit: contain;
}

.auth-mobile-logo .site-logo-text-stack,
.auth-mobile-logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 0;
}

.auth-mobile-logo .site-logo-text {
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--site-foreground);
}

.auth-mobile-logo .site-logo-tagline {
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--site-accent);
    line-height: 1;
}

@media (min-width: 1024px) {
    .auth-mobile-logo {
        display: none;
    }
}

.auth-brand-mark {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    background: var(--site-gradient-accent);
    color: #fff;
}

.auth-brand-mark svg {
    width: 1.25rem;
    height: 1.25rem;
}

.auth-brand-logo-image {
    display: block;
    height: 3rem;
    width: auto;
    max-width: min(100%, 16rem);
    object-fit: contain;
    background: transparent;
}

.auth-brand-logo-image--light {
    height: 2.35rem;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.auth-brand-logo .site-logo-text-stack,
.auth-brand-logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.auth-brand-logo .site-logo-text {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.15;
    color: #fff;
}

.auth-brand-logo .site-logo-tagline {
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: #fff;
    opacity: 0.85;
    line-height: 1;
}

.auth-brand-copy h2 {
    font-family: var(--site-font-display);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.auth-brand-copy p {
    margin: 0.75rem 0 0;
    max-width: 28rem;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.7;
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.auth-form-inner {
    width: 100%;
    max-width: 28rem;
}

.auth-title {
    font-family: var(--site-font-display);
    font-size: clamp(1.75rem, 4vw, 2rem);
    font-weight: 700;
    margin: 0;
}

.auth-subtitle {
    margin: 0.5rem 0 0;
    color: var(--site-muted-fg);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.auth-body {
    margin-top: 2rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--site-muted-fg);
    font-size: 0.875rem;
}

.auth-footer a,
.auth-link {
    color: var(--site-accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover,
.auth-link:hover {
    text-decoration: underline;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-row-2 {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .auth-row-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.auth-input-wrap {
    position: relative;
}

.auth-input {
    width: 100%;
    height: 2.75rem;
    padding: 0 0.875rem;
    border: 1px solid var(--site-input);
    border-radius: var(--site-radius);
    background: #fff;
    font: inherit;
    color: var(--site-foreground);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--site-accent);
    box-shadow: 0 0 0 3px rgba(209, 0, 36, 0.12);
}

.auth-input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.auth-input-wrap .auth-input {
    padding-inline-end: 2.75rem;
}

.auth-toggle-password {
    position: absolute;
    inset-inline-end: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--site-muted-fg);
    display: grid;
    place-items: center;
    padding: 0.25rem;
    cursor: pointer;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.875rem;
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: var(--site-radius);
    background: var(--site-gradient-accent);
    color: var(--site-accent-fg);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--site-shadow-glow);
    transition: opacity 0.15s, transform 0.15s;
}

.auth-btn:hover:not(:disabled) {
    opacity: 0.92;
}

.auth-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.auth-btn-outline {
    background: #fff;
    color: var(--site-foreground);
    border: 1px solid var(--site-border);
    box-shadow: none;
}

.auth-btn-outline:hover:not(:disabled) {
    background: #fafafa;
    opacity: 1;
}

.auth-divider {
    position: relative;
    text-align: center;
    color: var(--site-muted-fg);
    font-size: 0.75rem;
    margin: 0.25rem 0;
}

.auth-divider::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 50%;
    height: 1px;
    background: var(--site-border);
}

.auth-divider span {
    position: relative;
    z-index: 1;
    background: #fff;
    padding-inline: 0.75rem;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.875rem;
    color: var(--site-muted-fg);
    cursor: pointer;
}

.auth-check input {
    margin-top: 0.2rem;
    accent-color: var(--site-accent);
}

.auth-alert {
    padding: 0.75rem 0.875rem;
    border-radius: var(--site-radius);
    font-size: 0.875rem;
    line-height: 1.5;
}

.auth-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-alert-info {
    background: #f8fafc;
    color: #334155;
    border: 1px solid var(--site-border);
}

.auth-field-error {
    font-size: 0.8125rem;
    color: #b91c1c;
}

.auth-otp-group {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    direction: ltr;
}

.auth-otp-slot {
    width: 2.75rem;
    height: 3rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    border: 1px solid var(--site-input);
    border-radius: var(--site-radius);
    background: #fff;
}

.auth-otp-slot:focus {
    outline: none;
    border-color: var(--site-accent);
    box-shadow: 0 0 0 3px rgba(209, 0, 36, 0.12);
}

.auth-otp-slot-error {
    border-color: #f87171;
}

.auth-strength {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.auth-strength-bar {
    height: 0.35rem;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}

.auth-strength-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    transition: width 0.2s;
}

.auth-strength-weak { background: #ef4444; }
.auth-strength-fair { background: #f59e0b; }
.auth-strength-good { background: #3b82f6; }
.auth-strength-strong { background: #16a34a; }

.auth-strength-label {
    font-size: 0.8125rem;
    color: var(--site-muted-fg);
}

.auth-timer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--site-muted-fg);
}

.auth-success-box {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.875rem;
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    background: #fafafa;
    color: var(--site-foreground);
    font-size: 0.875rem;
    line-height: 1.6;
}

.auth-google-wrap {
    display: flex;
    justify-content: center;
}

.auth-google-block {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.auth-google-wrap > div {
    width: 100%;
}

.auth-google-wrap > div.auth-google-busy {
    pointer-events: none;
    opacity: 0.65;
}

.auth-google-consent,
.auth-google-status {
    margin: 0;
    text-align: center;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--site-muted-fg, #6b7280);
    opacity: 1;
    visibility: visible;
}

.auth-google-consent a.auth-link {
    color: var(--site-accent, #d10024);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-google-status {
    color: var(--site-foreground, #111827);
    font-weight: 500;
}

/* Account pages inside public layout */
.account-page {
    padding: 2rem 0 4rem;
}

.account-card {
    background: #fff;
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 24px -8px rgba(26, 26, 34, 0.08);
}

.account-page.site-root {
    min-height: auto;
}

.account-grid {
    display: grid;
    gap: 1.5rem;
}

.account-shell {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
    max-width: 100%;
}

.account-shell-content {
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 767px) {
    .account-page {
        padding: 1.25rem 0 6rem;
        overflow-x: clip;
    }

    .account-page > .site-container {
        padding-inline: 1.125rem;
    }

    .account-card {
        padding: 1.125rem;
        border-radius: 1rem;
    }

    .account-shell {
        gap: 1rem;
    }

    .account-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        min-width: 0;
        max-width: 100%;
    }

    .account-grid > aside.account-card {
        position: sticky;
        top: 0;
        z-index: 6;
        padding: 0.5rem;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    .account-grid > section {
        min-width: 0;
        max-width: 100%;
    }

    .account-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.375rem;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        scrollbar-width: thin;
        padding-bottom: 0.125rem;
    }

    .account-nav::-webkit-scrollbar {
        height: 3px;
    }

    .account-nav a {
        white-space: nowrap;
        flex: 0 0 auto;
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        border-radius: 999px;
        background: #f3f4f6;
        line-height: 1.2;
    }

    .account-nav a.active {
        background: rgba(209, 0, 36, 0.12);
        color: var(--site-accent);
        font-weight: 700;
    }

    .account-nav-divider {
        flex: 0 0 1px;
        width: 1px;
        height: 1.5rem;
        margin: 0 0.125rem;
        align-self: center;
    }

    .account-nav-bar {
        position: sticky;
        top: 4.25rem;
        z-index: 90;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        margin-inline: 0;
        margin-bottom: 1rem;
        padding: 0.55rem;
        border-radius: 1rem;
        overflow-anchor: none;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.96);
    }

    .account-nav--bar {
        max-width: 100%;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        scroll-padding-inline: 0.75rem;
    }

    .account-nav--bar a {
        padding: 0.5rem 0.85rem;
        font-size: 0.8125rem;
        border-radius: 999px;
        background: #f3f4f6;
    }

    .account-nav--bar a.active {
        background: rgba(209, 0, 36, 0.14);
        color: var(--site-accent);
        font-weight: 700;
        box-shadow: inset 0 0 0 1px rgba(209, 0, 36, 0.28);
    }

    .imp-page-hero {
        padding: 1.75rem 0 1.5rem;
    }

    .imp-page-body {
        padding: 1.25rem 0 6rem;
    }

    .imp-page .site-container,
    .account-page .site-container {
        padding-inline: 1.125rem;
    }
}

@media (min-width: 768px) {
    .account-grid {
        grid-template-columns: 240px 1fr;
    }
}

.account-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-nav a {
    display: block;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    color: var(--site-foreground);
    text-decoration: none;
    font-size: 0.9375rem;
}

.account-nav a:hover {
    background: #f3f4f6;
}

.account-nav a.active {
    background: rgba(209, 0, 36, 0.08);
    color: var(--site-accent);
    font-weight: 600;
}

.account-nav-divider {
    display: block;
    height: 1px;
    margin: 0.375rem 0;
    background: var(--site-border);
}

.account-nav--bar {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    scrollbar-width: none;
}

.account-nav--bar::-webkit-scrollbar {
    display: none;
}

.account-nav--bar .account-nav-divider {
    flex: 0 0 1px;
    width: 1px;
    height: auto;
    align-self: stretch;
    margin: 0.25rem 0.125rem;
}

.account-nav--bar a {
    white-space: nowrap;
    flex: 0 0 auto;
}

.account-nav-bar {
    margin-bottom: 1.25rem;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    box-shadow: 0 4px 24px -8px rgba(26, 26, 34, 0.06);
}

.account-nav-bar--sticky {
    position: sticky;
    top: 4.25rem;
    z-index: 90;
    overflow-anchor: none;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.96);
}

.account-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    margin-bottom: 1.25rem;
}

.account-page-title {
    margin: 0;
    font-family: var(--site-font-display, inherit);
    font-size: clamp(1.25rem, 2.5vw, 1.55rem);
    font-weight: 800;
    color: var(--site-foreground);
    line-height: 1.25;
}

.account-page-desc {
    margin: 0.35rem 0 0;
    color: var(--site-muted-fg);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* User menu in header */
.site-user-menu {
    position: relative;
}

.site-user-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: transparent;
}

.site-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--site-border);
    border-radius: 999px;
    background: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font: inherit;
}

.site-user-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--site-gradient-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.site-user-name {
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .site-mobile-drawer .site-user-avatar {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.6875rem;
    }
}

.site-user-dropdown {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 0.5rem);
    min-width: 12rem;
    background: #fff;
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    box-shadow: 0 10px 40px -12px rgba(26, 26, 34, 0.18);
    padding: 0.375rem;
    z-index: 60;
}

.site-user-dropdown a,
.site-user-dropdown button {
    display: block;
    width: 100%;
    text-align: start;
    padding: 0.625rem 0.75rem;
    border: 0;
    background: transparent;
    color: var(--site-foreground);
    text-decoration: none;
    border-radius: 0.5rem;
    font: inherit;
    cursor: pointer;
}

.site-user-dropdown a:hover,
.site-user-dropdown button:hover {
    background: #f3f4f6;
}

.site-user-dropdown .danger {
    color: #b91c1c;
}

.access-denied-card {
    max-width: 32rem;
    margin: 3rem auto;
    padding: 2rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    box-shadow: 0 10px 40px -12px rgba(26, 26, 34, 0.12);
}

.access-denied-icon {
    display: grid;
    place-items: center;
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1rem;
    border-radius: 999px;
    background: rgba(209, 0, 36, 0.08);
    color: var(--site-accent);
}

.access-denied-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.access-denied-card p {
    color: var(--site-muted-fg);
    line-height: 1.7;
    margin: 0 0 1.5rem;
}

.access-denied-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.access-denied-actions .auth-btn {
    min-width: 9rem;
    width: auto;
}

.route-loading-shell,
.route-auth-loading {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #fff;
    color: #1a1a22;
    font-family: var(--site-font, 'Cairo', ui-sans-serif, system-ui, sans-serif);
}

.route-auth-loading {
    gap: 0.75rem;
    align-content: center;
}

.route-auth-loading p {
    margin: 0;
    color: #6b7280;
}

.route-auth-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 3px solid #f3f4f6;
    border-top-color: #d10024;
    animation: route-spin 0.8s linear infinite;
}

@keyframes route-spin {
    to {
        transform: rotate(360deg);
    }
}
