:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #222222;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #3390ec;
    --accent-hover: #2b7fd4;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --border: #333333;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    padding: 16px;
    padding-bottom: 32px;
}

/* Заголовок */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Переключатель периодов */
.period-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background-color: var(--bg-secondary);
    padding: 4px;
    border-radius: 12px;
}

.period-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-btn.active {
    background-color: var(--accent);
    color: var(--text-primary);
}

.period-btn:hover:not(.active) {
    background-color: var(--bg-card);
}

/* Сетка статистики */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid var(--border);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.stat-icon {
    font-size: 28px;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.stat-change.neutral {
    color: var(--text-secondary);
}

/* Контейнеры графиков */
.chart-container {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

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

.chart-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.chart-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

canvas {
    max-height: 250px;
}

/* Дополнительная статистика */
.additional-stats {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.additional-stats h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-row-value {
    font-size: 16px;
    font-weight: 600;
}

/* Кнопка обновления */
.refresh-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--accent);
    color: var(--text-primary);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.refresh-btn:hover {
    background-color: var(--accent-hover);
}

.refresh-btn:active {
    transform: scale(0.98);
}

.refresh-icon {
    font-size: 18px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.refresh-btn.loading .refresh-icon {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Адаптивность */
/* Экран отказа в доступе */
.access-denied {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px;
    text-align: center;
}

.access-denied-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.8;
}

.access-denied h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--danger);
}

.access-denied > p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.access-denied-info {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    margin-bottom: 24px;
}

.access-denied-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.access-denied-info p:last-child {
    margin-bottom: 0;
}

.user-id {
    font-size: 12px;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
}

@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 20px;
    }

    .header h1 {
        font-size: 20px;
    }

    .access-denied-icon {
        font-size: 60px;
    }

    .access-denied h1 {
        font-size: 24px;
    }
}
