/*
Theme Name: Production Calendar
Description: Production Calendar Theme
Version: 1.0
Author: Your Name
*/

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    line-height: 1.6;
}

.wrap {
    max-width: 100%;
    padding: 20px;
}

.page-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-title {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333;
}

.calendar-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-button {
    background: #2271b1;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.current-month-display {
    font-weight: bold;
    min-width: 150px;
    text-align: center;
}

/* Стили для выбора месяца и года */
.month-year-selectors {
    display: flex;
    gap: 10px;
    align-items: center;
}

.month-year-selectors select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
}

.today-button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.today-button:hover {
    background: #219653;
}

/* Контейнер для таблицы с прокруткой */
.calendar-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

.production-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px; /* Минимальная ширина для прокрутки */
}

.production-table th,
.production-table td {
    padding: 10px 8px;
    border: 1px solid #ddd;
    text-align: center;
}

.production-table thead th {
    background: #2c3e50;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.product-name {
    text-align: left;
    background: #f8f9fa;
    font-weight: bold;
    position: sticky;
    left: 0;
    min-width: 200px;
    z-index: 5;
}

.total-cell {
    background: #e8f4fd;
    font-weight: bold;
    min-width: 100px;
    position: sticky;
    left: 200px; /* После названия товара */
    z-index: 4;
}

.total-cell.total-ordered {
    left: 200px;
}

.total-cell.total-produced {
    left: 300px;
}

.total-cell.total-balance {
    left: 400px;
}

.day-cell {
    min-width: 60px;
    position: relative;
}

/* Убираем стрелки у input number */
.day-cell input {
    width: 100%;
    border: none;
    text-align: center;
    background: transparent;
    font-size: 14px;
    padding: 5px;
}

/* Скрываем стрелки увеличения/уменьшения в Webkit браузерах */
.day-cell input[type="number"]::-webkit-outer-spin-button,
.day-cell input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Скрываем стрелки в Firefox */
.day-cell input[type="number"] {
    -moz-appearance: textfield;
}

.day-cell input:focus {
    outline: 2px solid #2271b1;
    background: #f0f7ff;
}

/* Стили для подтвержденных ячеек */
.day-cell.confirmed {
    background: #f0fff0;
}

.day-cell.confirmed::after {
    content: "✓";
    position: absolute;
    top: 2px;
    right: 2px;
    color: #27ae60;
    font-size: 12px;
    font-weight: bold;
}

.day-cell.pending {
    background: #fffaf0;
}

.day-cell.pending::after {
    content: "?";
    position: absolute;
    top: 2px;
    right: 2px;
    color: #f39c12;
    font-size: 12px;
    font-weight: bold;
}

.day-cell.weekend {
    background: #fff0f0;
}

.day-header.weekend {
    background: #e74c3c !important;
}

/* Индикатор текущего дня */
.day-header.today {
    background: #f39c12 !important;
    position: relative;
}

.day-header.today::after {
    content: '●';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    color: #fff;
}

.calendar-actions {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-btn, .admin-btn {
    background: #2271b1;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.admin-btn.primary {
    background: #135e96;
}

.export-btn:hover, .admin-btn:hover {
    opacity: 0.9;
}

.no-products {
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    color: #666;
}

.status-legends {
    display: flex;
    gap: 20px;
    margin: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-confirmed { background: #27ae60; }
.status-pending { background: #f39c12; }
.status-weekend { background: #e74c3c; }

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Анимация обновления итоговых значений */
.total-cell.updated {
    background: #ffff99 !important;
    transition: background 1s ease;
}

/* Полоса прокрутки */
.table-wrapper::-webkit-scrollbar {
    height: 12px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Адаптивность */
@media (max-width: 768px) {
    .wrap {
        padding: 10px;
    }
    
    .calendar-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .month-nav {
        width: 100%;
        justify-content: center;
    }
    
    .month-year-selectors {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .calendar-actions {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .production-table th,
    .production-table td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .product-name {
        min-width: 150px;
    }
    
    .status-legends {
        flex-direction: column;
        gap: 10px;
    }
}
/* Добавляем подсказки */
.day-cell {
    position: relative;
    cursor: help;
}

.day-cell.confirmed::before {
    content: "✓";
    position: absolute;
    top: 2px;
    right: 2px;
    color: #27ae60;
    font-size: 12px;
    font-weight: bold;
}

.day-cell.pending::before {
    content: "?";
    position: absolute;
    top: 2px;
    right: 2px;
    color: #f39c12;
    font-size: 12px;
    font-weight: bold;
}

/* Подсказки при наведении */
.day-cell[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}
/* Стили для индикатора загрузки */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #d63031;
    background: #ffeaa7;
    border-radius: 5px;
    margin: 20px;
}

.error button {
    background: #d63031;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}