/* =========================================================
   Auth Modals — повна таблиця стилів
   ========================================================= */

/* ── Overlay ─────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 16, 0.75);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal-overlay.open    { display: flex; }
.modal-overlay.visible { opacity: 1; }
body.modal-open        { overflow: hidden; }

/* ── Modal shell ─────────────────────────────────────────── */
.auth-modal {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(42, 27, 61, 0.98);
    border: 1px solid rgba(233, 30, 254, 0.15);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.94) translateY(10px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.modal-overlay.visible .auth-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.theme-dark .auth-modal { background: rgba(26, 26, 26, 0.98); }

.auth-modal::-webkit-scrollbar       { width: 6px; }
.auth-modal::-webkit-scrollbar-track { background: transparent; }
.auth-modal::-webkit-scrollbar-thumb { background: rgba(233, 30, 254, 0.3); border-radius: 3px; }

/* ── Close button ────────────────────────────────────────── */
.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 2;
}
.modal-close:hover {
    background: rgba(233, 30, 254, 0.1);
    border-color: var(--accent);
    color: var(--text-primary);
    transform: rotate(90deg);
}
.modal-close svg { width: 18px; height: 18px; }

/* ── Tabs ────────────────────────────────────────────────── */
.auth-tabs {
    position: relative;
    display: flex;
    margin: 60px 24px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 4px;
    transition: opacity 0.2s;
}
.auth-tabs.hidden { display: none; }

.auth-tab {
    position: relative; z-index: 1;
    flex: 1;
    padding: 11px 16px;
    background: transparent; border: none;
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: color 0.3s;
}
.auth-tab.active { color: var(--text-primary); }

