/* =========================================================================
   myfriend.today — Main Styles
   Тёмная тема, gaming-vibe, mobile-first.
   ========================================================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg:           #0E0F1A;
    --bg-elev:      #161826;
    --surface:      #1A1B2E;
    --surface-2:    #232542;
    --border:       #2A2D4A;

    --text:         #F4F4F8;
    --text-muted:   #8A8FA3;
    --text-dim:     #5C617A;

    --primary:      #8E5CFF;
    --primary-hover:#A47CFF;
    --primary-dark: #6E3AE2;
    --secondary:    #5FE2C9;
    --danger:       #FF5C5C;
    --success:      #5FE2A8;
    --warning:      #FFC555;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm:  0 2px 8px rgba(0, 0, 0, .3);
    --shadow-md:  0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg:  0 16px 48px rgba(0, 0, 0, .4);

    --shadow-glow: 0 0 40px rgba(142, 92, 255, .35);
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color .15s ease-out;
}
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 {
    margin: 0 0 .6em;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

::selection { background: var(--primary); color: #fff; }

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-narrow {
    max-width: 720px;
}

main { min-height: calc(100vh - 200px); }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(14, 15, 26, .85);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text);
    letter-spacing: -.02em;
}
.logo:hover { color: var(--text); }
.logo__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--secondary);
    box-shadow: 0 0 12px var(--secondary);
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav__link {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .95rem;
    transition: background .15s, color .15s;
}
.nav__link:hover { color: var(--text); background: var(--surface); }

.nav__cta {
    margin-left: 8px;
}

@media (max-width: 768px) {
    .nav { display: none; }
    .nav.is-open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-elev); border-bottom: 1px solid var(--border); padding: 12px 20px; gap: 4px; }
    .nav.is-open .nav__link { padding: 12px 14px; }
    .nav__toggle { display: inline-flex !important; }
}

.nav__toggle {
    display: none;
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .12s ease-out, background .15s, border-color .15s, color .15s;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn--primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 20px rgba(142, 92, 255, .35);
}
.btn--primary:hover { background: var(--primary-hover); color: #fff; }

.btn--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface); color: var(--text); }

.btn--secondary {
    background: var(--surface-2);
    color: var(--text);
}
.btn--secondary:hover { background: var(--surface); color: var(--text); }

.btn--block { width: 100%; }
.btn--lg { padding: 16px 28px; font-size: 1.05rem; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color .15s, background .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-elev);
    box-shadow: 0 0 0 4px rgba(142, 92, 255, .15);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-checkbox { margin-right: 8px; accent-color: var(--primary); }
.form-help { font-size: .85rem; color: var(--text-dim); margin-top: 6px; }
.form-error { font-size: .85rem; color: var(--danger); margin-top: 6px; }

.form-radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}
.form-radio {
    cursor: pointer;
    padding: 14px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    transition: border-color .15s, background .15s;
}
.form-radio input { display: none; }
.form-radio:hover { border-color: var(--text-muted); }
.form-radio:has(input:checked) {
    border-color: var(--primary);
    background: rgba(142, 92, 255, .08);
}
.form-radio__title { font-weight: 600; display: block; margin-bottom: 4px; }
.form-radio__desc  { font-size: .85rem; color: var(--text-muted); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.card--elevated { box-shadow: var(--shadow-md); }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: 80px 0 60px;
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    top: -200px; left: 50%;
    transform: translateX(-50%);
    width: 900px; height: 900px;
    background: radial-gradient(closest-side, rgba(142, 92, 255, .25), transparent 70%);
    z-index: 0;
    pointer-events: none;
}
.hero__inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
}
.hero__pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.hero__pill .dot {
    display: inline-block;
    width: 8px; height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 10px var(--secondary);
}
.hero__title {
    font-size: clamp(2.25rem, 6vw, 4rem);
    font-weight: 800;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #F4F4F8 0%, #C7BFFF 50%, #5FE2C9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.hero__subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-muted);
    margin-bottom: 32px;
}
.hero__cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Section ---------- */
.section {
    padding: 80px 0;
}
.section__head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 48px;
}
.section__eyebrow {
    color: var(--secondary);
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 8px;
}
.section__title { margin: 0 0 12px; }
.section__lead  { color: var(--text-muted); font-size: 1.05rem; }

/* ---------- Categories grid ---------- */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: transform .2s ease-out, border-color .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}
.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}
.category-card__icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 24px;
}
.category-card__title { font-size: 1.35rem; margin-bottom: 8px; }
.category-card__desc  { color: var(--text-muted); font-size: .95rem; margin: 0; }

/* ---------- Steps ---------- */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    counter-reset: step;
}
.step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
}
.step::before {
    counter-increment: step;
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 14px;
    box-shadow: 0 0 0 4px rgba(142, 92, 255, .2);
}
.step__title { font-size: 1.1rem; margin-bottom: 6px; }
.step__desc  { color: var(--text-muted); font-size: .92rem; margin: 0; }

/* ---------- FAQ ---------- */
.faq { max-width: 780px; margin: 0 auto; }
.faq__item {
    border-bottom: 1px solid var(--border);
}
.faq__question {
    width: 100%;
    background: transparent;
    border: 0;
    padding: 20px 0;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-family: inherit;
}
.faq__question::after {
    content: "+";
    font-size: 1.5rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform .2s, color .2s;
}
.faq__item.is-open .faq__question::after { content: "−"; color: var(--primary); }
.faq__answer {
    display: none;
    padding: 0 0 20px;
    color: var(--text-muted);
}
.faq__item.is-open .faq__answer { display: block; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 40px 0 30px;
    margin-top: 60px;
    background: var(--bg-elev);
}
.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.site-footer__col h4 {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}
.site-footer__col a {
    display: block;
    color: var(--text);
    margin-bottom: 8px;
    font-size: .95rem;
}
.site-footer__col a:hover { color: var(--primary); }
.site-footer__legal {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    color: var(--text-dim);
    font-size: .85rem;
    text-align: center;
}

/* ---------- Flash messages ---------- */
.flash-list {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}
.flash {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow-md);
    animation: flash-slide .25s ease-out;
}
.flash--success { border-color: var(--success); }
.flash--error   { border-color: var(--danger); }
.flash--info    { border-color: var(--primary); }

@keyframes flash-slide {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@media (max-width: 480px) {
    .flash-list { left: 10px; right: 10px; top: 70px; max-width: none; }
}

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 8px;
}
.auth-card__lead {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.auth-card__alt {
    text-align: center;
    margin-top: 18px;
    color: var(--text-muted);
    font-size: .95rem;
}

/* ---------- Dashboard ---------- */
.dashboard-hero {
    padding: 40px 0 20px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-muted);
    margin-left: 10px;
}
.role-badge--friend { background: rgba(95, 226, 201, .15); color: var(--secondary); }
.role-badge--client { background: rgba(142, 92, 255, .15); color: var(--primary); }
.role-badge--admin  { background: rgba(255, 92, 92, .15); color: var(--danger); }

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 32px; }
