/* ═══════════════════════════════════════════════════════════════
   auth.css  —  StoryBridge auth gate
   Replaces the old beta-gate password screen with Supabase Auth.
   ═══════════════════════════════════════════════════════════════ */

/* Full-screen overlay ─────────────────────────────────────────── */
#auth-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999999;
    background: #080e13;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    transition: opacity 0.4s ease;
}

/* Branding block ────────────────────────────────────────────────── */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 32px;
    text-align: center;
}

.auth-brand-eyebrow {
    font-size: 11px;
    letter-spacing: 3px;
    color: #4db6ac;
    text-transform: uppercase;
}

.auth-brand-name {
    font-size: 28px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: -0.5px;
}

.auth-brand-name sup {
    font-size: 0.45em;
    vertical-align: super;
}

.auth-brand-tag {
    font-size: 11px;
    color: #6b7280;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Card ──────────────────────────────────────────────────────────── */
.auth-card {
    background: #111827;
    border: 1px solid #1f2d3d;
    border-radius: 14px;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 320px;
    width: 340px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
}

.auth-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0 0 24px 0;
    text-align: center;
}

/* Inputs ────────────────────────────────────────────────────────── */
.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.auth-input {
    width: 100%;
    padding: 11px 14px;
    box-sizing: border-box;
    background: #0d1117;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.auth-input:focus {
    border-color: #4db6ac;
}

.auth-input::placeholder {
    color: #4b5563;
}

/* Error / info message ──────────────────────────────────────────── */
.auth-error {
    font-size: 12px;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 14px;
    display: none;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: #f87171;
}

.auth-error.info {
    background: rgba(77, 182, 172, 0.1);
    border-color: rgba(77, 182, 172, 0.3);
    color: #4db6ac;
}

/* Primary button ────────────────────────────────────────────────── */
.auth-btn-primary {
    width: 100%;
    padding: 12px;
    background: #4db6ac;
    border: none;
    border-radius: 8px;
    color: #0d2622;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.15s, opacity 0.15s;
    margin-bottom: 18px;
}

.auth-btn-primary:hover:not(:disabled) {
    background: #5ecec3;
}

.auth-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Toggle link ───────────────────────────────────────────────────── */
.auth-toggle {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
}

.auth-toggle a {
    color: #4db6ac;
    cursor: pointer;
    text-decoration: none;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* Footer text ───────────────────────────────────────────────────── */
.auth-footer {
    position: absolute;
    bottom: 24px;
    font-size: 11px;
    color: #374151;
    letter-spacing: 0.5px;
    text-align: center;
}

/* ── User Pill (shown after sign-in) ─────────────────────────────── */
#user-pill {
    position: fixed;
    bottom: 32px;
    /* sits just above workspace pill */
    right: 8px;
    background: #141e1e;
    border: 1px solid #2a3a3a;
    border-radius: 12px;
    padding: 3px 10px;
    z-index: 99999;
    font-size: 10px;
    color: #5a7a7a;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#user-pill-email {
    overflow: hidden;
    text-overflow: ellipsis;
    color: #4db6ac;
}

#auth-signout {
    color: #374151;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}

#auth-signout:hover {
    color: #f87171;
}

/* ── Project Resume Step ─────────────────────────────────────────── */
#auth-projects-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 115px;
    overflow-y: auto;
    padding-right: 4px; /* Space for scrollbar */
}

#auth-projects-list::-webkit-scrollbar {
    width: 6px;
}
#auth-projects-list::-webkit-scrollbar-track {
    background: transparent;
}
#auth-projects-list::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.3);
    border-radius: 4px;
}
#auth-projects-list::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.6);
}

.auth-project-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(77, 182, 172, 0.08);
    border: 1px solid rgba(77, 182, 172, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.auth-project-card:hover {
    background: rgba(77, 182, 172, 0.15);
    border-color: rgba(77, 182, 172, 0.4);
}

.auth-project-name {
    font-size: 13px;
    color: #e0eaf4;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-project-arrow {
    color: #4db6ac;
    font-size: 16px;
}

.auth-btn-secondary {
    width: 100%;
    padding: 9px;
    background: transparent;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #6b7280;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    margin-bottom: 4px;
}

.auth-btn-secondary:hover {
    border-color: #4b5563;
    color: #9ca3af;
}

.auth-projects-missing {
    margin: 0;
    font-size: 10px;
    color: #374151;
    text-align: center;
    line-height: 1.6;
}

/* ── Split Panel Onboarding Layout ──────────────────────────────────── */

.onboarding-split-card {
    display: flex;
    position: relative;
    /* Removed fixed 1220px width, background, border, etc. */
    width: 554px; /* Default collapsed width corresponds to right panel */
    height: 610px;
    max-width: 95vw;
    margin: 0 auto;
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.onboarding-split-card.is-open {
    width: 1220px;
}

.onboarding-left {
    width: 666px;
    flex: 0 1 666px;
    margin-right: -666px; /* Hidden beneath right panel */
    transform: translateX(-60px); /* Peek out to the left in closed state */
    clip-path: inset(0 52px 0 -100% round 0 16px 16px 0); /* Matte right side */
    transition: margin-right 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), 
                width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
                transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
                clip-path 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    background: #0d121c;
    border: 1px solid #1f2d3d;
    border-right: none;
    border-radius: 16px 0 0 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    z-index: 1;
    position: relative;
}

.onboarding-split-card.is-open .onboarding-left {
    width: 666px;
    flex: 0 1 666px;
    margin-right: 0;
    transform: translateX(0);
    clip-path: inset(-100px -100% -100px -100% round 0 0 0 0);
}

.quick-tour-tab {
    position: absolute;
    left: -40px;
    top: 40px;
    width: 40px;
    background: #111827;
    border: 1px solid #1f2d3d;
    border-left: none;
    color: #4db6ac;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 2px;
    padding: 16px 0;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, color 0.3s;
    z-index: 0;
    box-shadow: -8px 8px 16px rgba(0, 0, 0, 0.4);
}

.quick-tour-tab:hover {
    background: #1a2432;
    color: #fff;
}


.tour-header {
    font-size: 11px;
    letter-spacing: 2px;
    color: #4db6ac;
    text-transform: uppercase;
    margin-bottom: 24px;
    font-weight: 600;
}

.tour-graphic-placeholder {
    flex: 1;
    background: #1a2432;
    border: 1px solid #2a3a4c;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

.tour-graphic-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(77,182,172,0.05), transparent);
}



