/* ============================================================
   mindAI — auth.css
   Fonts: DM Serif Display · Syne · DM Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Syne:wght@400;500;600;700;800&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* ---- Tokens ---- */
:root {
    --night:         #070b18;
    --deep:          #0d1226;
    --surface:       #141930;
    --card:          rgba(15, 20, 42, 0.72);

    --primary:       #9b87f5;
    --primary-light: #b5a4ff;
    --primary-dark:  #6b5bbf;
    --rose:          #e879a0;
    --aurora:        #67e8c8;

    --text:          #eef0ff;
    --text-2:        #a8adc8;
    --text-3:        #636882;
    --inv:           #0d1226;

    --border:        rgba(160, 140, 255, 0.14);
    --border2:       rgba(160, 140, 255, 0.28);

    --r-sm:   12px;
    --r-md:   20px;
    --r-lg:   32px;
    --r-pill: 999px;

    --expo:   cubic-bezier(0.16, 1, 0.3, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset ---- */
* { max-width: 100%; box-sizing: border-box; }

/* ---- HTML / Body ---- */
html {
    background: radial-gradient(ellipse at 30% 10%, #131a36, var(--night));
    min-height: 100%;
    height: auto;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: transparent;
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    transition: min-height 0.1s;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

/* Grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Particle Canvas ---- */
#particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;   width: 100dvw;
    height: 100vh;  height: 100dvh;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
    background: transparent;
    transform: translateZ(0);
    will-change: transform;
}

@supports not (height: 100dvh) {
    #particle-canvas { height: 100%; width: 100%; }
}

/* ---- Container ---- */
.auth-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 500px;
    padding: 20px;
    margin: auto;
}

/* ---- Card ---- */
.auth-card {
    background: var(--card);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--border2);
    border-radius: 40px;
    padding: 52px 44px;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 1px 0 rgba(255, 255, 255, 0.07) inset,
        0 0 60px rgba(155, 135, 245, 0.1);
    animation: cardAppear 0.55s var(--expo) both;
}

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(32px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ---- Header ---- */
.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Syne', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 22px;
    background: linear-gradient(135deg, #fff 20%, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-dot {
    width: 14px; height: 14px;
    background: linear-gradient(135deg, var(--primary-light), var(--rose));
    border-radius: 50%;
    box-shadow: 0 0 18px var(--primary), 0 0 36px rgba(155, 135, 245, 0.4);
    animation: pulse 2.2s ease-in-out infinite;
    flex-shrink: 0;
    /* dot не должен наследовать gradient text */
    -webkit-text-fill-color: unset;
    background-clip: unset;
    -webkit-background-clip: unset;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1);   box-shadow: 0 0 18px var(--primary), 0 0 36px rgba(155,135,245,0.4); }
    50%       { opacity: 0.6; transform: scale(1.2); box-shadow: 0 0 8px  var(--primary); }
}

.auth-header h1 {
    font-family: 'DM Serif Display', serif;
    font-style: italic;
    font-size: 2.1rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fff 30%, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    font-size: 0.9rem;
    color: var(--text-2);
    font-weight: 300;
}

.auth-header p a {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--primary-light);
    text-decoration: none;
    transition: all 0.2s;
}
.auth-header p a:hover {
    color: #fff;
    text-shadow: 0 0 12px rgba(155, 135, 245, 0.6);
}

/* ---- Form ---- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 22px !important;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-family: 'Syne', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-2);
    margin-left: 4px;
}

/* ---- Inputs ---- */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 20px;
    color: var(--primary);
    font-size: 1rem;
    z-index: 1;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    background: rgba(20, 25, 56, 0.6);
    border: 1px solid var(--border2);
    border-radius: var(--r-pill);
    padding: 15px 24px 15px 52px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text);
    transition: all 0.25s var(--expo);
    -webkit-appearance: none;
    appearance: none;
}

.input-wrapper input::placeholder {
    color: var(--text-3);
    font-weight: 300;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(26, 32, 70, 0.8);
    box-shadow:
        0 0 0 3px rgba(155, 135, 245, 0.18),
        0 0 24px rgba(155, 135, 245, 0.2);
}

/* ---- Password toggle ---- */
.password-wrapper {
    position: relative;
    width: 100%;
}

.toggle-password {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    cursor: pointer;
    font-size: 1rem;
    z-index: 2;
    transition: color 0.2s;
}
.toggle-password:hover { color: var(--primary-light); }

/* ---- Form options ---- */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 2px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: 17px; height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
}

.remember-me span {
    font-size: 0.85rem;
    color: var(--text-2);
    font-weight: 300;
}

.forgot-password {
    font-family: 'Syne', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-light);
    text-decoration: none;
    transition: all 0.2s;
}
.forgot-password:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(155, 135, 245, 0.5);
}

