* {
    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;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

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

.dashboard-header {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.last-update {
    font-size: 1rem;
    opacity: 0.8;
}

.metrics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.chart-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.chart-section h3 {
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
}

.chart-wrapper {
    position: relative;
    height: 400px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2rem;
    z-index: 1000;
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.error-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.error-content h3 {
    color: #f44336;
    margin-bottom: 1rem;
}

.error-content button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 1rem;
}

.error-content button:hover {
    background: #5a67d8;
}

.info-box {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
}

.info-box h3 {
    color: #333;
    margin-bottom: 1rem;
}

.info-box ol {
    padding-left: 1.5rem;
}

.info-box li {
    margin-bottom: 0.5rem;
    color: #666;
}

.info-box code {
    background: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.period-selector {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.period-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.period-selector select {
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 200px;
}

.period-selector select:hover,
.period-selector select:focus {
    border-color: #667eea;
    outline: none;
}

.custom-period {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.custom-period input {
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 150px;
    text-align: center;
}

.custom-period input:focus {
    border-color: #667eea;
    outline: none;
}

.custom-period button {
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.custom-period button:hover {
    background: #5a67d8;
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    .metrics-cards {
        grid-template-columns: 1fr;
    }

    .period-selector {
        padding: 1rem;
    }

    .period-selector select {
        min-width: auto;
        width: 100%;
    }

    .custom-period {
        flex-direction: column;
        gap: 0.75rem;
    }

    .custom-period input {
        width: 100%;
    }

    .chart-wrapper {
        height: 300px;
    }
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.preset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

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

.custom-date-range {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.date-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
    justify-content: center;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.date-input-group label {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #666;
}

.date-input-group input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.date-input-group input:focus {
    border-color: #667eea;
    outline: none;
}

#applyDateRange {
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    height: fit-content;
}

#applyDateRange:hover {
    background: #5a67d8;
}

@media (max-width: 768px) {
    .preset-buttons {
        justify-content: center;
    }

    .preset-btn {
        flex: 1 1 auto;
        min-width: 80px;
    }

    .date-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .date-input-group {
        align-items: stretch;
    }
}
