:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent: #2962ff;
    --border: #2a2a2a;
}

[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #111111;
    --text-secondary: #555555;
    --accent: #2962ff;
    --border: #e0e0e0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

#theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.dashboard-section {
    padding: 1.5rem 2rem;
}

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

.section-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

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

@media (min-width: 640px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .charts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chart-card-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background-color: inherit;
}

.drag-handle {
    cursor: grab;
    margin-right: 0.5rem;
    color: var(--text-secondary);
    font-weight: bold;
}

.drag-handle:active {
    cursor: grabbing;
}

.chart-title {
    flex-grow: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

.btn-delete-chart {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.btn-delete-chart:hover {
    color: #ff3b30;
}

.btn-add-chart {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-add-chart:hover {
    opacity: 0.9;
}

.chart-widget-container {
    height: 220px;
    width: 100%;
}

dialog {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

dialog h2 {
    margin-top: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-cancel,
.btn-submit {
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
}

.btn-cancel {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-submit {
    background-color: var(--accent);
    border: none;
    color: white;
}

.chart-card.dragging {
    opacity: 0.5;
    border: 2px dashed var(--accent);
}