/* ═══════════════════════════════════════
   MORPHEUS MINI APP — Общие стили
   Переменные, сброс, анимации, шапка, 
   табы, тосты, кнопки, карточки, модалка
   ═══════════════════════════════════════ */

/* ─── Переменные ─── */
:root {
    --bg: #0a080f;
    --bg-card: rgba(40, 30, 52, 0.35);
    --bg-card-hover: rgba(40, 30, 52, 0.5);
    --bg-input: rgba(40, 30, 52, 0.5);
    --accent: #e8820e;
    --accent-dark: #cc6e08;
    --accent-glow: rgba(232, 130, 14, 0.35);
    --accent-subtle: rgba(232, 130, 14, 0.08);
    --accent-border: rgba(232, 130, 14, 0.12);
    --accent-border-hover: rgba(232, 130, 14, 0.25);
    --text-primary: #f0e6d3;
    --text-secondary: #c8baa8;
    --text-muted: #7a6e60;
    --text-dim: #5a5248;
    --text-dark: #3a3530;
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
}

/* ─── Сброс ─── */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    max-width: 400px;
    margin: 0 auto;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 2px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(232,130,14,0.15); border-radius: 2px; }
textarea::placeholder, input::placeholder { color: #4a4540; }

/* ─── Анимации ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 0.25; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.15); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.97); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    to { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.97); }
}

.anim-fade { animation: fadeIn 0.4s ease-out; }
.anim-slide { animation: slideUp 0.35s ease-out; }
.anim-slide-right { animation: slideInRight 0.3s ease-out; }

/* ─── Фоновое свечение ─── */
.ambient-glow {
    position: fixed;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,130,14,0.03) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Шапка ─── */
.app-header {
    padding: 14px 18px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(232,130,14,0.05);
    background: rgba(10,8,15,0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: opacity 0.3s;
}
.app-header.hidden { display: none; }
.header-left {
    display: flex;
    align-items: center;
    gap: 9px;
}
.header-moon {
    font-size: 20px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}
.header-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}
.header-balance {
    background: var(--accent-subtle);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

/* ─── Контент ─── */
.app-content {
    padding-bottom: 84px;
    min-height: calc(100vh - 130px);
    position: relative;
    z-index: 1;
}
.tab-content {
    padding: 20px 18px 0;
}

/* ─── Таб-бар ─── */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    background: rgba(10,8,15,0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(232,130,14,0.06);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 14px;
    z-index: 50;
}
.tab-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px 18px;
    transition: all 0.2s;
    position: relative;
}
.tab-indicator {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.2s;
}
.tab-btn.active .tab-indicator { opacity: 1; }
.tab-icon {
    font-size: 19px;
    transition: filter 0.2s;
}
.tab-btn.active .tab-icon {
    filter: drop-shadow(0 0 5px rgba(232,130,14,0.5));
}
.tab-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: var(--text-dark);
    transition: color 0.2s;
}
.tab-btn.active .tab-label { color: var(--accent); }

/* ─── Тост (центрирован!) ─── */
.toast {
    position: fixed;
    bottom: 86px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(24,18,34,0.96);
    color: var(--text-primary);
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    z-index: 200;
    border: 1px solid rgba(232,130,14,0.18);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
}
.toast.show { animation: toastIn 0.25s ease-out forwards; }
.toast.hide { animation: toastOut 0.25s ease-out forwards; }

/* ─── Кнопки ─── */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 24px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(232,130,14,0.2);
    font-family: var(--font-body);
    width: 100%;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }

.btn-secondary {
    background: var(--accent-subtle);
    border: 1px solid rgba(232,130,14,0.18);
    border-radius: var(--radius-md);
    padding: 13px 24px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-body);
    width: 100%;
}

.btn-ghost {
    background: transparent;
    border: none;
    padding: 10px 24px;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-body);
}

/* ─── Кнопка "назад" (увеличена) ─── */
.btn-back {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    padding: 6px 0;
    margin-bottom: 18px;
    font-family: var(--font-body);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-back svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent);
    stroke-width: 2.5;
    fill: none;
}

/* ─── Карточки ─── */
.card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid rgba(232,130,14,0.08);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    font-family: var(--font-body);
}
.card:active { transform: scale(0.99); }
.card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex-shrink: 0;
    background: rgba(232,130,14,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.card-body { flex: 1; min-width: 0; }
.card-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
}
.card-desc {
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 3px;
}
.card-arrow {
    color: var(--text-dark);
    font-size: 18px;
    flex-shrink: 0;
}

/* ─── Заголовки секций ─── */
.section-title {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--text-primary);
    font-weight: 600;
    margin: 0 0 6px;
}
.section-subtitle {
    color: var(--text-dim);
    font-size: 13px;
    margin: 0 0 20px;
}

/* ─── Модалка (оплата) ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-sheet {
    background: linear-gradient(180deg, #1e1728 0%, #140f1e 100%);
    border-radius: 22px 22px 0 0;
    width: 100%;
    max-width: 400px;
    padding: 20px 20px 32px;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle {
    width: 36px;
    height: 4px;
    background: #2a2535;
    border-radius: 2px;
    margin: 0 auto 20px;
}
