/* БАЗОВЫЕ СБРОСЫ И ШРИФТЫ */
* {
    box-sizing: border-box; /* Чтобы padding не ломал ширину кнопок */
    margin: 0;
    padding: 0;
}

body {
    font-family: sans-serif;
    background-color: #f4f6f8;
    color: #222;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Растягиваем тело на весь экран телефона */
}

/* ШАПКА */
.app-header {
    background-color: #2563eb;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.app-header h1 {
    font-size: 20px;
    border: none; /* Убираем синюю линию из прошлого урока */
    color: white;
}

.header-buttons button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

/* ГЛАВНАЯ СЕТКА (САМОЕ ИНТЕРЕСНОЕ) */
.drinks-grid {
    flex: 1; /* Занимает всё свободное место между шапкой и подвалом */
    padding: 15px;
    
    /* МАГИЯ CSS GRID: */
    display: grid;
    /* Создаем колонки: они будут минимум 120px шириной, и их влезет столько, сколько поместится на экран */
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px; /* Расстояние между кнопками */
    
    align-content: start; /* Прижимаем кнопки к верху, если их мало */
}

/* СТИЛИ ДЛЯ КАЖДОЙ КНОПКИ-НАПИТКА */
.drink-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
}

.drink-card:active {
    transform: scale(0.95); /* Эффект нажатия на телефоне */
    background-color: #f0f9ff;
}

.drink-card .name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.drink-card .count {
    font-size: 28px;
    color: #2563eb;
    font-weight: bold;
}

/* НИЖНЯЯ ПАНЕЛЬ */
.app-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.danger-btn {
    width: 100%;
    padding: 15px;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

/* =========================================
   7. МОДАЛЬНОЕ ОКНО НАСТРОЕК
   ========================================= */

/* Контейнер, который затемняет фон и центрирует окно */
.modal-overlay {
    display: none; /* Скрыто по умолчанию */
    position: fixed; /* Фиксировано относительно экрана */
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Полупрозрачный черный фон */
    justify-content: center;
    align-items: center;
    z-index: 100; /* Поверх всех остальных элементов */
}

/* Когда JS добавит класс active, окно станет видимым */
.modal-overlay.active {
    display: flex; 
}

/* Само белое окно настроек */
.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh; /* Чтобы не вылезало за пределы экрана, если напитков много */
    overflow-y: auto; /* Внутренний скролл, если список длинный */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    text-align: center;
    color: #2563eb;
    margin-bottom: 15px;
    border: none;
}

/* Форма ввода */
.add-drink-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-drink-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}

.add-drink-form button {
    padding: 10px 15px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

/* Список напитков в настройках */
.settings-list {
    list-style: none; /* Убираем стандартные точки у списка */
    padding: 0;
    margin: 0 0 20px 0;
}

.settings-list li {
    display: flex;
    justify-content: space-between; /* Название слева, крестик справа */
    align-items: center;
    padding: 10px;
    background: #f4f6f8;
    margin-bottom: 8px;
    border-radius: 6px;
}

.delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-weight: bold;
}

.close-modal-btn {
    width: 100%;
    padding: 12px;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.drink-info {
    flex: 1; /* Заставляет текст занимать всё свободное место между чекбоксом и крестиком */
    margin-left: 10px;
}

/* =========================================
   8. ПАНЕЛЬ С ИТОГОВОЙ СУММОЙ
   ========================================= */
.total-bar {
    background: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #e2e8f0;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

.total-label {
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
}

.total-value {
    font-size: 28px;
    font-weight: bold;
    color: #2563eb;
}

.drink-info {
    flex: 1; /* Занимает всё свободное место между чекбоксом и крестиком */
    margin-left: 10px;
}

.total-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.order-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 5px;
}

.move-btn {
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.move-btn:hover {
    background: #cbd5e1;
}

/* =========================================
   9. МОДАЛЬНОЕ ОКНО ИСТОРИИ
   ========================================= */

/* Контейнер для списка смен */
.history-list {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Одна смена (один день) */
.shift-item {
    background: #f4f6f8;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.shift-item h3 {
    color: #2563eb;
    margin: 0 0 10px 0;
    font-size: 18px;
    border: none;
}

.shift-drinks {
    margin: 10px 0;
}

.shift-drink {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
}

.shift-drink:last-child {
    border-bottom: none;
}

.shift-total {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 2px solid #2563eb;
    font-weight: bold;
    color: #2563eb;
    font-size: 18px;
}