* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
    margin-bottom: 15px;
    color: #667eea;
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: #666;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s;
}

nav a:hover {
    background: #f0f0f0;
}

nav a.active {
    background: #667eea;
    color: white;
}

main {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Стили для главной страницы */
.week-selector {
    margin-bottom: 30px;
}

.week-selector select {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-left: 10px;
    min-width: 200px;
}

.stats-overview {
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

.stat-card h3 {
    margin-bottom: 15px;
    font-size: 18px;
    opacity: 0.9;
}

.stat-value {
    font-size: 48px;
    font-weight: bold;
}

.table-container {
    overflow-x: auto;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

tr:hover {
    background: #f8f9fa;
}

.loading {
    text-align: center;
    color: #999;
    padding: 20px;
}

.chart-container {
    margin-top: 40px;
    height: 400px;
}

/* Стили для админ-панели */
.admin-section {
    margin-bottom: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.admin-section h2 {
    margin-bottom: 20px;
    color: #667eea;
}

.admin-section h3 {
    margin: 20px 0 10px;
    color: #555;
}

.add-site-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-site-form input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.sites-list ul {
    list-style: none;
}

.sites-list li {
    padding: 10px;
    background: white;
    margin-bottom: 5px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.site-input-group {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 5px;
}

.site-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #667eea;
}

.site-input-group input {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-danger {
    background: #f56565;
    color: white;
    padding: 5px 10px;
}

.btn-danger:hover {
    background: #e53e3e;
}

.file-upload {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-upload input[type="file"] {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.help-text {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.message {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

.message.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
    display: block;
}

.message.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
    display: block;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    .add-site-form {
        flex-direction: column;
    }
    
    .stat-value {
        font-size: 36px;
    }
    
    .chart-container {
        height: 300px;
    }
}
/* Стили для секции редактирования */
.edit-controls {
    margin-bottom: 20px;
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    align-items: center;
}

.edit-site-btn {
    padding: 5px 10px !important;
}

.edit-visit-input {
    font-size: 16px;
}

.edit-visit-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#edit-form-container {
    border-top: 2px solid #e2e8f0;
    padding-top: 20px;
    margin-top: 20px;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

/* Анимация появления */
#edit-form-container {
    animation: slideDown 0.3s ease-out;
}

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

/* Улучшенные кнопки действий */
.sites-list li div {
    display: flex;
    gap: 5px;
}

.sites-list .btn {
    font-size: 16px;
    padding: 5px 10px;
}
/* Стили для выбора диапазона */
.range-selector {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.range-selector h2 {
    margin-bottom: 15px;
    color: #333;
}

.range-options {
    margin-bottom: 15px;
}

.preset-ranges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.range-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.range-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.range-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.custom-range {
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.custom-range label {
    display: block;
    margin-bottom: 15px;
    color: #666;
}

.date-inputs {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #666;
}

.input-group select {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.selected-period-info {
    margin-top: 15px;
    padding: 10px;
    background: #667eea;
    color: white;
    border-radius: 5px;
    text-align: center;
    font-weight: 500;
}

/* Карточки статистики */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 25px;
    border-radius: 10px;
    color: white;
    text-align: center;
}

.stat-card.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card.average {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.stat-card.best {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.stat-card h3 {
    margin-bottom: 15px;
    font-size: 16px;
    opacity: 0.9;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-sub {
    font-size: 14px;
    opacity: 0.8;
}

/* Вкладки */
.view-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Тренды */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
}

.trend-indicator.positive {
    background: #c6f6d5;
    color: #22543d;
}

.trend-indicator.negative {
    background: #fed7d7;
    color: #742a2a;
}

.trend-indicator.neutral {
    background: #e2e8f0;
    color: #4a5568;
}

.change {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
}

.change.positive {
    color: #48bb78;
}

.change.negative {
    color: #f56565;
}

/* Анализ трендов */
.trend-analysis {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.analysis-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.trend-group {
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.trend-group h4 {
    margin-bottom: 10px;
    color: #333;
}

.trend-group ul {
    list-style: none;
    padding: 0;
}

.trend-group li {
    padding: 5px 0;
    color: #666;
}

.trend-group.positive {
    border-left: 4px solid #48bb78;
}

.trend-group.negative {
    border-left: 4px solid #f56565;
}

.overall-trend {
    grid-column: 1 / -1;
    padding: 15px;
    background: white;
    border-radius: 8px;
    text-align: center;
}

.overall-trend p {
    font-size: 16px;
    font-weight: 500;
}

.overall-trend .positive {
    color: #22543d;
}

.overall-trend .negative {
    color: #742a2a;
}

/* Детализация по неделям */
.weekly-breakdown {
    margin-top: 30px;
}

.weekly-breakdown h2 {
    margin-bottom: 20px;
    color: #333;
}

/* Адаптивность */
@media (max-width: 768px) {
    .date-inputs {
        flex-direction: column;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .preset-ranges {
        justify-content: center;
    }
    
    .analysis-content {
        grid-template-columns: 1fr;
    }
}
/* Стили для секции экспорта */
.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

/* Адаптивность для кнопок экспорта */
@media (max-width: 768px) {
    .range-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .export-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .export-buttons .btn {
        flex: 1;
        min-width: 150px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
    }
}
/* Стили для выпадающего меню экспорта */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    padding: 10px 20px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.dropdown-toggle:hover {
    background: #38a169;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 250px;
    z-index: 1000;
    border: 1px solid #e2e8f0;
}

.dropdown-menu.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    text-align: left;
    background: none;
    border: none;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: #f8f9fa;
    color: #667eea;
}

.dropdown-menu hr {
    margin: 5px 0;
    border: none;
    border-top: 1px solid #e2e8f0;
}

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

/* Адаптивность */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 300px;
    }
}