/* Shared Authentication and Self-Service Styles */

.account-flow-shell {
    position: relative;
    width: 100%;
    overflow: hidden;
    transition: height .42s cubic-bezier(.22, 1, .36, 1);
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.account-flow {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1 1 auto;
    min-height: 0;
}

.account-flow__pane {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: inherit;
    transform: translateX(0);
    opacity: 1;
    pointer-events: none;
    will-change: transform, opacity;
    min-height: 0;
}

.account-flow__pane--resting {
    position: relative;
    pointer-events: auto;
    flex: 1 1 auto;
}

.account-flow__pane--animating {
    transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .36s ease;
}

.account-flow__pane--enter-forward {
    transform: translateX(22%);
    opacity: 0;
}

.account-flow__pane--enter-backward {
    transform: translateX(-22%);
    opacity: 0;
}

.account-flow__pane--enter-active {
    transform: translateX(0);
    opacity: 1;
}

.account-flow__pane--exit-forward {
    transform: translateX(-18%);
    opacity: 0;
}

.account-flow__pane--exit-backward {
    transform: translateX(18%);
    opacity: 0;
}

.account-flow__header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.account-flow__header h1,
.account-flow__header h2 {
    margin: 0;
    color: inherit;
}

.account-flow__back {
    border: 1px solid var(--border);
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #0f172a;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: transform .18s ease;
}

.account-flow__back:active {
    transform: scale(.97);
}

.account-flow__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
}

/* Specific styling for the standalone account flow (Login/Register) */
.account-flow-shell--account {
    position: relative;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: calc(var(--safe-area-top, 0px) + 32px) clamp(16px, 5vw, 40px) calc(var(--safe-area-bottom, 0px) + 48px);
    min-height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    color: #0f172a;
}

.account-flow-shell--account .account-flow__card {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 40px;
    border-radius: 32px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, .06);
    box-shadow: 0 20px 40px -4px rgba(15, 23, 42, .08), 0 8px 16px -4px rgba(15, 23, 42, .04);
}

.account-flow__titles {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-flow__eyebrow {
    margin: 0;
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #94a3b8;
}

.account-flow__subtitle {
    margin: 0;
    font-size: 15px;
    color: #475569;
}

.account-input {
    width: 100%;
    border-radius: 12px;
    border: 2px solid transparent;
    padding: 16px 18px;
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    background: #cbd5e1;
    color: #0f172a;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.account-input::placeholder {
    color: #64748b;
    opacity: 1;
}

.account-input:hover {
    background: #c2cbd6;
}

.account-input:focus {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, .15);
    outline: none;
}

.account-flow__notice {
    margin: 0;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
}

.account-flow__notice--warning {
    background: #fff7ed;
    color: #b45309;
    border-color: rgba(234, 88, 12, .35);
}

.account-form,
.team-form,
.code-step {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-form label,
.team-form label,
.code-step label,
.account-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.account-flow__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-flow__oauth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all .2s ease;
    cursor: pointer;
    font-size: 15px;
}

.account-flow__oauth:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.account-flow__oauth:active {
    background: #f1f5f9;
    transform: scale(0.99);
}

.account-flow__oauth-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.account-flow__divider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #64748b;
    margin: 6px 0;
}

