/* ── Auth Modal Overlay ───────────────────────────────────────────────── */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    opacity: 1;
    transition: opacity 0.2s ease;
}
.auth-modal-overlay.closing {
    opacity: 0;
    pointer-events: none;
}

.auth-modal-card {
    position: relative;
    width: 340px;
    background: var(--color-bg-sidebar);
    border: 1px solid var(--color-border-hr);
    border-radius: 16px;
    padding: 32px 28px 28px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.04);
    animation: authCardIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    15%      { transform: translateX(-5px); }
    30%      { transform: translateX(5px); }
    45%      { transform: translateX(-4px); }
    60%      { transform: translateX(4px); }
    80%      { transform: translateX(-2px); }
}

.auth-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-placeholder);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s;
}
.auth-modal-close:hover { color: var(--color-text-primary); }
.auth-modal-close .material-symbols-rounded { font-size: 20px; }

/* ── Form Header ──────────────────────────────────────────────────────── */
.auth-form-header {
    margin-bottom: 24px;
}

.auth-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 5px;
    letter-spacing: -0.02em;
}

.auth-subheading {
    font-size: 0.82rem;
    color: var(--color-text-placeholder);
    margin: 0;
}

/* ── Form ─────────────────────────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field-labelrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-placeholder);
}

.auth-forgot {
    font-size: 0.78rem;
    color: var(--color-text-placeholder);
    text-decoration: none;
    transition: color 0.15s;
}
.auth-forgot:hover { color: var(--green_arrow_color); }

.auth-field input {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-hr);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 0.88rem;
    color: var(--color-text-primary);
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.auth-field input:focus { border-color: var(--green_arrow_color); }
.auth-field input::placeholder { color: var(--color-text-placeholder); opacity: 0.5; }

/* Autofill override — prevent browser yellow/blue */
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--color-text-primary);
    -webkit-box-shadow: 0 0 0 1000px var(--color-bg-secondary) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Password field wrapper */
.auth-password-wrap {
    position: relative;
}
.auth-password-wrap input {
    padding-right: 42px;
}
.auth-pwd-toggle {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-placeholder);
    display: flex;
    align-items: center;
    padding: 0;
    transition: color 0.15s;
}
.auth-pwd-toggle:hover { color: var(--color-text-primary); }
.auth-pwd-toggle .material-symbols-rounded { font-size: 18px; }

/* ── Google Button ────────────────────────────────────────────────────── */
.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-hr);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.auth-google-btn:hover {
    border-color: var(--color-text-placeholder);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
body.dark-theme .auth-google-btn {
    background: #fff;
    border-color: transparent;
    color: #1f1f1f;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
body.dark-theme .auth-google-btn:hover {
    background: #f2f2f2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* ── Divider ──────────────────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-text-placeholder);
    font-size: 0.75rem;
    opacity: 0.6;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border-hr);
}

/* ── Password Strength ────────────────────────────────────────────────── */
.auth-strength-track {
    height: 3px;
    background: var(--color-border-hr);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 6px;
}
.auth-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 99px;
    transition: width 0.3s ease, background 0.3s ease;
}
.auth-strength-label {
    font-size: 0.72rem;
    font-weight: 500;
    margin-top: 3px;
    display: block;
    min-height: 1em;
    transition: color 0.3s;
}

/* ── Terms ────────────────────────────────────────────────────────────── */
.auth-terms {
    text-align: center;
    font-size: 0.74rem;
    color: var(--color-text-placeholder);
    opacity: 0.7;
    margin: 0;
}
.auth-terms-link {
    color: var(--color-text-placeholder);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.auth-terms-link:hover { color: var(--color-text-primary); }

/* ── Spinner ──────────────────────────────────────────────────────────── */
.auth-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(0,0,0,0.18);
    border-top-color: rgba(0,0,0,0.55);
    border-radius: 50%;
    animation: authSpin 0.65s linear infinite;
    margin-right: 7px;
    vertical-align: middle;
    flex-shrink: 0;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* ── Success flash ────────────────────────────────────────────────────── */
.auth-success-flash {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 0 12px;
    text-align: center;
    animation: authCardIn 0.2s ease;
}
.auth-success-flash .material-symbols-rounded {
    font-size: 52px;
    color: var(--green_arrow_color);
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.auth-success-msg {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}
.auth-success-sub {
    font-size: 0.82rem;
    color: var(--color-text-placeholder);
    margin: 0;
}

/* ── Remember me ──────────────────────────────────────────────────────── */
.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--color-text-placeholder);
    cursor: pointer;
    user-select: none;
}
.auth-remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--green_arrow_color);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

/* ── Step dots ────────────────────────────────────────────────────────── */
.auth-step-dots {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-bottom: 4px;
}
.auth-step-dot {
    width: 6px;
    height: 6px;
    border-radius: 99px;
    background: var(--color-border-hr);
    transition: background 0.25s, width 0.25s;
}
.auth-step-dot--active {
    background: var(--green_arrow_color);
    width: 18px;
}