.tour-bullets {
    display: flex; flex-direction: column; gap: 24px; margin-top: 35px;
}

.tour-bullets.has-hover .tour-bullet {
    opacity: 0.3; transition: opacity 0.4s ease;
}
.tour-bullets.has-hover .tour-bullet.is-active {
    opacity: 1;
}

@keyframes slide-in-bullet {
    0% { opacity: 0; transform: translateX(-15px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes icon-pulse-hint {
    0% { box-shadow: 0 0 0 0 rgba(255, 214, 0, 0.5); transform: scale(1); }
    50% { box-shadow: 0 0 0 6px rgba(255, 214, 0, 0); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(255, 214, 0, 0); transform: scale(1); }
}

.tour-bullet {
    display: flex; align-items: flex-start; gap: 12px; font-size: 13px; line-height: 1.5; color: #9ca3af;
    transition: opacity 0.4s ease;
    cursor: pointer;
}

/* Animations that trigger when the drawer is opened */
.onboarding-split-card.is-open .tour-bullet {
    animation: slide-in-bullet 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}



.tour-bullet strong { color: #e2e8f0; font-weight: 600; }

.tour-bullet-icon {
    margin-top: 2px; flex-shrink: 0; width: 16px; height: 16px; border-radius: 4px;
    background: #ffd600; color: #0d121c;
    display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: bold;
}

.tour-bullet-icon.help { border-radius: 50%; }

/* Pulse starts together after slide-in. */
.onboarding-split-card.is-open .tour-bullet:not(.bug-trigger) .tour-bullet-icon {
    animation: icon-pulse-hint 2s infinite 0.6s;
}

/* Turn off pulse once user interacts with ANY bullet */
.tour-bullets.has-hover .tour-bullet-icon {
    animation: none !important;
}

.onboarding-right {
    width: 554px;
    flex: 0 1 554px;
    background: #111827;
    border: 1px solid #1f2d3d;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
    padding: 48px 48px 32px 48px; /* Anchored closer to top to match Picker state height */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    z-index: 2;
    transition: border-radius 0.6s;
}

.onboarding-split-card.is-open .onboarding-right {
    width: 554px;
    flex: 0 1 554px;
    border-radius: 0 16px 16px 0;
    border-left: 1px solid #1f2d3d;
}

.auth-welcome-copy {
    font-size: 13px;
    line-height: 1.5;
    color: #9ca3af;
    margin-bottom: 24px;
    text-align: center;
}

/* Opt-out Checkbox Area */
.beta-opt-out {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 12px; opacity: 0.5; transition: opacity 0.2s;
}

.beta-opt-out:hover {
    opacity: 0.9;
}

.beta-opt-out input[type="checkbox"] {
    margin: 2px 0 0 0; accent-color: #4db6ac; cursor: pointer; width: 14px; height: 14px;
}

.beta-opt-out label {
    font-size: 11px; line-height: 1.5; color: #6b7280; cursor: pointer;
}

/* Warning Block */
#opt-out-warning {
    display: none;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: #fca5a5;
    font-size: 11px;
    line-height: 1.5;
    padding: 12px;
    margin-bottom: 0;
    border-radius: 8px;
    text-align: center;
}

.auth-frictionless-note {
    font-size: 11px;
    line-height: 1.5;
    color: #6b7280;
    text-align: center;
    margin-bottom: 0;
    margin-top: 10px;
}

.auth-frictionless-note strong {
    color: #9ca3af;
}

.auth-footer-privacy {
    position: absolute;
    bottom: 50px;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
}

.auth-footer-privacy a {
    color: #374151; /* Match copyright styling exactly */
    text-decoration: none;
    cursor: pointer;
}

.auth-footer-copyright {
    position: absolute;
    bottom: 32px;
    font-size: 11px;
    color: #374151;
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
}