/* ========================================
   DASHBOARD — ПОЛНЫЕ СТИЛИ (темная/светлая тема)
======================================== */

/* 🔥 ГЛАВНЫЕ ТЕМЫ — ВЫСШИЙ ПРИОРИТЕТ */
body.bg-dark {
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 100%) !important;
    color: #f8f9fa !important;
}

body.bg-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    color: #212529 !important;
}

/* Карточки подстраиваются под тему */
body.bg-dark .card {
    background: rgba(33, 37, 41, 0.95) !important;
    color: #f8f9fa !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

/* 🔥 НОВЫЙ БЛОК — ВЫСШИЙ ПРИОРИТЕТ */
body.bg-dark .status-card.status-v_zale,
body.bg-dark .status-card.status-vixod,
body.bg-dark .status-card.status-obed {
    background: inherit !important;
}

body.bg-light .card {
    background: rgba(255,255,255,0.95) !important;
    color: #212529 !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
}

/* ========================================
   ОСНОВНЫЕ КОМПОНЕНТЫ
======================================== */

/* ========================================
   📈 ТЕПЛОВЫЕ КАРТЫ
======================================== */

/* Магазин по часам */
.store-heatmap {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
}

.heatmap-hour {
    flex: 1;
    height: 45px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.heatmap-hour:hover {
    transform: scale(1.05);
    z-index: 10;
}

.heatmap-hour.current-hour {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5);
    transform: scale(1.08);
    animation: pulse 1s infinite;
}

.heatmap-hour .percent {
    font-size: 9px;
    margin-top: 1px;
    opacity: 0.9;
    font-weight: 700;
}

/* Индивидуальные GitHub-style */
.github-heatmap {
    display: flex;
    gap: 1.5px;
    margin-top: 6px;
    padding: 4px 0;
}

.heat-cell {
    width: 4px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.heat-cell:hover {
    transform: scale(1.5);
}

/* ========================================
   📊 ТАБЛИЦА РЕЙТИНГА (анти-топ 💩)
======================================== */

#weeklyReport .table {
    table-layout: fixed !important; 
    width: 100% !important;
    border-collapse: collapse !important;
}

#weeklyReport .table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(90deg, #343a40, #495057) !important;
    color: #f8f9fa !important;
    border-bottom: 2px solid #6c757d !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 12px 8px !important;  
    white-space: pre-wrap;           
}

/* ✅ ФИКСИРОВАННЫЕ ширины колонок */
#weeklyReport .table th:nth-child(1) { width: 45% !important; }  /* Сотрудник */
#weeklyReport .table th:nth-child(2) { width: 27.5% !important; } /* Ср. превышение */
#weeklyReport .table th:nth-child(3) { width: 27.5% !important; } /* Всего за 7 дней */

#weeklyReport .table td {
    padding: 12px 8px !important; 
    border-top: 1px solid #495057;
    vertical-align: middle;
    white-space: pre-wrap;          
}

#weeklyReport .table tbody tr {
    background: transparent !important;
    border-bottom: 1px solid #495057;
    transition: background-color 0.3s ease, box-shadow 0.3s ease; 
}

#weeklyReport .table tbody tr:hover {
    background: rgba(52, 58, 64, 0.6) !important;
    box-shadow: 0 4px 20px rgba(255, 99, 71, 0.15); 
}

/* Лидер 💩 */
#weeklyReport .table tbody tr:nth-child(1):hover {
    background: rgba(220, 53, 69, 0.25) !important;
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.4);
}

/* ========================================
   АНИМАЦИИ
======================================== */

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

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========================================
   🔐 МОДАЛ АВТОРИЗАЦИИ
======================================== */

#pinModal .modal-content {
    border-radius: 16px !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
}

#pinModal .modal-header {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#pinInput {
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-align: center;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    backdrop-filter: blur(10px);
}

#pinInput::placeholder {
    color: rgba(255,255,255,0.6);
}

#pinInput.is-invalid {
    border-color: #dc3545 !important;
    animation: shake 0.5s ease-in-out;
    background: rgba(220,53,69,0.1);
}

body.bg-light #pinInput {
    background: rgba(0,0,0,0.05);
    color: #212529;
}

