/* Modern Light Theme - Inspired by Tailwind Design */
:root {
    --color-slate-50: #f8fafc;
    --color-slate-100: #f1f5f9;
    --color-slate-200: #e2e8f0;
    --color-slate-400: #94a3b8;
    --color-slate-500: #64748b;
    --color-slate-600: #475569;
    --color-slate-700: #334155;
    --color-slate-800: #1e293b;
    --color-white: #ffffff;
    --color-green-600: #16a34a;
    --color-red-600: #dc2626;
    --color-teal-500: #0ea5a4;
    --color-purple-600: #7c3aed;
    --color-orange-500: #f97316;
}

* {
    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(to bottom, var(--color-slate-50), var(--color-white));
    min-height: 100vh;
    color: var(--color-slate-800);
    line-height: 1.6;
}

.container {
    padding: 1.5rem;
    min-height: 100vh;
}

/* Header */
.header {
    max-width: 1280px;
    margin: 0 auto 1.5rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--color-slate-800);
    margin-bottom: 0.25rem;
}

.header-subtitle {
    font-size: 0.875rem;
    color: var(--color-slate-500);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.range-selector {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.range-selector select {
    background: transparent;
    border: none;
    font-size: 0.875rem;
    color: var(--color-slate-700);
    outline: none;
    cursor: pointer;
}

/* Update Status Section */
.update-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    border: 1px solid var(--color-slate-200);
}

.last-update-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.update-label {
    font-size: 0.65rem;
    color: var(--color-slate-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.update-date {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-slate-700);
}

.update-date.today {
    color: var(--color-green-600);
}

.update-date.old {
    color: var(--color-orange-500);
}

.update-button {
    padding: 0.5rem 0.75rem;
    background-color: var(--color-teal-500);
    color: var(--color-white);
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.update-button:hover {
    background-color: #0d9488;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.update-button:active {
    transform: translateY(0);
}

.update-button:disabled {
    background-color: var(--color-slate-400);
    cursor: not-allowed;
    transform: none;
}

.update-button.loading {
    pointer-events: none;
}

.update-button.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.export-button {
    padding: 0.5rem 0.75rem;
    background-color: var(--color-slate-800);
    color: var(--color-white);
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.export-button:hover {
    background-color: var(--color-slate-700);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Dashboard Grid */
.dashboard-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr 2fr;
    }
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric-card {
    padding: 1rem;
    background: var(--color-white);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-slate-100);
    transition: all 0.2s;
}

.metric-card:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--color-slate-500);
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.metric-value-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.metric-price {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-slate-800);
}

.metric-change {
    font-size: 0.875rem;
    font-weight: 500;
}

.metric-change.positive {
    color: var(--color-green-600);
}

.metric-change.negative {
    color: var(--color-red-600);
}

.metric-source {
    font-size: 0.75rem;
    color: var(--color-slate-400);
}

.metric-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.toggle-button {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--color-slate-50);
    border: 1px solid var(--color-slate-200);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-button:hover {
    background: var(--color-slate-100);
    border-color: var(--color-slate-300);
}

.metric-unit {
    font-size: 0.75rem;
    color: var(--color-slate-400);
}

/* Filter Card */
.filter-card {
    padding: 1rem;
    background: linear-gradient(to bottom right, var(--color-white), var(--color-slate-50));
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-slate-100);
}

.filter-title {
    font-size: 0.875rem;
    color: var(--color-slate-600);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.filter-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chip {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:not(.active) {
    background: var(--color-slate-100);
    color: var(--color-slate-700);
}

.chip:not(.active):hover {
    background: var(--color-slate-200);
}

.chip.active {
    background: var(--color-slate-800);
    color: var(--color-white);
}

/* Notes Card */
.notes-card {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    border: 1px solid var(--color-slate-100);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.notes-title {
    font-size: 0.875rem;
    color: var(--color-slate-600);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.notes-text {
    font-size: 0.75rem;
    color: var(--color-slate-500);
    line-height: 1.5;
}

.notes-text code {
    background: var(--color-slate-100);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Chart Controls */
.chart-controls {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--color-white);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-slate-100);
    gap: 1rem;
}

.chart-controls-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-slate-800);
    margin: 0;
}

.chart-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-toggles {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chart-aggregation {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.aggregation-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-slate-200);
    background: var(--color-white);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-slate-600);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.aggregation-btn:hover {
    background: var(--color-slate-50);
    border-color: var(--color-slate-300);
}

.aggregation-btn.active {
    background: var(--color-purple-500);
    border-color: var(--color-purple-500);
    color: var(--color-white);
}

.aggregation-btn i {
    font-size: 0.875rem;
}

.chart-toggle {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-slate-200);
    background: var(--color-white);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-slate-600);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-toggle:hover {
    background: var(--color-slate-50);
    border-color: var(--color-slate-300);
}