/* ---- Submit button ---- */
.auth-btn {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.04em;
    color: var(--inv);
    padding: 16px;
    border: none;
    border-radius: var(--r-pill);
    cursor: pointer;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 50%, var(--rose) 100%);
    box-shadow: 0 8px 30px rgba(155, 135, 245, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
    transition: all 0.3s var(--expo);
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

.auth-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 44px rgba(155, 135, 245, 0.58), inset 0 1px 0 rgba(255,255,255,0.15);
}

.auth-btn:active {
    transform: translateY(-1px) scale(0.99);
}

/* ---- Divider ---- */
.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 28px 0 18px;
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
}
.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border2), transparent);
}

/* ---- Social buttons ---- */
.social-login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: rgba(20, 25, 56, 0.5);
    border: 1px solid var(--border2);
    border-radius: var(--r-pill);
    padding: 13px;
    font-family: 'Syne', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    transition: all 0.25s var(--expo);
}
.social-btn:hover {
    background: rgba(155, 135, 245, 0.1);
    border-color: rgba(155, 135, 245, 0.4);
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.social-btn i { font-size: 1.2rem; }
.social-btn .fa-google { color: #DB4437; }
.social-btn .fa-vk     { color: #4C75A3; }

/* ---- Back link ---- */
.back-link {
    text-align: center;
    margin-top: 24px;
}

.back-link a {
    font-family: 'Syne', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}
.back-link a:hover { color: var(--primary-light); }
.back-link i { font-size: 0.8rem; }

/* ---- Errors ---- */
.error-message {
    font-size: 0.78rem;
    color: #f87171;
    margin-top: 4px;
    display: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    padding-left: 4px;
}

.input-wrapper.error input {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

/* ---- Message container ---- */
#messageContainer {
    border-radius: var(--r-md);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 400;
}

/* ---- Password strength ---- */
.password-strength {
    margin-top: 8px;
    height: 4px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.35s var(--expo);
    border-radius: var(--r-pill);
}

.strength-text {
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-top: 6px;
    color: var(--text-3);
}

/* ---- Terms / Checkbox ---- */
.terms {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 12px 0 4px;
}

.terms input[type="checkbox"] {
    width: 17px; height: 17px;
    accent-color: var(--primary);
    margin-top: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.terms label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-2);
    line-height: 1.55;
    cursor: pointer;
}

.terms a {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    color: var(--primary-light);
    text-decoration: none;
    transition: all 0.2s;
}
.terms a:hover {
    color: #fff;
    text-decoration: underline;
    text-shadow: 0 0 8px rgba(155, 135, 245, 0.4);
}

/* ============================================================
   FORGOT PASSWORD STEPS
   ============================================================ */
#step1, #step2, #step3 {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#step1 .auth-btn,
#step2 .auth-btn,
#step3 .auth-btn {
    margin: 28px auto 14px;
    display: block;
    width: fit-content;
    min-width: 200px;
    text-align: center;
}

#step2 .back-link {
    margin-top: 14px;
    text-align: center;
}

#step1 .form-group,
#step2 .form-group,
#step3 .form-group {
    width: 100%;
    max-width: 400px;
}

#step3 { padding-bottom: 40px !important; }
#step3 .form-group:last-of-type { margin-bottom: 50px !important; }
#resetPasswordBtn { margin-top: 60px !important; margin-bottom: 30px !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .auth-card {
        padding: 40px 26px;
        border-radius: 32px;
    }
    .form-row { grid-template-columns: 1fr; gap: 18px; }
    .social-login { grid-template-columns: 1fr; }
    .form-options { flex-direction: column; align-items: flex-start; }
    .terms { gap: 10px; }
    .terms label { font-size: 0.82rem; }
}

@media (max-width: 400px) {
    .auth-card { padding: 32px 18px; }
    .auth-header h1 { font-size: 1.7rem; }
    .logo { font-size: 1.8rem; }
}

@media (min-width: 2000px) {
    .auth-container { max-width: 580px; }
    .auth-card { padding: 64px 52px; }
    .auth-header h1 { font-size: 2.4rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
    body { align-items: flex-start; padding: 20px 0; }
    .auth-card { padding: 28px 24px; }
    .auth-header { margin-bottom: 18px; }
    .logo { font-size: 1.7rem; margin-bottom: 10px; }
}

/* ============================================================
   DASHBOARD COMPAT (белая полоса fix)
   ============================================================ */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: var(--night);
}

body { background: transparent !important; }

.dashboard-container {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.main-content {
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
}

.stats-row:last-child { margin-bottom: 0; }

.dashboard-container::after {
    content: '';
    display: table;
    clear: both;
}