/* ===== Дизайн-система: Десерт-рум — v3 ===== */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Nunito:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Палитра — от логотипа */
    --bg:          #f2f0ed;
    --bg-card:     #ffffff;
    --bg-warm:     #ebe8e4;
    --ink:         #37333c;
    --ink-mid:     #5c5662;
    --ink-soft:    #8a8390;
    --ink-faint:   #b8b3bc;
    --line:        #e0dcd8;
    --line-strong: #cdc8c3;

    /* Бирюза — акцент из логотипа */
    --teal:        #5bbcbc;
    --teal-deep:   #3f9b9b;
    --teal-light:  #8dd4d4;
    --teal-bg:     #e6f5f5;

    /* Вторичный: тёплый тёмный из лого */
    --charcoal:    #3d3840;

    /* Нейтральный розоватый для негативного */
    --soft-red:    #c97a72;
    --soft-red-bg: #f5e9e8;

    /* Тени */
    --shadow-sm:   0 1px 3px rgba(55, 51, 60, 0.07);
    --shadow-md:   0 6px 20px -4px rgba(55, 51, 60, 0.13);
    --shadow-lg:   0 20px 40px -12px rgba(55, 51, 60, 0.16);

    /* Скругления */
    --r-sm:  6px;
    --r-md:  14px;
    --r-lg:  22px;
    --r-xl:  32px;

    /* Шрифты */
    --font-display: 'DM Serif Display', 'Georgia', serif;
    --font-body:    'Nunito', -apple-system, sans-serif;
}

/* ===== Тёмная тема ===== */
[data-theme="dark"] {
    --bg:          #1e1b22;
    --bg-card:     #2a2730;
    --bg-warm:     #252229;
    --ink:         #f0edf5;
    --ink-mid:     #b8b3c2;
    --ink-soft:    #857f90;
    --ink-faint:   #554f5e;
    --line:        #332f3a;
    --line-strong: #3e3948;

    --teal-bg:     #0e2e2e;
    --soft-red-bg: #2e1a1a;
    --charcoal:    #5bbcbc;

    --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md:   0 6px 20px -4px rgba(0, 0, 0, 0.4);
    --shadow-lg:   0 20px 40px -12px rgba(0, 0, 0, 0.5);
}

/* ===== Сброс ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { min-height: 100%; height: 100%; }

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: inherit; }

/* ===== Layout ===== */
.container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: clamp(28px, 7vw, 56px) 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.footer {
    text-align: center;
    padding: 20px 20px 28px;
    color: var(--ink-faint);
    font-size: 12px;
    letter-spacing: 0.04em;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    margin-bottom: clamp(36px, 7vw, 56px);
    animation: fadeUp 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Логотип */
.logo-mark {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--charcoal);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.eyebrow {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--teal-deep);
    font-weight: 700;
    margin-bottom: 14px;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(40px, 9vw, 58px);
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}

.hero-divider {
    width: 28px;
    height: 2px;
    background: var(--teal);
    margin: 0 auto 18px;
    border-radius: 2px;
}

.hero-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 17px;
    color: var(--ink-mid);
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
}

.hero-location {
    font-family: var(--font-body, 'Nunito', sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-mid);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 14px auto 0;
    opacity: 0.7;
    min-height: 1em;
}
.hero-location:empty { display: none; }

/* ===== Кнопки выбора ===== */
.choice {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeUp 0.7s 0.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.choice-btn:active { transform: translateY(0); }

.choice-btn--positive:hover { border-color: var(--teal-light); }
.choice-btn--negative:hover { border-color: #e0aaaa; }

.choice-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: background 0.25s ease, color 0.25s ease;
}

.choice-btn--positive .choice-icon {
    background: var(--teal-bg);
    color: var(--teal-deep);
}
.choice-btn--positive:hover .choice-icon {
    background: var(--teal);
    color: #fff;
}

.choice-btn--negative .choice-icon {
    background: var(--soft-red-bg);
    color: var(--soft-red);
}
.choice-btn--negative:hover .choice-icon {
    background: var(--soft-red);
    color: #fff;
}

.choice-label {
    display: block;
    font-family: var(--font-display);
    font-size: 23px;
    line-height: 1.1;
    margin-bottom: 3px;
    color: var(--ink);
}

.choice-hint {
    display: block;
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.4;
    font-weight: 400;
}

/* ===== Иконки соцсетей (только иконки) ===== */
.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--teal-bg);
    color: var(--teal-deep);
    display: grid;
    place-items: center;
    text-decoration: none;
    border: 1.5px solid var(--line);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-family: var(--font-body);
}

