/* ═══════════════════════════════════════════
   Тренажер Таухид — Стили Mini App
   Цвета: Глубокий изумруд + золото + белый
   ═══════════════════════════════════════════ */

:root {
    --primary: #115E59;
    --primary-light: #0D9488;
    --primary-dark: #0A3D3A;
    --gold: #D4AF37;
    --gold-light: #F0D978;
    --bg: #FAFAF7;
    --bg-card: #FFFFFF;
    --text: #1A1A2E;
    --text-secondary: #64748B;
    --text-light: #94A3B8;
    --border: #E2E8F0;
    --success: #047857;
    --danger: #DC2626;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Загрузка ─── */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
}
.loading-icon { font-size: 64px; animation: pulse 2s ease infinite; }
.loading-text { font-family: 'Amiri', serif; font-size: 24px; color: var(--primary); }
.loading-sub { font-size: 14px; color: var(--text-secondary); }

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

/* ─── Хедер ─── */
.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 20px 24px 24px;
    border-radius: 0 0 24px 24px;
    position: relative;
}
.header-back {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: inline-block;
}
.header-back:active { background: rgba(255,255,255,0.15); }
.header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}
.header p {
    font-size: 14px;
    opacity: 0.85;
    font-weight: 300;
}
.header-bismillah {
    font-family: 'Amiri', serif;
    font-size: 20px;
    text-align: center;
    margin-bottom: 12px;
    opacity: 0.9;
}
.header-step-indicator {
    display: flex;
    gap: 6px;
    margin-top: 16px;
}
.step-dot {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.25);
    transition: background 0.3s;
}
.step-dot.active { background: var(--gold); }
.step-dot.done { background: rgba(255,255,255,0.7); }

/* ─── Главное меню ─── */
.welcome-screen {
    padding: 24px;
    flex: 1;
}
.welcome-bismillah {
    font-family: 'Amiri', serif;
    font-size: 28px;
    text-align: center;
    color: var(--primary);
    margin: 24px 0 8px;
}
.welcome-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}
.welcome-ayah {
    font-family: 'Amiri', serif;
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.7;
    font-style: italic;
}
.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ─── Карточки модулей ─── */
.module-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--border);
}
.module-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-lg);
}
.module-icon {
    font-size: 32px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
    flex-shrink: 0;
}
.module-info { flex: 1; }
.module-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}
.module-names {
    font-size: 12px;
    color: var(--primary-light);
    font-weight: 500;
}
.sphere-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(17, 94, 89, 0.08);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}
.module-arrow {
    color: var(--text-light);
    font-size: 18px;
}

/* ─── Содержимое шага ─── */
.step-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.step-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}
.step-instruction {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ─── Аудио-плеер ─── */
.audio-player {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.audio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}
.audio-btn-play {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.1s;
}
.audio-btn-play:active { transform: scale(0.92); }
.audio-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.audio-progress-bar {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
    cursor: pointer;
}
.audio-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}
.audio-time {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
}
.audio-speed {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ─── Поле ввода ─── */
.input-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.input-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.input-field {
    width: 100%;
    min-height: 80px;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    resize: vertical;
    background: transparent;
    line-height: 1.5;
}
.input-field::placeholder {
    color: var(--text-light);
}
.input-underline {
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 1px;
    margin-top: 4px;
}

/* ─── Кнопки ─── */
.btn {
    width: 100%;
    padding: 16px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, opacity 0.2s;
    text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 16px rgba(17, 94, 89, 0.3);
}
.btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
    font-size: 14px;
    letter-spacing: 0.5px;
}
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-bottom: 16px;
}

/* ─── Блок трансформации (Имена Аллаха) ─── */
.names-carousel {
    margin-bottom: 20px;
}
.name-card {
    background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 14px;
    border: 1px solid #D1FAE5;
    text-align: center;
}
.name-arabic {
    font-family: 'Amiri', serif;
    font-size: 42px;
    color: var(--primary-dark);
    margin-bottom: 8px;
    direction: rtl;
}
.name-transliteration {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.name-meaning {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.name-reflection {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    font-style: italic;
    border-left: 3px solid var(--primary-light);
    padding-left: 14px;
    text-align: left;
}

/* ─── Блок Дуа ─── */
.dua-block {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    color: white;
}
.dua-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-bottom: 10px;
}
.dua-text {
    font-size: 15px;
    line-height: 1.8;
    font-weight: 300;
}

/* ─── Аят ─── */
.ayah-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
}
.ayah-arabic {
    font-family: 'Amiri', serif;
    font-size: 26px;
    color: var(--primary-dark);
    line-height: 2;
    margin-bottom: 16px;
    direction: rtl;
}
.ayah-divider {
    width: 60px;
    height: 2px;
    background: var(--gold);
    margin: 0 auto 16px;
}
.ayah-translation {
    font-size: 15px;
    color: var(--text);
    line-height: 1.7;
    font-style: italic;
    margin-bottom: 12px;
}
.ayah-reference {
    font-size: 13px;
    color: var(--primary-light);
    font-weight: 600;
}

/* ─── Шкала оценки ─── */
.rating-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
}
.rating-value {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.rating-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--danger) 0%, var(--gold) 50%, var(--success) 100%);
    outline: none;
    margin: 12px 0;
}
.rating-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
}
.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ─── Направления (сферы) ─── */
.spheres-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.sphere-btn {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--bg-card);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.sphere-btn.selected {
    border-color: var(--primary) !important;
    background: #ECFDF5 !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(17, 94, 89, 0.15) !important;
}

/* ─── Результат / Поздравление ─── */
.completion-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #F0FDF4;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 20px;
    border: 1px solid #D1FAE5;
}
.completion-icon { font-size: 24px; }
.completion-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--success);
}

/* ─── Анимации ─── */
.fade-in {
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.slide-in {
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─── Индивидуальный запрос (ИИ Карточка) ─── */
.custom-card {
    background: linear-gradient(135deg, #0A3D3A, #115E59);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 6px 20px rgba(17, 94, 89, 0.25);
    border: 1px solid rgba(212, 175, 55, 0.3);
    cursor: pointer;
    transition: transform 0.15s;
}
.custom-card:active {
    transform: scale(0.98);
}
.custom-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    color: #0A3D3A;
    margin-bottom: 10px;
}
.custom-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    color: white;
}
.custom-desc {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.9;
    font-weight: 300;
}

/* ─── Облако тегов-примеров ─── */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 16px;
}
.tag-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}
.tag-chip:active {
    background: #F0FDF4;
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(0.96);
}

/* ─── Таухид-расстановка ролей ─── */
.roles-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.role-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.2s;
}
.role-card:first-child {
    background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
    border-color: #A7F3D0;
}
.role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(17, 94, 89, 0.1);
    color: var(--primary);
    margin-bottom: 8px;
}
.role-card:first-child .role-badge {
    background: rgba(212, 175, 55, 0.2);
    color: #92400E;
}
.role-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.role-sub {
    font-size: 12px;
    color: var(--primary-light);
    font-weight: 600;
    margin-bottom: 8px;
}
.role-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.role-arrow-indicator {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

/* ─── Безопасные зоны для iOS ─── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .btn-group { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