.auth-tabs-indicator {
    position: absolute;
    top: 4px; left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #E91EFE 0%, #C01EFE 100%);
    border-radius: 9px;
    box-shadow: 0 4px 15px rgba(233, 30, 254, 0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-tabs[data-active="register"] .auth-tabs-indicator { transform: translateX(100%); }

/* ── Body / forms ────────────────────────────────────────── */
.auth-body { padding: 28px 24px 24px; }

.auth-form {
    display: none;
    flex-direction: column;
    animation: authFormIn 0.25s ease;
}
.auth-form.active { display: flex; }

@keyframes authFormIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-title    { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.auth-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }

/* ── Form fields ─────────────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
.form-label   { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute; left: 14px;
    width: 18px; height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}
.input-wrap input,
.input-wrap select {
    width: 100%;
    padding: 13px 16px 13px 42px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    appearance: none;
}
.input-wrap input::placeholder { color: var(--text-muted); }
.input-wrap input:focus,
.input-wrap select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(233, 30, 254, 0.05);
    box-shadow: 0 0 0 3px rgba(233, 30, 254, 0.1);
}
.form-group.has-error .input-wrap input,
.form-group.has-error .input-wrap select {
    border-color: #FF4D6D;
    background: rgba(255, 77, 109, 0.05);
}

/* ── Password toggle ─────────────────────────────────────── */
.input-toggle-pass {
    position: absolute; right: 12px;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}
.input-toggle-pass:hover { color: var(--text-primary); }
.input-toggle-pass svg   { width: 18px; height: 18px; }

/* ── Errors ──────────────────────────────────────────────── */
.form-error {
    display: none;
    margin-top: 6px;
    font-size: 12px;
    color: #FF4D6D;
    line-height: 1.4;
}
.form-error.visible { display: block; }
.form-error-general.visible {
    display: block;
    margin-top: 4px; margin-bottom: 8px;
    padding: 10px 12px;
    background: rgba(255, 77, 109, 0.08);
    border: 1px solid rgba(255, 77, 109, 0.2);
    border-radius: 8px;
}

/* ── Password strength ───────────────────────────────────── */
.password-strength { margin-top: 10px; }
.strength-bars     { display: flex; gap: 4px; margin-bottom: 6px; }
.strength-bar {
    flex: 1; height: 4px; border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}
.strength-label { font-size: 11px; color: var(--text-muted); }

.password-strength[data-strength="1"] .strength-bar:nth-child(1)    { background: #FF4D6D; }
.password-strength[data-strength="2"] .strength-bar:nth-child(-n+2) { background: #FFA64D; }
.password-strength[data-strength="3"] .strength-bar:nth-child(-n+3) { background: #FFD23F; }
.password-strength[data-strength="4"] .strength-bar:nth-child(-n+4) { background: #2ED573; }

/* ── Row helpers ─────────────────────────────────────────── */
.form-row-between {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 8px;
}
.link-btn {
    background: none; border: none;
    color: var(--accent); font-size: 13px; font-weight: 600;
    cursor: pointer; padding: 0;
    transition: opacity 0.3s;
}
.link-btn:hover          { opacity: 0.8; text-decoration: underline; }
.link-btn:disabled       { opacity: 0.4; cursor: not-allowed; text-decoration: none; }

/* ── Checkbox ────────────────────────────────────────────── */
.checkbox-wrap { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.checkbox-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-box {
    flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px; position: relative; transition: all 0.3s;
}
.checkbox-box::after {
    content: '';
    position: absolute; left: 6px; top: 2px;
    width: 5px; height: 10px;
    border-right: 2px solid white; border-bottom: 2px solid white;
    transform: rotate(45deg) scale(0); transition: transform 0.2s;
}
.checkbox-wrap input:checked + .checkbox-box {
    background: linear-gradient(135deg, #E91EFE 0%, #C01EFE 100%);
    border-color: transparent;
}
.checkbox-wrap input:checked + .checkbox-box::after { transform: rotate(45deg) scale(1); }
.checkbox-text      { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.checkbox-text a    { color: var(--accent); text-decoration: none; }
.checkbox-text a:hover { text-decoration: underline; }
.checkbox-wrap-terms { margin-bottom: 8px; }

/* ── Submit button ───────────────────────────────────────── */
.btn-auth-submit {
    position: relative;
    width: 100%; padding: 14px; margin-top: 4px;
    background: linear-gradient(135deg, #E91EFE 0%, #C01EFE 100%);
    border: none; border-radius: 10px;
    color: var(--text-primary, #fff);
    font-size: 15px; font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(233, 30, 254, 0.3);
    transition: all 0.3s;
}
.btn-auth-submit:hover    { box-shadow: 0 6px 20px rgba(233, 30, 254, 0.4); transform: translateY(-2px); }
.btn-auth-submit:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-spinner {
    display: none;
    position: absolute; top: 50%; left: 50%;
    width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff; border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}
.btn-auth-submit.loading .btn-text    { opacity: 0; }
.btn-auth-submit.loading .btn-spinner { display: block; }

@keyframes authSpin { to { transform: rotate(360deg); } }

/* ── Divider ─────────────────────────────────────────────── */
.auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 22px 0 18px;
    color: var(--text-muted); font-size: 12px;
}
.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.08); }

/* ── Social ──────────────────────────────────────────────── */
.social-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-social {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--text-primary, #fff);
    font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.3s;
}
.btn-social:hover {
    background: rgba(233,30,254,0.08);
    border-color: rgba(233,30,254,0.3);
    transform: translateY(-2px);
}
.btn-social svg { width: 18px; height: 18px; }

/* ═══════════════════════════════════════════════════════════
   OTP SCREEN
═══════════════════════════════════════════════════════════ */
.otp-icon {
    display: flex; justify-content: center;
    margin-bottom: 20px;
}
.otp-icon svg { width: 64px; height: 64px; }

/* 6 input boxes */
.otp-inputs {
    display: flex; gap: 8px; justify-content: center;
    margin-bottom: 20px;
}
.otp-digit {
    width: 48px; height: 56px;
    text-align: center;
    font-size: 24px; font-weight: 800;
    color: var(--text-primary, #fff);
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    transition: all 0.2s;
    caret-color: transparent;
}
.otp-digit:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(233,30,254,0.08);
    box-shadow: 0 0 0 3px rgba(233,30,254,0.15);
    transform: scale(1.05);
}
.otp-digit.filled {
    border-color: rgba(233,30,254,0.4);
    background: rgba(233,30,254,0.06);
}
.otp-digit.error {
    border-color: #FF4D6D;
    animation: otpShake 0.4s ease;
}
@keyframes otpShake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

.otp-error { margin-top: 0; margin-bottom: 16px; }

.otp-resend {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-top: 16px;
    font-size: 13px; color: var(--text-muted);
}
.otp-resend .link-btn { font-size: 13px; }

/* ═══════════════════════════════════════════════════════════
   SUCCESS SCREEN
═══════════════════════════════════════════════════════════ */
.success-anim {
    display: flex; justify-content: center;
    margin-bottom: 24px;
}
.success-anim svg { width: 80px; height: 80px; }

.success-circle {
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
    animation: drawCircle 0.6s ease forwards 0.1s;
}
.success-check {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: drawCheck 0.4s ease forwards 0.65s;
}
@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes drawCheck  { to { stroke-dashoffset: 0; } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-modal { max-width: 100%; border-radius: 16px; }
    .auth-tabs  { margin: 60px 16px 0; }
    .auth-body  { padding: 22px 16px 20px; }
    .social-auth { grid-template-columns: 1fr; }

    .otp-digit  { width: 42px; height: 50px; font-size: 20px; }
    .otp-inputs { gap: 6px; }
}