.icon-btn:hover {
    background: var(--teal);
    color: #fff;
    border-color: var(--teal);
    transform: translateY(-2px);
}

.icon-btn--dark {
    background: rgba(91,188,188,0.12);
    color: #8dd4d4;
    border-color: rgba(91,188,188,0.2);
}

.icon-btn--dark:hover {
    background: var(--teal);
    color: #fff;
    border-color: var(--teal);
}

/* ===== Соцсети ===== */
.social-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    text-decoration: none;
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.social-link:hover {
    border-color: var(--teal-light);
    transform: translateX(3px);
    box-shadow: var(--shadow-md);
}

.social-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--teal-bg);
    color: var(--teal-deep);
    display: grid;
    place-items: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.social-link:hover .social-icon {
    background: var(--teal);
    color: #fff;
}

.social-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.social-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}

.social-handle {
    font-size: 12px;
    color: var(--ink-soft);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Instagram ссылка (старая — не используется) ===== */
.instagram-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: 100px;
    text-decoration: none;
    color: var(--ink-mid);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.instagram-link:hover {
    border-color: var(--teal-light);
    color: var(--teal-deep);
    box-shadow: var(--shadow-md);
}

.instagram-link svg {
    flex-shrink: 0;
    transition: stroke 0.2s ease;
}

.instagram-link:hover svg {
    stroke: var(--teal-deep);
}

/* ===== Форма жалобы ===== */
.complaint-section {
    animation: fadeUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.complaint-header {
    margin-bottom: 28px;
    position: relative;
    padding-top: 4px;
}

.back-btn {
    position: absolute;
    left: 0; top: 0;
    background: transparent;
    border: 1.5px solid var(--line);
    color: var(--ink-soft);
    width: 36px; height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--bg-card);
    color: var(--ink);
    border-color: var(--line-strong);
}

.complaint-header h2 {
    font-family: var(--font-display);
    font-size: clamp(26px, 7vw, 36px);
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 10px;
    text-align: center;
}

.complaint-lead {
    color: var(--ink-soft);
    font-size: 14px;
    text-align: center;
    max-width: 360px;
    margin: 0 auto;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.field label,
.rating-group legend {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.field input,
.field textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    padding: 13px 15px;
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
    line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--ink-faint); }

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(91, 188, 188, 0.14);
}

.field.has-error input,
.field.has-error textarea { border-color: var(--soft-red); }

.field-error {
    font-size: 12px;
    color: var(--soft-red);
    font-weight: 600;
}

