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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

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

/* Header */
header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: #888;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

/* Data Tabs */
.data-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    padding: 12px 30px;
    border: 2px solid #4a5568;
    background: rgba(0, 0, 0, 0.2);
    color: #a0aec0;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Upload Date Section */
.upload-date-section {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 1px solid #4a5568;
}

.upload-date-section label {
    display: block;
    margin-bottom: 10px;
    color: #fff;
    font-weight: 500;
}

.upload-date-section input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-date-section input:hover {
    border-color: #667eea;
}

.upload-date-section input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.upload-date-section .hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #718096;
}

/* Database Status */
.db-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f6ad55;
    animation: pulse 1.5s infinite;
}

.db-status.connected .status-dot {
    background: #48bb78;
    animation: none;
}

.db-status.error .status-dot {
    background: #e53e3e;
    animation: none;
}

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

/* Calendar Section */
.calendar-section {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.calendar-header h2 {
    color: #fff;
    font-size: 1.3rem;
}

.calendar-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #a0aec0;
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-item .dot.has-data {
    background: #48bb78;
}

.legend-item .dot.selected {
    background: #667eea;
}

.calendar-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.calendar-wrapper {
    flex: 1;
    min-width: 300px;
}

#datePicker {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #4a5568;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#datePicker:hover {
    border-color: #667eea;
}

#datePicker:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.date-info {
    flex: 1;
    min-width: 200px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.selected-range {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 8px;
}

.range-stats {
    font-size: 0.9rem;
    color: #a0aec0;
}

.calendar-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Flatpickr Customization */
.flatpickr-calendar {
    background: #2d3748 !important;
    border: 1px solid #4a5568 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
    border-radius: 12px !important;
}

.flatpickr-calendar.inline {
    width: 100% !important;
    max-width: 400px;
}

.flatpickr-months {
    background: #1a202c !important;
    border-radius: 12px 12px 0 0 !important;
}

.flatpickr-month {
    color: #fff !important;
}

.flatpickr-current-month {
    color: #fff !important;
}

.flatpickr-monthDropdown-months {
    background: #2d3748 !important;
    color: #fff !important;
}

.flatpickr-weekdays {
    background: #1a202c !important;
}

.flatpickr-weekday {
    color: #a0aec0 !important;
}

.flatpickr-day {
    color: #e0e0e0 !important;
    border-radius: 8px !important;
}

.flatpickr-day:hover {
    background: #4a5568 !important;
    border-color: #4a5568 !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #667eea !important;
    border-color: #667eea !important;
    color: #fff !important;
}

.flatpickr-day.inRange {
    background: rgba(102, 126, 234, 0.3) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.flatpickr-day.today {
    border-color: #f6ad55 !important;
}

.flatpickr-day.has-data {
    background: rgba(72, 187, 120, 0.3) !important;
    font-weight: bold;
}

.flatpickr-day.has-data::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #48bb78;
    border-radius: 50%;
}

.flatpickr-day.flatpickr-disabled {
    color: #4a5568 !important;
}

.flatpickr-prev-month,
.flatpickr-next-month {
    fill: #fff !important;
}

.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
    fill: #667eea !important;
}

/* Upload Section */
.upload-section {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.section-header h2 {
    color: #fff;
    font-size: 1.3rem;
}

.btn-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #a0aec0;
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(229, 62, 62, 0.2);
    color: #e53e3e;
}

.upload-box {
    border: 2px dashed #4a5568;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
}

.upload-box:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-box.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.upload-box input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.upload-hint p {
    margin: 5px 0;
    color: #a0aec0;
}

.file-types {
    font-size: 0.85rem;
    color: #718096;
}

.file-info {
    margin-top: 15px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

/* Progress Bar */
.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #48bb78 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #a0aec0;
}

/* Sync Section */
.sync-info {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(56, 178, 172, 0.1);
    border-radius: 8px;
    border-left: 3px solid #38b2ac;
}

.sync-info p {
    color: #a0aec0;
    margin: 0;
}

.sync-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.sync-log {
    margin-top: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
}

.sync-log .log-entry {
    padding: 4px 0;
    color: #a0aec0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sync-log .log-entry:last-child {
    border-bottom: none;
}

.sync-log .log-entry.success {
    color: #48bb78;
}

.sync-log .log-entry.error {
    color: #e53e3e;
}

.sync-log .log-entry.info {
    color: #667eea;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 32, 44, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #4a5568;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 20px;
    color: #a0aec0;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #a0aec0;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sync {
    background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
    color: #fff;
}

.btn-sync:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(56, 178, 172, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

/* Date Picker Section */
.date-picker-section {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 1px solid #4a5568;
}

.date-picker-section label {
    display: block;
    margin-bottom: 10px;
    color: #fff;
    font-weight: 500;
}

.date-picker-section input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #4a5568;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-picker-section input:hover {
    border-color: #667eea;
}

.date-picker-section input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 12px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}

.stat-label {
    color: #a0aec0;
    font-size: 0.9rem;
}

/* Charts Section */
.charts-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-row {
    display: flex;
    gap: 20px;
}

.chart-container {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex: 1;
    min-width: 0;
}

.chart-container h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #4a5568;
}

.full-width {
    width: 100%;
}

.half-width {
    width: calc(50% - 10px);
}

.chart {
    height: 350px;
    width: 100%;
}

.chart-tall {
    height: 450px;
}

/* Responsive */
@media (max-width: 768px) {
    .chart-row {
        flex-direction: column;
    }

    .half-width {
        width: 100%;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .calendar-container {
        flex-direction: column;
    }

    .calendar-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Utility */
.hidden {
    display: none !important;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a202c;
}

::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}
