/* ============================================
   Coffee Evaluation Calculator - History (compact list, details, radar)
   ============================================ */

.result-grade {
font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

/* Radar Chart */

.radar-container {
display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

#radar-canvas {
max-width: 100%;
    height: auto;
}

/* History */

.history-actions {
display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.history-item {
background: var(--cream-dark);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
    transition: all var(--transition-fast);
    position: relative;
}

.history-header {
display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.history-actions-inline {
display: flex;
    gap: 6px;
    align-items: center;
}

.history-header:hover {
background: var(--cream-light);
}

.history-info {
flex: 1;
}

.history-score {
font-weight: 700;
    font-size: 1.2rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    color: white;
    margin-right: var(--spacing-sm);
}

.history-toggle {
font-size: 0.8rem;
    color: var(--coffee-light);
    transition: transform var(--transition-fast);
}

/* Кнопка удаления в истории — справа от кнопки PDF */

.history-delete {
display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d4c5b9;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.history-delete:hover {
background: rgba(180, 50, 50, 0.15);
}

/* Кнопка PDF в истории — слева от кнопки удаления */

.history-pdf {
display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d4c5b9;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.history-pdf:hover {
background: rgba(74, 59, 50, 0.15);
}

/* History Details */

.history-details {
border-top: 1px solid var(--cream-light);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.5);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.detail-section {
margin-bottom: var(--spacing-md);
}

.detail-section:last-child {
margin-bottom: 0;
}

.detail-section h4 {
color: var(--coffee-dark);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--accent);
}

.detail-row {
display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.85rem;
}

.detail-label {
color: var(--coffee-light);
    font-weight: 500;
}

.detail-value {
color: var(--coffee-dark);
    font-weight: 600;
    text-align: right;
}

.detail-total {
margin-top: var(--spacing-xs);
    padding-top: var(--spacing-xs);
    border-top: 1px dashed var(--cream-light);
    font-weight: 700;
}

.mini-radar {
display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto !important;
}

/* Кнопка экспорта PDF внутри спойлера истории */

.detail-actions {
text-align: center;
    padding-top: var(--spacing-sm);
    border-top: 1px dashed var(--cream-light);
    margin-top: var(--spacing-md);
}

.detail-pdf-btn {
display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px var(--shadow);
}

.detail-pdf-btn:hover {
background: var(--coffee-dark);
    box-shadow: 0 4px 8px var(--shadow-hover);
    transform: translateY(-1px);
}

.detail-pdf-btn:active {
transform: translateY(0);
}

.pdf-icon {
font-size: 1.1rem;
}

.pdf-text {
font-size: 0.85rem;
}

/* Toast Notifications */

#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001; /* Поверх модалки (z-index: 10000) */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Ограничение ширины — не улетает за экран при горизонтальном оверфлоу */
    max-width: calc(100vw - 40px);
    width: max-content;
}

/* ============================================
   Delete Confirmation Modal
   ============================================ */

.delete-confirm-modal {
    max-width: 420px;
}

.delete-confirm-body {
    padding: 20px;
    text-align: center;
}

.delete-confirm-body p {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.delete-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-confirm-cancel {
    padding: 10px 24px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--cream-white);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-confirm-cancel:hover {
    border-color: var(--accent);
    background: var(--cream-dark);
}

.btn-confirm-delete {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 6px rgba(229, 57, 53, 0.3);
}

.btn-confirm-delete:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 100%);
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.5);
    transform: translateY(-1px);
}

/* Dark theme для модалки подтверждения */

body.dark-theme .delete-confirm-body p {
    color: #d4a574;
}

body.dark-theme .btn-confirm-cancel {
    background: rgba(212, 165, 116, 0.1);
    border-color: rgba(212, 165, 116, 0.3);
    color: #d4a574;
}

body.dark-theme .btn-confirm-cancel:hover {
    background: rgba(212, 165, 116, 0.2);
}

/* ============================================
   Анимация удаления строки и лота
   ============================================ */

.history-session-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.history-session-row:hover {
    background: var(--cream-light, #f5f0eb);
}

body.dark-theme .history-session-row:hover {
    background: rgba(212, 165, 116, 0.1);
}

.history-session-row.deleting {
    animation: rowSlideOut 0.3s ease forwards;
}

@keyframes rowSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 60px;
    }
    to {
        opacity: 0;
        transform: translateX(30px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

.history-lot.deleting {
    animation: lotFadeOut 0.4s ease forwards;
}

@keyframes lotFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
        max-height: 0;
        overflow: hidden;
    }
}

/* ============================================
   Q-Grade Sub-Sliders в истории (прогресс-бары)
   ============================================ */

.qgrade-sub-sliders-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
}

