/* calc/assets/css/calculators/mandarin.css */

/* --- ТЕМА (Orange) --- */
:root {
    --accent-orange: #EA580C;       /* Основной оранжевый */
    --accent-orange-light: #FFEDD5; /* Светлый фон */
    --gradient-orange-card: linear-gradient(135deg, #F97316 0%, #C2410C 100%);
    --text-primary: #111827;
    --text-secondary: #6B7280;
}

.calc-header { margin-bottom: 32px; }
.subtitle { color: var(--text-secondary); margin-top: 8px; }

/* --- СЕТКА --- */
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1.2fr 0.8fr; } }

/* --- INPUTS --- */
.calc-inputs { gap: 24px; }

/* ПЕРЕКЛЮЧАТЕЛЬ РЕЖИМОВ */
.mode-switch {
    display: flex;
    margin-bottom: 24px;
    background-color: #F9FAFB;
    border-radius: 12px;
    padding: 4px;
    border: 1px solid #E5E7EB;
}

.mode-btn {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 15px;
    white-space: nowrap; 
}

.mode-btn:hover { color: var(--text-primary); }

.mode-btn.active {
    background-color: var(--accent-orange);
    color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.input-group { margin-bottom: 24px; }
.input-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.input-wrapper { position: relative; display: flex; align-items: center; }

.input-wrapper input {
    width: 100%; padding: 16px; padding-right: 40px;
    font-size: 18px; font-weight: 500;
    border: 1px solid #E5E7EB; border-radius: 12px;
    outline: none; transition: border 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.input-wrapper input:focus { border-color: var(--accent-orange); box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1); }
.suffix { position: absolute; right: 16px; color: var(--text-secondary); pointer-events: none; }
.helper-text { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

/* --- РЕЗУЛЬТАТЫ (Карточка) --- */
.card--orange { background: var(--gradient-orange-card); color: #fff; border: none; }
.card--orange h2 { color: rgba(255,255,255,0.9); font-size: 16px; margin-bottom: 10px; }

.result-score { 
    font-size: 64px; 
    font-weight: 800; 
    line-height: 1; 
    margin-top: 16px; 
    word-break: break-all; /* Чтобы длинные числа переносились */
}

.result-status {
    font-size: 20px; font-weight: 600; margin-bottom: 24px; opacity: 0.95;
    background: rgba(255,255,255,0.2); display: inline-block; padding: 4px 12px;
    border-radius: 8px; margin-top: 8px;
}

/* Статистика внутри карточки */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-col {
    flex: 1; 
    background: rgba(0,0,0,0.15); 
    border-radius: 12px; padding: 12px 16px;
    text-align: left;
    backdrop-filter: blur(4px);
    min-width: 0;
}
.stat-val { display: block; font-size: 24px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.stat-lbl { display: block; font-size: 13px; opacity: 0.8; margin-top: 4px; font-weight: 500; }

.summary-divider { height: 1px; background: rgba(255,255,255,0.2); margin: 20px 0; }
.recommendation { font-size: 14px; line-height: 1.5; background: rgba(0,0,0,0.1); padding: 16px; border-radius: 12px; }

/* --- VISUAL BOX (ЯЩИКИ С МАНДАРИНАМИ) --- */
.mandarin-visual-box {
    margin-top: 24px;
    background: #FFF7ED; /* Orange-50 */
    border: 2px dashed #FDBA74; /* Orange-300 */
    border-radius: 20px;
    height: 320px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    align-items: center;      
    padding: 20px;
}

.visual-label {
    position: absolute; top: 12px; left: 0; width: 100%; text-align: center;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--accent-orange); letter-spacing: 1px;
    z-index: 10;
    background: rgba(255, 247, 237, 0.8);
    padding: 4px 0;
    backdrop-filter: blur(2px);
}

.visual-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 5px;
}

/* КУЧА ЯЩИКОВ */
.crates-pile {
    display: flex;
    flex-wrap: wrap-reverse; /* Складываем снизу вверх */
    align-items: flex-end;
    justify-content: center; /* Центрируем */
    align-content: flex-end;
    gap: 4px;
    
    /* Ширина будет ограничиваться JS для создания пирамидки */
    width: fit-content;
    margin: 0 auto;
}

/* Куча рассыпных */
.loose-mandarins-pile {
    display: flex;
    flex-wrap: wrap-reverse;
    align-items: flex-end;
    justify-content: center;
    gap: 2px; /* Валидный gap */
    width: fit-content;
    margin: 0 auto;
    padding-bottom: 2px;
}

/* --- СТИЛИЗАЦИЯ ЯЩИКА --- */
.mandarin-crate {
    width: 44px;
    height: 32px;
    background-color: #D97706; /* Цвет ящика */
    border: 2px solid #B45309;
    position: relative;
    border-radius: 3px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    background-image: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px);
    
    opacity: 0;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    flex-shrink: 0;
}

.mandarin-crate::after {
    content: '';
    position: absolute;
    top: -6px; left: 2px; right: 2px; height: 8px;
    background-color: #FB923C;
    border-radius: 4px 4px 0 0;
    background-image: radial-gradient(circle, #FDBA74 25%, transparent 25%);
    background-size: 6px 6px;
    background-position: 0 0;
}

/* --- СТИЛИЗАЦИЯ РАССЫПНЫХ --- */
.mandarin-emoji-loose {
    font-size: 22px;
    line-height: 1;
    user-select: none;
    display: inline-block;
    transform: rotate(var(--r, 0deg));
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
    /* Отрицательный маржин для перекрытия (кучности) */
    margin: -2px; 
    
    opacity: 0;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0) rotate(var(--r, 0deg)); }
}