.account-flow__divider::before,
.account-flow__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* Self-Service specific */
.self-service {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.self-service__step {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.self-service__step[data-complete="true"] {
    border-color: #34d399;
    box-shadow: 0 0 0 1px rgba(52, 211, 153, .25);
}

.self-service__step header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.self-service__step .badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.account-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 12px 14px;
}

@media (min-width: 768px) {
    .account-flow-shell--account {
        align-items: center;
        justify-content: center;
        padding: clamp(18px, 4vw, 36px);
    }

    .account-flow-shell--account .account-flow {
        max-width: 520px;
        margin: 0 auto;
    }
}

@media (max-width: 767px) {
    .account-flow-shell--account {
        padding: calc(var(--safe-area-top, 0px) + 24px) 16px calc(var(--safe-area-bottom, 0px) + 32px);
        min-height: calc(100dvh - var(--safe-area-top, 0px));
        background: #ffffff;
        align-items: stretch;
        justify-content: flex-start;
    }

    .account-flow-shell--account .account-flow__card {
        padding: 24px;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        max-width: none;
        min-height: 100vh;
        /* Ensure full height on mobile */
    }
}

/* Button Styles for Auth UI */
.btn {
    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform .16s ease, background-color .18s ease, box-shadow .18s ease, color .18s ease;
    font-weight: 600;
    font-size: 14px;
    width: 100%;
}

.btn:active {
    transform: scale(.98);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:focus-visible {
    outline: 3px solid rgba(59, 130, 246, .45);
    outline-offset: 2px;
}

.btn-prim {
    background: #0f172a;
    /* Dark Blue from screenshot */
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -1px rgba(15, 23, 42, 0.06);
}

.btn-prim:hover {
    background: #1e293b;
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    transform: translateY(-1px);
}

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

.btn-flat {
    background: #f1f5f9;
    /* Light gray */
    color: #334155;
}

.btn-flat:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-warn {
    background: #dc2626;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: #0f172a;
}

.btn-link {
    background: transparent;
    color: #64748b;
    padding: 8px;
    font-weight: 500;
    text-decoration: none;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.btn-link:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.04);
}

/* OAuth button group */
.account-flow__oauth-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Fix for lobby dark mode context - override app shell background */
body.auth-mode,
body.auth-mode .app-shell,
body.auth-mode .app-content-wrapper,
body.auth-mode .app-content,
body.auth-mode #app-root {
    background: #ffffff !important;
    background-image: none !important;
}

.account-flow-shell--account {
    background: #ffffff !important;
    color: #0f172a !important;
}

.account-flow-shell--account * {
    color: inherit;
}

.account-flow-shell--account h1,
.account-flow-shell--account h2,
.account-flow-shell--account h3 {
    color: #0f172a;
}

/* Fix button text visibility in auth context */
.account-flow-shell--account .btn-prim,
.account-flow .btn-prim {
    background: #0f172a !important;
    color: #ffffff !important;
}

.account-flow-shell--account .btn-flat,
.account-flow .btn-flat {
    background: #eef2f7 !important;
    color: #111827 !important;
}


.account-flow__lang {
    margin-top: 16px;
    display: flex;
    justify-content: flex-start;
}

.auth-lang-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent;
    border: none;
    padding: 8px 0;
    padding-right: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-size: 14px;
    transition: color 0.2s ease;
}

.auth-lang-select:hover {
    color: #0f172a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230f172a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

.auth-loading-placeholder {
    width: 100%;
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: .01em;
}

.auth-lang-select:focus {
    outline: none;
}

.account-flow-shell--account .btn-link,
.account-flow .btn-link {
    color: #64748b !important;
}

/* =========================================
   New Split Layout Auth Design
   ========================================= */

/* Root Container override for Split Layout */
.account-flow-shell--account.split-mode {
    padding: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #f8fafc !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-split-container {
    width: 95vw;
    height: 90vh;
    max-width: 1400px;
    max-height: 900px;
    background: #ffffff;
    border-radius: 32px;
    box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.15);
    display: flex;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(15, 23, 42, 0.05);
}

/* Common Panel Styles */
.auth-panel {
    width: 50%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: absolute;
    top: 0;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    flex-direction: column;
}

.auth-panel--form {
    background: #ffffff;
    z-index: 2;
    padding: 40px clamp(40px, 6vw, 80px);
    justify-content: center;
    left: 0;
}

.auth-panel--content {
    background: #0f172a;
    color: #ffffff;
    padding: 40px clamp(40px, 6vw, 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: absolute;
    overflow: hidden;
    z-index: 1;
    left: 50%;
}

/* Background effects for content panel */
.auth-panel--content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 0% 100%, rgba(99, 102, 241, 0.15) 0%, transparent 40%);
    pointer-events: none;
}

/* Animation States: Sliding Panels */
/* Default (Login) is handled by static positioning above */

/* REGISTER STATE */
.auth-split-container[data-mode="register"] .auth-panel--form {
    transform: translateX(100%);
}

.auth-split-container[data-mode="register"] .auth-panel--content {
    transform: translateX(-100%);
    background-color: #1e293b;
    /* Slightly lighter for register side */
}

.auth-split-container[data-mode="forgot_password"] .auth-panel--form {
    transform: translateX(0);
    /* Same as login */
}

.auth-split-container[data-mode="forgot_password"] .auth-panel--content {
    transform: translateX(0);
    /* Same as login */
}