/* ── Social proof ─────────────────────────────────────────────────────── */
.auth-social-proof {
    font-size: 0.75rem;
    color: var(--color-text-placeholder);
    opacity: 0.55;
    margin: 0;
    text-align: center;
}

/* ── Inline field error ───────────────────────────────────────────────── */
.auth-field-error {
    font-size: 0.74rem;
    color: var(--color-negative);
    margin-top: 2px;
    min-height: 1em;
    display: block;
}
.auth-field-ok {
    font-size: 0.74rem;
    color: var(--green_arrow_color);
    margin-top: 2px;
    display: block;
}

/* ── Reset sent ───────────────────────────────────────────────────────── */
.auth-reset-sent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 0 8px;
    text-align: center;
    color: var(--color-text-placeholder);
    font-size: 0.85rem;
}
.auth-reset-sent .material-symbols-rounded {
    font-size: 40px;
    color: var(--green_arrow_color);
}
.auth-reset-sent p { margin: 0; line-height: 1.5; }

/* ── Submit Button ────────────────────────────────────────────────────── */
.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--green_arrow_color);
    color: var(--color-bg-sidebar);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    margin-top: 2px;
}
.auth-submit-btn:hover { opacity: 0.88; }

/* ── Error ────────────────────────────────────────────────────────────── */
.auth-error {
    padding: 10px 14px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    color: var(--color-negative);
    font-size: 0.82rem;
    animation: authShake 0.4s ease;
}

/* ── Step-based signup ────────────────────────────────────────────────── */
.auth-step { display: flex; flex-direction: column; gap: 16px; }

.auth-email-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-hr);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--color-text-primary);
}
.auth-email-pill span.material-symbols-rounded {
    font-size: 16px;
    color: var(--green_arrow_color);
}
.auth-email-pill-addr {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auth-email-change {
    font-size: 0.75rem;
    color: var(--green_arrow_color);
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.auth-email-change:hover { opacity: 0.75; }

/* ── Switch link ──────────────────────────────────────────────────────── */
.auth-switch {
    text-align: center;
    font-size: 0.82rem;
    color: var(--color-text-placeholder);
    margin: 0;
}
.auth-switch-link {
    color: var(--green_arrow_color);
    cursor: pointer;
    text-decoration: none;
}
.auth-switch-link:hover { text-decoration: underline; }

/* ── Sidebar auth buttons ─────────────────────────────────────────────── */
.auth-sidebar-section { margin-bottom: 8px; }

.auth-btns-row {
    display: flex;
    gap: 6px;
}

.auth-signin-btn {
    flex: 1;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s;
    background: var(--green_arrow_color);
    border: none;
    color: var(--color-bg-sidebar);
}
.auth-signin-btn .material-symbols-rounded { font-size: 17px; flex-shrink: 0; }
.auth-signin-btn:hover { opacity: 0.88; }

/* Collapsed: icon only */
.sidebar.collapsed .auth-signin-btn {
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    outline: none;
    box-shadow: none;
}
.sidebar.collapsed .auth-signin-btn:hover { opacity: 0.88; }
.sidebar.collapsed .auth-btn-label { display: none; }

/* ── Sidebar user section (logged in) ────────────────────────────────── */
.auth-user-section { position: relative; margin-bottom: 8px; }

.auth-user-btn {
    display: flex;
    width: 100%;
    height: 36px;
    align-items: center;
    padding: 0 8px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--color-text-primary);
    cursor: pointer;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    transition: background 0.15s;
}
.auth-user-btn:hover { background: var(--color-bg-secondary); }

.auth-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--green_arrow_color);
    color: var(--color-bg-sidebar);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.auth-username {
    font-size: 0.82rem;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-user-chevron {
    font-size: 16px;
    color: var(--color-text-placeholder);
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.auth-user-btn[aria-expanded="true"] .auth-user-chevron { transform: rotate(180deg); }

.sidebar.collapsed .auth-user-btn {
    padding: 0;
    justify-content: center;
    width: 36px;
    margin: 0 auto;
    background: none !important;
    outline: none;
    box-shadow: none;
}
.sidebar.collapsed .auth-username,
.sidebar.collapsed .auth-user-chevron { display: none; }

/* ── User dropdown menu ───────────────────────────────────────────────── */
.auth-user-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-bg-sidebar);
    border: 1px solid var(--color-border-hr);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 100;
}
.auth-user-menu.active { display: block; }

.auth-user-menu-email {
    padding: 6px 10px 8px;
    font-size: 0.75rem;
    color: var(--color-text-placeholder);
    border-bottom: 1px solid var(--color-border-hr);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-signout-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background 0.15s;
}
.auth-signout-item:hover { background: var(--color-bg-secondary); }
.auth-signout-item .material-symbols-rounded { font-size: 16px; }

.sidebar.collapsed .auth-user-menu {
    left: 100%;
    bottom: 0;
    right: auto;
    width: 160px;
    margin-left: 8px;
}
