/* ADstyles.css */

:root {
    --bg-color: #f3f4f6;
    --card-bg-color: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --tabs-bg-color: #e5e7eb;
    --active-tab-bg: #2563eb;
    --active-tab-text: #ffffff;
    --inactive-tab-bg: transparent;
    --inactive-tab-text: #4b5563;
    --inactive-tab-hover: #d1d5db;
    --advance-color: #10b981;
    --decline-color: #ef4444;
    --toggle-bg-on: #10b981;
    --toggle-bg-off: #ef4444;
    --chart-grid-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-color: #111827;
    --card-bg-color: #1f2937;
    --text-color: #f9fafb;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --tabs-bg-color: #374151;
    --active-tab-bg: #2563eb;
    --active-tab-text: #ffffff;
    --inactive-tab-bg: transparent;
    --inactive-tab-text: #d1d5db;
    --inactive-tab-hover: #4b5563;
    --advance-color: #10b981;
    --decline-color: #ef4444;
    --toggle-bg-on: #10b981;
    --toggle-bg-off: #ef4444;
    --chart-grid-color: #374151;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
    min-height: 100vh;
    padding: 1rem;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 1.5rem;
    text-align: center;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.date-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .control-panel {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.tab-container {
    display: inline-flex;
    flex-wrap: wrap;
    background-color: var(--tabs-bg-color);
    border-radius: 9999px;
    padding: 0.25rem;
    gap: 0.25rem;
}

.tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    background-color: var(--inactive-tab-bg);
    color: var(--inactive-tab-text);
    transition: background-color 0.2s, color 0.2s;
}

.tab:hover {
    background-color: var(--inactive-tab-hover);
}

.tab.active {
    background-color: var(--active-tab-bg);
    color: var(--active-tab-text);
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-container {
    display: flex;
    align-items: center;
}

.toggle-label {
    margin-right: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-bg-off);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--toggle-bg-on);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tabs-bg-color);
    color: var(--text-color);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

.chart-container {
    background-color: var(--card-bg-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    position: relative;
    min-height: 400px;
}

#adChart {
    width: 100%;
    height: 400px;
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 0.5rem;
    z-index: 10;
}

[data-theme="dark"] .loading {
    background-color: rgba(31, 41, 55, 0.8);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--active-tab-bg);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ApexCharts customization */
.apexcharts-tooltip {
    background-color: var(--card-bg-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 2px 8px var(--shadow-color) !important;
}

.apexcharts-tooltip-title {
    background-color: var(--tabs-bg-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.apexcharts-xaxistooltip {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.apexcharts-xaxistooltip-bottom:after {
    border-bottom-color: var(--card-bg-color) !important;
}

.apexcharts-xaxistooltip-bottom:before {
    border-bottom-color: var(--border-color) !important;
}