/* --- Form Side Styling --- */
.auth-header {
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.auth-header p {
    color: #64748b;
    font-size: 16px;
    margin: 0;
}

.auth-header p a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-form-body {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

/* Enhanced Inputs */
.modern-input-group {
    margin-bottom: 20px;
    position: relative;
}

.modern-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.modern-input {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 16px;
    transition: all 0.2s ease;
    color: #0f172a;
}

.modern-input:focus {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
}

.modern-input-wrapper {
    position: relative;
    width: 100%;
}

.modern-input-wrapper .modern-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 5;
}

.password-toggle:hover {
    color: #0f172a;
    background-color: rgba(15, 23, 42, 0.05);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* Enhanced Buttons */
.auth-btn-primary {
    width: 100%;
    padding: 16px;
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.1);
    margin-top: 24px;
}

.auth-btn-primary:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.1);
}

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

.oauth-divider {
    display: flex;
    align-items: center;
    margin: 32px 0;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
}

.oauth-divider::before,
.oauth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.oauth-divider span {
    padding: 0 16px;
}

.oauth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.oauth-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #1e293b;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
    /* Ensure it floats above potential overlays */
    position: relative;
}

.oauth-btn * {
    pointer-events: none;
    /* Pass clicks through to button */
}

.oauth-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.oauth-btn img {
    width: 20px;
    height: 20px;
}

/* --- Content Side Styling: Blog Feed --- */
.content-header {
    margin-bottom: 40px;
}

.content-header h2 {
    font-size: 28px;
    color: #ffffff;
    margin: 0 0 12px 0;
}

.content-header p {
    color: #94a3b8;
    font-size: 16px;
    line-height: 1.5;
}

.blog-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 480px;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.blog-card {
    display: flex;
    gap: 16px;
    background: rgba(255, 255, 255, 0.1);
    /* Slightly increased opacity */
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 16px;
    border-radius: 16px;
    text-decoration: none !important;
    transition: all 0.2s;
    color: #ffffff !important;
    /* Force white text inheritance */
}

.blog-card * {
    text-decoration: none !important;
}

.blog-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Removed .blog-thumb styles */

.blog-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blog-title {
    color: #ffffff !important;
    /* Override global link colors */
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 4px 0;
    text-decoration: none !important;
}

.blog-meta {
    color: #94a3b8;
    font-size: 13px;
}

/* --- Content Side Styling: Register Benefits --- */
.benefits-grid {
    display: grid;
    gap: 24px;
    margin-top: 32px;
}

.benefit-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.benefit-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.benefit-text h3 {
    color: #ffffff;
    font-size: 16px;
    margin: 0 0 4px 0;
}

.benefit-text p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

/* --- Mobile / Responsive --- */
@media (max-width: 900px) {
    .account-flow-shell--account.split-mode {
        align-items: flex-start;
        padding: 0;
        background: #ffffff !important;
        /* Allow growing beyond viewport height for scrolling */
        height: auto;
        min-height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .auth-split-container {
        width: 100%;
        /* Let container grow with content */
        height: auto !important;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        display: block !important;
        /* Force block layout to avoid flex height traps */
        box-shadow: none;
        max-width: none;
        overflow: visible !important;
    }

    .auth-panel {
        position: relative;
        width: 100%;
        height: auto;
        padding: 32px 24px;
        overflow: visible;
        flex: none;
        top: auto;
        left: auto;
        transform: none !important;
        /* Disable slide on mobile */
    }

    /* On Mobile:
       Login Mode: Form First, then Blog
       Register Mode: Form First, then Benefits (or hide benefits)
    */
    .auth-split-container[data-mode="login"] .auth-panel--form,
    .auth-split-container[data-mode="register"] .auth-panel--form {
        order: 1 !important;
    }

    .auth-split-container[data-mode="login"] .auth-panel--content,
    .auth-split-container[data-mode="register"] .auth-panel--content {
        order: 2 !important;
    }

    .auth-panel--content {
        padding-top: 40px;
        padding-bottom: 80px;
        left: auto;
        position: relative !important;
        /* Force flow layout */
        top: auto !important;
        height: auto !important;
        /* Prevent scroll trapping in this panel */
        overscroll-behavior: contain;
    }

    /* Ensure blog grid doesn't trap scroll */
    .blog-grid {
        overscroll-behavior: contain;
    }
}