/* --- SHARE BUTTONS --- */
.share-box { margin-top: 24px; }
.share-box h3 {
    font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.9);
    margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.05em; text-align: center;
}
.share-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn-share {
    width: 48px; height: 48px; flex: 0 0 48px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px; background: rgba(255,255,255,0.2);
    color: #fff; text-decoration: none; transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.15); cursor: pointer;
    padding: 0; margin: 0; outline: none;
}
.btn-share:hover { background: #fff; transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); border-color: #fff; }
.btn-share svg, .btn-share i { width: 24px; height: 24px; font-size: 24px; display: block; flex-shrink: 0; }

.btn-share.tg:hover { color: #229ED9; }
.btn-share.wa:hover { color: #25D366; }
.btn-share.vk:hover { color: #0077FF; }
.btn-share.ok:hover { color: #F4731C; }
.btn-share.vb:hover { color: #7360f2; }
.btn-share.cp:hover { color: var(--text-primary); }

/* --- ИНФОРМАЦИОННЫЕ БЛОКИ --- */
.info-wrapper { padding: 60px 0 60px 0; margin-top: 60px; border-top: 1px solid rgba(0,0,0,0.06); margin-bottom: 20px; }
.info-wrapper .container { max-width: 800px; margin: 0 auto; }

.icon-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; font-size: 24px; font-weight: 800; color: var(--text-primary); line-height: 1.3; }
.header-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.04); flex-shrink: 0; margin-top: -4px; }
.header-icon svg { width: 24px; height: 24px; stroke-width: 2px; }

.orange-icon svg { color: #EA580C; }
.red-icon svg { color: #EF4444; }

.intro-text { font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.6; }

/* Формулы */
.formulas-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 48px; }
.formula-card { background: #fff; border: 1px solid rgba(0,0,0,0.04); box-shadow: 0 4px 20px rgba(0,0,0,0.03); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; transition: all 0.3s; }
.formula-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.08); }
.formula-header { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.formula-card h3 { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary); }
.badge-blue { background: #2563EB; color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.formula-card p { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.5; font-weight: 500; }
.math-expression { background: #FFF7ED; border: 1px solid #FFEDD5; padding: 12px 16px; border-radius: 12px; font-weight: 700; color: var(--accent-orange); text-align: center; margin-bottom: 16px; font-size: 15px; }

.soft-divider { border: none; height: 1px; background: linear-gradient(90deg, transparent, #E5E7EB, transparent); margin: 48px 0; }

/* FAQ */
.faq-section .faq-item { background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.faq-section .faq-item[open] { border-color: var(--accent-orange); box-shadow: 0 4px 20px rgba(234, 88, 12, 0.15); }
summary.faq-question { padding: 16px 20px; cursor: pointer; font-weight: 600; color: var(--text-primary); display: flex; justify-content: space-between; align-items: center; }
summary.faq-question:hover { background-color: #F9FAFB; }
.faq-section .faq-item[open] summary.faq-question { color: var(--accent-orange); background: #FFF7ED; }
.faq-question::after { content: '+'; font-size: 20px; color: var(--text-secondary); }
.faq-section .faq-item[open] summary.faq-question::after { content: '−'; color: var(--accent-orange); }
.faq-answer { padding: 20px; color: var(--text-secondary); line-height: 1.6; font-size: 15px; }

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ (МЕНЕЕ 600px) --- */
@media (max-width: 600px) {
    /* Центровка формулы */
    .formula-header { align-items: center; text-align: center; }
    .formula-card { align-items: center; text-align: center; }
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ (МЕНЕЕ 480px) --- */
@media (max-width: 480px) {
    /* Кнопки переключения - уменьшаем шрифт чтобы влезли */
    .mode-btn { font-size: 13px; padding: 10px; }

    /* Результат */
    .result-score { font-size: 42px; }
    
    .card { padding: 16px; } 

    /* Ящики и мандарины меньше */
    .mandarin-crate { width: 34px; height: 26px; }
    .mandarin-emoji-loose { font-size: 18px; }
    
    /* Снимаем жесткие ограничения, но оставляем центровку */
    .crates-pile { gap: 3px; }
    .loose-mandarins-pile { max-width: 100%; }
    
    .visual-container { gap: 8px; }
    .mandarin-visual-box { height: 260px; padding: 10px; }
    
    .share-buttons { gap: 8px; }
    .btn-share { width: 44px; height: 44px; flex: 0 0 44px; }
}