/* Основные переменные */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-danger: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --sidebar-width: 260px;
}

/* Основные стили */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Сайдбар */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
    padding: 1rem 0;
    border-right: 1px solid rgba(0,0,0,0.05);
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--gray-700);
    font-weight: 500;
    border-radius: 0;
    margin: 0.25rem 1rem;
    border-radius: 8px;
}

.sidebar-item:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
}

.sidebar-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.sidebar-item i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Основной контент */
.content-wrapper {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Мобильная кнопка меню */
.mobile-menu-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
}

/* Адаптивность */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .content-wrapper {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4rem;
    }
    
    .mobile-menu-btn {
        display: block;
    }
}

/* Виды контента */
.view-content {
    min-height: 80vh;
}

/* Заголовки dashboard */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    color: var(--gray-800);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Карточки статистики */
.dashboard-stat-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Карточки */
.card {
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cc-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Hover эффекты */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Индикаторы уровня */
.level-indicator {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
    position: relative;
}

.level-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc3545 0%, #ffc107 30%, #28a745 100%);
    border-radius: 4px;
    transition: clip-path 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* Overlay загрузки */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Форма входа */
.login-container {
    min-height: 100vh;
    background: var(--gradient-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.form-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
    font-weight: 700;
}

/* История графиков */
.history-chart {
    height: 300px;
    margin-bottom: 1rem;
}

    border: 1px solid rgba(0, 184, 148, 0.2);
}

.tank-status.offline {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.tank-status.warning {
    background: rgba(253, 203, 110, 0.1);
    color: #f39c12;
    border: 1px solid rgba(253, 203, 110, 0.2);
}

.tank-channels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.channel-info {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
}

.channel-info.active {
    background: linear-gradient(135deg, #dcedc8 0%, #aed581 100%);
    border-color: #8bc34a;
}

.channel-info.duo {
    background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%);
    border-color: #9c27b0;
}

.channel-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.channel-value {
    font-size: 0.9rem;
    font-weight: bold;
    color: #2d3436;
}

.view-switcher .btn-check:checked + .btn {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

/* Адаптивность */
@media (max-width: 768px) {
    .page-header {
        padding: 1.5rem;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .tank-channels {
        grid-template-columns: 1fr;
    }
}

/* Анимации */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.tank-card.updating {
    animation: pulse 1s infinite;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Поддержка темной темы */
.dark-theme .page-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
}

.dark-theme .stats-card {
    background: #2d3748;
    border: 1px solid #4a5568;
    color: #e2e8f0;
}

.dark-theme .stats-content h3 {
    color: #e2e8f0;
}

.dark-theme .stats-content p {
    color: #a0aec0;
}

.dark-theme .content-card {
    background: #2d3748;
    border: 1px solid #4a5568;
}

.dark-theme .content-card .card-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: #e2e8f0;
}

.dark-theme .tank-card {
    background: #2d3748;
    border: 1px solid #4a5568;
    color: #e2e8f0;
}

.dark-theme .channel-info {
    background: #4a5568;
    border: 1px solid #718096;
    color: #e2e8f0;
}

.dark-theme .channel-info.active {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    border-color: #38a169;
}

.dark-theme .channel-info.duo {
    background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%);
    border-color: #805ad5;
}

.dark-theme .level-indicator {
    background: #4a5568;
}

.dark-theme .tank-status.online {
    background: rgba(56, 161, 105, 0.2);
    color: #68d391;
    border: 1px solid rgba(56, 161, 105, 0.3);
}

.dark-theme .tank-status.offline {
    background: rgba(245, 101, 101, 0.2);
    color: #fc8181;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

/* Стили для объединенного интерфейса емкостей */

/* Тип емкости в карточке */
.container-type-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

[data-container-type="mobile"] .container-type-badge {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

[data-container-type="stationary"] .container-type-badge {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

/* Мини-индикаторы уровня в таблице */
.level-mini-indicator {
    width: 60px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.level-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc3545 0%, #ffc107 30%, #28a745 100%);
    transition: clip-path 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* Счетчик найденных емкостей */
#containersCount {
    font-size: 0.9rem;
    color: var(--gray-600);
}

/* Темная тема для новых элементов */
[data-theme="dark"] .container-type-badge {
    background: var(--dark-card-bg);
    color: var(--dark-text-secondary);
}

[data-theme="dark"] [data-container-type="mobile"] .container-type-badge {
    background: rgba(52, 152, 219, 0.2);
    color: #5dade2;
}

[data-theme="dark"] [data-container-type="stationary"] .container-type-badge {
    background: rgba(46, 204, 113, 0.2);
    color: #58d68d;
}

[data-theme="dark"] .level-mini-indicator {
    background: var(--dark-border);
}

[data-theme="dark"] .level-indicator {
    background: var(--dark-border);
}

[data-theme="dark"] #containersCount {
    color: var(--dark-text-secondary);
}

.container-type-badge {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.container-type-badge i {
    color: var(--primary-color);
}

.level-mini-indicator {
    width: 40px;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.level-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc3545 0%, #ffc107 30%, #28a745 100%);
    transition: clip-path 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* Карточки емкостей с индикацией типа */
.cc-card[data-container-type="mobile"] {
    border-left: 4px solid var(--info-color);
}

.cc-card[data-container-type="stationary"] {
    border-left: 4px solid var(--secondary-color);
}

/* Улучшенные статистические карточки */
.stats-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: white;
}

.stats-content h3 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    color: #2d3436;
}

.stats-content p {
    margin: 0;
    color: #636e72;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Фильтры */
.content-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
}

.content-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1rem 1.5rem;
}

.content-card .card-body {
    padding: 1.5rem;
}

/* Переключатель вида */
.view-switcher .btn-check:checked + .btn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.view-info {
    font-size: 0.9rem;
    color: var(--gray-600);
}

/* Темная тема для новых элементов */
.dark-theme .stats-card {
    background: #2d3748;
    border: 1px solid #4a5568;
    color: #e2e8f0;
}

.dark-theme .stats-content h3 {
    color: #e2e8f0;
}

.dark-theme .stats-content p {
    color: #a0aec0;
}

.dark-theme .content-card {
    background: #2d3748;
    border: 1px solid #4a5568;
}

.dark-theme .content-card .card-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: #e2e8f0;
}

.dark-theme .container-type-badge {
    color: #a0aec0;
}

.dark-theme .view-info {
    color: #a0aec0;
}

.dark-theme .level-mini-indicator {
    background: #4a5568;
}

.dark-theme .level-indicator {
    background: #4a5568;
}

/* Контейнер для переключателя темы */
.theme-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.dark-theme .theme-toggle-container {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Переключатель темы - маленький кружок по центру */
.theme-toggle-sidebar {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-toggle-sidebar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle-sidebar i {
    font-size: 0.9rem;
    color: var(--gray-600);
    transition: all 0.3s ease;
}

/* Стили для темной темы */
.dark-theme .theme-toggle-sidebar {
    background: rgba(45, 55, 72, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-theme .theme-toggle-sidebar i {
    color: #fbbf24;
}

/* Иконки для разных тем */
.dark-theme .theme-toggle-sidebar i::before {
    content: "\f185"; /* fa-sun */
}

.theme-toggle-sidebar i::before {
    content: "\f186"; /* fa-moon */
}

/* Полностью убираем старый переключатель */
.theme-switcher {
    display: none !important;
}

/* Убираем старые стили */
.theme-toggle-item {
    display: none !important;
}