/* ===== Звёзды ===== */
.rating-group {
    border: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.stars { display: flex; gap: 4px; }

.star {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 32px;
    line-height: 1;
    color: var(--line-strong);
    padding: 3px;
    transition: transform 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.star:hover { transform: scale(1.18); }

.star.is-active {
    color: var(--teal);
    text-shadow: 0 2px 8px rgba(91, 188, 188, 0.3);
}

/* ===== Кнопка отправки ===== */
.submit-btn {
    margin-top: 4px;
    position: relative;
    background: var(--charcoal);
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    padding: 16px 24px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
    background: #27242b;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.submit-btn:disabled { opacity: 0.65; cursor: not-allowed; }

.submit-btn.is-loading .submit-label { opacity: 0; }
.submit-btn.is-loading .submit-spinner {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

.submit-spinner {
    position: absolute;
    left: 50%; top: 50%;
    width: 18px; height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
}

.form-note {
    text-align: center;
    font-size: 12px;
    color: var(--ink-faint);
    line-height: 1.5;
}

/* ===== Экран успеха ===== */
.success-section {
    text-align: center;
    padding: 60px 20px;
    animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.success-icon {
    width: 72px; height: 72px;
    margin: 0 auto 24px;
    background: var(--teal-bg);
    color: var(--teal-deep);
    border-radius: 50%;
    display: grid;
    place-items: center;
    animation: pop 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.success-icon svg { width: 36px; height: 36px; }

.success-section h2 {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 400;
    margin-bottom: 10px;
}

.success-section p {
    color: var(--ink-soft);
    font-size: 15px;
    max-width: 340px;
    margin: 0 auto;
}

/* ===== Анимации ===== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
    from { opacity: 0; transform: scale(0.65); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Адаптив ===== */
@media (max-width: 380px) {
    .choice-btn { padding: 14px 14px; gap: 12px; }
    .choice-icon { width: 44px; height: 44px; }
    .choice-label { font-size: 20px; }
    .star { font-size: 28px; }
}

/* ===== Соцсети на визитке ===== */
.card-social-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--r-md);
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.card-social-link:hover {
    background: rgba(91,188,188,0.15);
    border-color: rgba(91,188,188,0.35);
}

.card-social-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(91,188,188,0.15);
    color: #8dd4d4;
    display: grid;
    place-items: center;
    transition: background 0.2s ease;
}

.card-social-link:hover .card-social-icon {
    background: rgba(91,188,188,0.3);
}

.card-social-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.card-social-name {
    font-size: 13px;
    font-weight: 700;
    color: #f0edf5;
    line-height: 1.2;
}

.card-social-handle {
    font-size: 11px;
    color: rgba(240,237,245,0.5);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Страница визитки ===== */
.page-card {
    background: var(--charcoal);
    min-height: 100vh;
    padding: 40px 20px;
    display: grid;
    place-items: center;
    color: #f2f0ed;
}

.card-wrap { display: grid; gap: 20px; max-width: 420px; width: 100%; }

.card-controls {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--r-md);
    padding: 14px 16px;
    color: rgba(255,255,255,0.72);
    font-size: 13px;
    line-height: 1.6;
}

.card-controls strong { color: var(--teal-light); font-weight: 600; }

.card-controls input {
    width: 100%;
    margin-top: 8px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}

/* Визитка 85×55 мм */
.business-card {
    aspect-ratio: 85 / 55;
    background: #f2f0ed;
    color: var(--ink);
    border-radius: 10px;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    box-shadow: 0 24px 48px -12px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.business-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--teal);
}

.card-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.card-eyebrow {
    font-size: 9px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--teal-deep);
    font-weight: 700;
}

.card-title {
    font-family: var(--font-display);
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 400;
    line-height: 1.05;
    color: var(--ink);
}

.card-subtitle {
    font-size: 11px;
    color: var(--ink-soft);
    line-height: 1.5;
    margin-top: 2px;
    font-weight: 400;
}

.card-location {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--teal-deep);
    margin: 6px 0 0;
}
.card-location:empty { display: none; }

.card-cta {
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid var(--line);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--teal-deep);
    font-weight: 700;
}

.card-qr {
    background: #fff;
    padding: 7px;
    border-radius: 6px;
    display: grid;
    place-items: center;
}

.card-qr canvas, .card-qr img { display: block; max-width: 100%; height: auto; }

.print-btn {
    background: var(--teal);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: var(--r-md);
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.05em;
    font-size: 13px;
    transition: background 0.2s ease;
}
.print-btn:hover { background: var(--teal-deep); }

/* ===== Соцсети ряд (index) ===== */
.social-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ===== Theme toggle ===== */
.theme-toggle-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 50;
}

.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    color: var(--ink);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    border-color: var(--teal);
    color: var(--teal);
    transform: rotate(15deg);
}

.theme-toggle:active { transform: scale(0.94); }

.theme-toggle svg {
    position: absolute;
    width: 20px;
    height: 20px;
    transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Светлая тема: виден тёмный (шоколадный) капкейк — клик → тёмная */
.theme-toggle .icon-cupcake-light { opacity: 0; transform: rotate(-90deg) scale(0.4); }
.theme-toggle .icon-cupcake-dark  { opacity: 1; transform: rotate(0) scale(1); }

/* Тёмная тема: виден светлый (контурный) капкейк — клик → светлая */
[data-theme="dark"] .theme-toggle .icon-cupcake-light { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-toggle .icon-cupcake-dark  { opacity: 0; transform: rotate(90deg) scale(0.4); }

@media (max-width: 480px) {
    .theme-toggle-bar { top: 12px; right: 12px; }
    .theme-toggle { width: 40px; height: 40px; }
    .theme-toggle svg { width: 18px; height: 18px; }
}

/* ===== Печать ===== */
@media print {
    .page-card {
        background: #fff !important;
        padding: 0;
        min-height: auto;
    }
    .card-controls, .footer, .print-btn, .theme-toggle-bar { display: none !important; }
    .business-card {
        width: 85mm; height: 55mm;
        box-shadow: none !important;
        border: 0.5pt solid #ccc;
        page-break-after: always;
    }
}