.chart-toggle.active {
    background: var(--color-teal-500);
    border-color: var(--color-teal-500);
    color: var(--color-white);
}

.chart-toggle i {
    font-size: 0.875rem;
}

.chart-container {
    position: relative;
    padding: 1rem;
    background: var(--color-white);
    border-radius: 1.5rem;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-slate-100);
    transition: all 0.3s ease;
}

.chart-container.hidden {
    display: none;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.chart-title-group {
    flex: 1;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-slate-800);
    margin-bottom: 0.25rem;
}

.chart-hint {
    font-size: 0.875rem;
    color: var(--color-slate-400);
}

.chart-area {
    height: 18rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-comparison-box {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--color-purple-500);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    min-width: 200px;
}

.chart-comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.chart-comparison-box h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-slate-700);
    margin: 0;
}

.chart-comparison-close {
    background: transparent;
    border: none;
    color: var(--color-slate-400);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-comparison-close:hover {
    color: var(--color-red-600);
}

.chart-comparison-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.25rem 0;
    font-size: 0.813rem;
}

.chart-comparison-label {
    color: var(--color-slate-600);
}

.chart-comparison-value {
    font-weight: 600;
    color: var(--color-slate-800);
}

.chart-comparison-diff {
    font-weight: 700;
    font-size: 0.938rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-slate-200);
}

.chart-comparison-diff.positive {
    color: var(--color-green-600);
}

.chart-comparison-diff.negative {
    color: var(--color-red-600);
}

.chart-placeholder {
    color: var(--color-slate-400);
    font-size: 0.875rem;
}

/* Chart Scrollbar */
.chart-scrollbar-container {
    width: 100%;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.chart-scrollbar {
    width: 100%;
}

.chart-scrollbar-track {
    position: relative;
    width: 100%;
    height: 12px;
    background: var(--color-slate-200);
    border-radius: 6px;
    cursor: pointer;
}

.chart-scrollbar-thumb {
    position: absolute;
    height: 12px;
    background: var(--color-purple-500);
    border-radius: 6px;
    cursor: grab;
    transition: background 0.2s;
    min-width: 30px;
}

.chart-scrollbar-thumb:hover {
    background: var(--color-purple-600);
}

.chart-scrollbar-thumb:active {
    cursor: grabbing;
    background: var(--color-purple-700);
}

/* Chart Reset Button */
.chart-reset-btn {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-purple-500);
    color: var(--color-white);
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.chart-reset-btn:hover {
    background: var(--color-purple-600);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.chart-reset-btn:active {
    transform: translateY(0);
}

.chart-reset-btn i {
    font-size: 0.875rem;
}

/* Secondary Charts */
.secondary-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .secondary-charts {
        grid-template-columns: 1fr 1fr;
    }
}

.mini-chart-card {
    padding: 1rem;
    background: var(--color-white);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-slate-100);
}

.mini-chart-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-slate-800);
}

.mini-chart-content {
    height: 11rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-chart-placeholder {
    color: var(--color-slate-400);
    font-size: 0.875rem;
}

.mini-chart-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.stat-box {
    padding: 0.75rem;
    background: var(--color-slate-50);
    border-radius: 0.5rem;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-slate-400);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-slate-800);
}

/* Table */
.table-container {
    padding: 1rem;
    background: var(--color-white);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-slate-100);
}

.table-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--color-slate-800);
}

.table-wrapper {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    position: relative;
}

.table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--color-slate-100);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--color-slate-400);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--color-slate-500);
}

.price-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.price-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-white);
}

.price-table thead tr {
    text-align: left;
    color: var(--color-slate-500);
}

.price-table th {
    padding: 0.75rem 0.5rem;
    font-weight: 500;
    border-bottom: 2px solid var(--color-slate-200);
    background: var(--color-white);
}

.price-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.price-table th.sortable:hover {
    background-color: var(--color-slate-50);
}

.price-table th.sortable i {
    margin-left: 0.25rem;
    opacity: 0.3;
    font-size: 0.75rem;
}

.price-table th.sortable.sorted-asc i {
    opacity: 1;
}

.price-table th.sortable.sorted-asc i::before {
    content: "\f0de"; /* fa-sort-up */
}

.price-table th.sortable.sorted-desc i {
    opacity: 1;
}

.price-table th.sortable.sorted-desc i::before {
    content: "\f0dd"; /* fa-sort-down */
}

.price-table tbody tr {
    border-top: 1px solid var(--color-slate-100);
    transition: background-color 0.15s;
}

.price-table tbody tr:hover {
    background-color: var(--color-slate-50);
}

.price-table td {
    padding: 0.5rem 0;
    color: var(--color-slate-700);
}

/* Empty state */
.empty-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-slate-400);
}

.empty-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-message p {
    margin: 0.5rem 0;
}

.empty-hint {
    font-size: 0.875rem;
    color: var(--color-slate-500);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-title {
        font-size: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-area {
        height: 12rem;
    }
}
