/* Общие стили */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

header {
    background-color: #2ecc71;
    color: white;
    text-align: center;
    padding: 1rem 0;
}

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

footer {
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
    color: #777;
}

/* Кнопка синхронизации */
.sync-container {
    text-align: center;
    margin-bottom: 20px;
}

.sync-button {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.sync-button:hover {
    background-color: #27ae60;
}

#sync-status {
    margin-top: 10px;
    min-height: 20px;
    padding: 10px;
    border-radius: 4px;
    text-align: left;
}

#sync-status.error {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
}

.error-details {
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

.error-details h4 {
    margin-top: 0;
    color: #e74c3c;
}

.error-details ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
    color: #555;
    font-size: 14px;
}

/* Календарь */
.calendar-container {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

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

.calendar-header a {
    text-decoration: none;
    color: #555;
    margin: 0 10px;
    font-size: 20px;
}

.calendar-header span {
    font-weight: bold;
    font-size: 18px;
    margin: 0 15px;
}

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

table.calendar th, 
table.calendar td {
    text-align: center;
    padding: 10px;
}

table.calendar th {
    background-color: #f2f2f2;
}

table.calendar td {
    border: 1px solid #ddd;
    height: 80px;
    width: calc(100% / 7);
    vertical-align: top;
}

table.calendar td a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

table.calendar .has-data {
    position: relative;
}

table.calendar .has-data::after {
    content: "";
    display: block;
    width: 10px;
    height: 10px;
    background-color: #2ecc71;
    border-radius: 50%;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

table.calendar .today {
    background-color: #e8f5e9;
}

table.calendar .other-month {
    color: #ccc;
}

table.calendar .future {
    background-color: #f8f8f8;
}

/* Выделение выбранной даты в календаре */
table.calendar .selected {
    background-color: #d4edda;
    border: 2px solid #28a745;
}

/* Страница статистики */
.stats-container {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-top: 30px;
    animation: fadeIn 0.5s;
}

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

.chart-container {
    margin: 20px 0;
    position: relative;
    height: 400px;  /* Фиксированная высота для графика */
}

.totals {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
}

.total-box {
    flex: 1;
    text-align: center;
    padding: 20px;
    margin: 0 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.total-box h4 {
    margin-top: 0;
    color: #555;
}

.total-box .count {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2ecc71;
    transition: all 0.3s ease;
}

/* Анимация при обновлении счетчиков */
.total-box .count.updating {
    transform: scale(1.1);
    color: #27ae60;
}

.back-link {
    margin: 20px 0;
}

.back-link a {
    color: #2ecc71;
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Стиль для предупреждения об отсутствии данных */
.no-data-warning {
    background-color: #f8f9fa;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 20px 0;
}

.debug-info {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    padding: 15px;
    margin: 20px 0;
    font-family: monospace;
    font-size: 14px;
}

.debug-info h3 {
    margin-top: 0;
}

.debug-info ul {
    padding-left: 20px;
}

.debug-link {
    margin-left: 15px;
    font-size: 13px;
    color: #888;
}

/* Стили для информации об автоматической синхронизации */
.auto-sync-info {
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
}

.sync-status-success {
    color: #28a745;
}

.sync-status-error {
    color: #dc3545;
}

.error-message {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
}

/* Стили для фильтра времени */
.time-filter {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
}

.time-filter h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

.time-filter.active {
    border-color: #2ecc71;
    background-color: #e8f5e9;
}

.time-filter.active h4 {
    color: #27ae60;
}

.time-filter.active h4::after {
    content: " (активен)";
    font-size: 12px;
    font-weight: normal;
    color: #666;
}

.time-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.time-controls label {
    font-weight: 500;
    color: #495057;
}

.time-controls select {
    padding: 5px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    min-width: 80px;
}

.time-controls select:focus {
    outline: none;
    border-color: #2ecc71;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

.filter-button {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.filter-button:hover {
    background-color: #27ae60;
}

.filter-button.reset {
    background-color: #6c757d;
}

.filter-button.reset:hover {
    background-color: #5a6268;
}

/* Стили для статистики за период */
.period-filter {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
}

.period-filter h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

.period-form {
    width: 100%;
}

.period-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-range label {
    font-weight: 500;
    color: #495057;
}

.date-range input[type="date"] {
    padding: 5px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
}

.date-range input[type="date"]:focus {
    outline: none;
    border-color: #2ecc71;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

.view-type {
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-type > label {
    font-weight: 500;
    color: #495057;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal !important;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    margin: 0;
}

/* Таблица статистики */
.period-table {
    margin: 30px 0;
}

.period-table h3 {
    margin-bottom: 15px;
    color: #495057;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stats-table th,
.stats-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.stats-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    text-align: center;
}

.stats-table td {
    text-align: center;
}

.stats-table td:first-child {
    text-align: left;
}

.stats-table tbody tr:hover {
    background-color: #f8f9fa;
}

.date-link {
    color: #2ecc71;
    text-decoration: none;
}

.date-link:hover {
    text-decoration: underline;
}

/* Адаптивность для статистики за период */
@media (max-width: 768px) {
    .period-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-range {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-range input[type="date"] {
        width: 100%;
    }
    
    .view-type {
        justify-content: center;
    }
    
    .stats-table {
        font-size: 14px;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 8px 5px;
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .time-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-controls > * {
        margin: 2px 0;
    }
    
    .time-controls select {
        min-width: 100%;
    }
}