.qgrade-sub-block-history {
    background: var(--cream-dark, #2a2520);
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid var(--cream-light, #3d352c);
}

.qgrade-sub-block-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent, #d4a574);
    margin-bottom: 8px;
}

.qgrade-sub-slider-history-item {
    display: grid;
    grid-template-columns: 160px 1fr 40px;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.qgrade-sub-label {
    font-size: 0.8rem;
    color: var(--coffee-light, #8b7355);
    font-weight: 500;
}

.qgrade-progress-bar-history {
    width: 100%;
    height: 8px;
    background: var(--cream-light, #e8e0d8);
    border-radius: 4px;
    overflow: hidden;
}

.qgrade-progress-fill-history {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #66bb6a);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.qgrade-sub-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--coffee-dark, #3e2723);
    text-align: right;
}

body.dark-theme .qgrade-sub-block-history {
    background: #2a2520 !important;
    border-color: #3d352c !important;
}

body.dark-theme .qgrade-sub-label {
    color: #d4a574;
}

body.dark-theme .qgrade-progress-bar-history {
    background: rgba(212, 165, 116, 0.15);
}

body.dark-theme .qgrade-sub-value {
    color: #d4a574;
}

/* Адаптивность перенесена в responsive.css */

/* ============================================
   Бейджи синхронизации (☁️ сервер / 💾 локально)
   ============================================ */

.history-sync-badge {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.history-sync-badge:hover {
    transform: scale(1.3);
}

.history-sync-server {
    /* ☁️ — синхронизировано на сервере */
}

.history-sync-local {
    /* 💾 — только локально */
    opacity: 0.7;
}

body.dark-theme .history-sync-local {
    opacity: 0.5;
}


/* ============================================
   Лот в истории — структура хедера
   ============================================ */

/* Обёртка информации о лоте (название + бейдж + счётчик) */
.history-lot-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* ============================================
   Кнопка "Добавить расчёт" на лоте
   ============================================ */

/* Контейнер действий — кнопка + toggle */
.history-lot-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Десктоп: pill-кнопка с иконкой и текстом */
.history-lot-add-btn {
    background: linear-gradient(135deg, var(--coffee-dark, #4a3728), var(--coffee-medium, #6b4f3a));
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(74, 55, 40, 0.25);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
    white-space: nowrap;
    font-family: inherit;
}

/* Блик на кнопке */
.history-lot-add-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 60%);
    pointer-events: none;
    border-radius: inherit;
}

.history-lot-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(74, 55, 40, 0.4);
    background: linear-gradient(135deg, #5a4535, #7d5f4a);
}

.history-lot-add-btn:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 1px 4px rgba(74, 55, 40, 0.25);
}

/* Текст кнопки */
.add-btn-text {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* ============================================
   Мобильная версия — круглая иконка без текста
   ============================================ */
@media (max-width: 600px) {
    .history-lot-add-btn {
        width: 34px;
        height: 34px;
        padding: 0;
        border-radius: 50%;
        font-size: 0; /* скрываем текст */
        gap: 0;
        box-shadow: 0 2px 8px rgba(74, 55, 40, 0.3);
    }

    .history-lot-add-btn::after {
        font-size: 18px; /* плюсик остаётся */
        content: '+';
    }

    .add-btn-text {
        display: none;
    }

    .history-lot-actions {
        gap: 6px;
    }

    .history-lot-add-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 3px 12px rgba(74, 55, 40, 0.4);
    }
}

/* Dark theme */
body.dark-theme .history-lot-add-btn {
    background: linear-gradient(135deg, #8b6f4e, #a0845c);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark-theme .history-lot-add-btn:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}