/* ========================================
   ⏰ ОГРАНИЧЕНИЯ (справка)
======================================== */

#activeRestrictions {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 16px 20px;
    color: white;
    font-size: 0.95rem;
    box-shadow: 0 8px 32px rgba(102,126,234,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}

/* ========================================
   📊 ГРАФИКИ Chart.js
======================================== */

.chart-container {
    position: relative;
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0,0,0,0.1);
    padding: 20px;
}

#dailyChart, #statusChart {
    max-height: 300px !important;
}

/* ========================================
   🎨 КНОПКА ТЕМЫ
======================================== */

#themeToggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#themeToggle:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.7);
}

body.bg-light #themeToggle {
    background: rgba(0,0,0,0.15);
    border-color: rgba(0,0,0,0.3);
}

/* ========================================
   🔔 БЕДЖИ и статусы
======================================== */

.badge {
    font-weight: 600 !important;
    border-radius: 20px;
    padding: 0.4em 0.8em;
}

.status-card .badge {
    font-size: 0.75rem;
    padding: 0.3em 0.6em;
}

/* ========================================
   📱 РЕСПОНСИВ
======================================== */

@media (max-width: 768px) {
    .heatmap-hour { 
        height: 38px; 
        font-size: 10px; 
    }
    
    .github-heatmap {
        gap: 1px;
    }
    
    .heat-cell {
        width: 3px;
        height: 12px;
    }
    
    #themeToggle {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    #weeklyReport .table th {
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .store-heatmap {
        gap: 2px;
    }
    
    .heatmap-hour {
        height: 35px;
        font-size: 9px;
    }
}

/* ========================================
   🎯 УТИЛИТЫ
======================================== */

.text-shadow {
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.position-relative { position: relative; }
.opacity-75 { opacity: 0.75; }
.opacity-50 { opacity: 0.5; }

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}
body.bg-dark ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
}

/* 📝 CHANGELOG */
.changelog-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}

.changelog-content.show {
    max-height: 500px;
    opacity: 1;
}

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }

.timeline-date {
    position: absolute;
    left: -45px;
    top: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(102,126,234,0.4);
}

.timeline-content {
    background: rgba(255,255,255,0.9);
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    line-height: 1.5;
}

body.bg-dark .timeline-content {
    background: rgba(33,37,41,0.9) !important;
    color: #f8f9fa !important;
    border-left-color: #667eea;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.bg-dark .timeline::before {
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

/* 📝 МОДАЛ CHANGELOG */
#changelogModal .modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#changelogModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.timeline {
    position: relative;
    padding-left: 35px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #0d6efd, #6610f2);
}

.timeline-item {
    position: relative;
    margin-bottom: 28px;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }

.timeline-date {
    position: absolute;
    left: -50px;
    top: 2px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.timeline-content {
    background: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #0d6efd;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

body.bg-dark #timeline::before {
    background: linear-gradient(to bottom, #0dcaf0, #6f42c1);
}

body.bg-dark .timeline-content {
    background: rgba(33,37,41,0.95) !important;
    color: #f8f9fa !important;
    border-left-color: #0dcaf0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Кнопка в меню */
#changelogBtn {
    min-width: 42px;
}

body.bg-dark #weeklyReport .table {
    background: rgba(52, 58, 64, 0.9) !important;
    color: #f8f9fa !important;
}

body.bg-dark #weeklyReport .table th {
    background: linear-gradient(90deg, #343a40, #495057) !important;
    color: #f8f9fa !important;
    border-bottom: 2px solid #6c757d !important;
}

body.bg-dark #weeklyReport .table td {
    background: rgba(52, 58, 64, 0.7) !important;
    color: #f8f9fa !important;
    border-top: 1px solid #495057 !important;
}

body.bg-dark #weeklyReport .table tr:hover {
    background: rgba(73, 80, 87, 0.8) !important;
    color: #f8f9fa !important;
}

/* 🔧 Header карточки */
body.bg-dark .card-header {
    background: rgba(52, 58, 64, 0.9) !important;
    color: #f8f9fa !important;
    border-bottom: 1px solid #495057 !important;
}