/* ============================================
   Options Trading Journal - Custom Styles
   Trading Terminal Aesthetic
   ============================================ */

/* ============================================
   CSS Variables - Color Palette
   ============================================ */

/* Dark Theme (Default) */
:root,
[data-theme="dark"] {
    /* Background Colors */
    --color-background: #0a0e27;
    --color-surface: #141b2d;
    --color-border: #1f2937;
    
    /* Text Colors */
    --color-text-primary: #e5e7eb;
    --color-text-secondary: #9ca3af;
    
    /* Semantic Colors */
    --color-profit: #10b981;
    --color-loss: #ef4444;
    --color-accent: #3b82f6;
    --color-warning: #f59e0b;
    
    /* Spacing */
    --spacing-unit: 8px;
}

/* Light Theme */
[data-theme="light"] {
    /* Background Colors */
    --color-background: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    
    /* Text Colors */
    --color-text-primary: #1e293b;
    --color-text-secondary: #64748b;
    
    /* Semantic Colors */
    --color-profit: #059669;
    --color-loss: #dc2626;
    --color-accent: #2563eb;
    --color-warning: #d97706;
    
    /* Spacing */
    --spacing-unit: 8px;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background-color: var(--color-background);
    color: var(--color-text-primary);
    min-height: 100vh;
    /* iOS Safari fixes */
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 16px;
}

/* Monospace for numbers and data */
.font-mono,
.data-value,
table td:not(:first-child) {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-weight: 500;
}

/* ============================================
   Utility Classes
   ============================================ */
.bg-background {
    background-color: var(--color-background);
}

.bg-surface {
    background-color: var(--color-surface);
}

.text-text-primary {
    color: var(--color-text-primary);
}

.text-text-secondary {
    color: var(--color-text-secondary);
}

.text-profit {
    color: var(--color-profit);
}

.text-loss {
    color: var(--color-loss);
}

.border-border {
    border-color: var(--color-border);
}

/* ============================================
   Button Styles
   ============================================ */
button {
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 14px;
    /* iOS Safari fixes */
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background-color: var(--color-accent);
    color: #ffffff;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    /* iOS Safari fixes */
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-primary:active {
    background-color: #1d4ed8;
    transform: scale(0.98);
}

.btn-primary:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text-primary);
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-weight: 500;
    /* iOS Safari fixes */
    -webkit-appearance: none;
    appearance: none;
}

.btn-secondary:hover {
    background-color: var(--color-surface);
    border-color: var(--color-text-secondary);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-secondary:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ============================================
   Form Controls
   ============================================ */
.filter-select {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    padding: 6px 32px 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-repeat: no-repeat;
    background-position: right 8px center;
    /* iOS Safari fixes */
    touch-action: manipulation;
}

/* Dark theme dropdown arrow */
[data-theme="dark"] .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Light theme dropdown arrow */
[data-theme="light"] .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.filter-select:hover {
    border-color: var(--color-text-secondary);
}

.filter-select:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-color: var(--color-accent);
}

/* ============================================
   Filter Button Groups
   ============================================ */
.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-right: 4px;
}

.filter-button-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    background-color: transparent;
    border: 1px solid var(--color-border);
    border-bottom: 2px solid transparent;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    /* iOS Safari fixes */
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.filter-btn:hover {
    background-color: var(--color-surface);
    border-color: var(--color-text-secondary);
    color: var(--color-text-primary);
}

.filter-btn.active {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-accent);
}

[data-theme="dark"] .filter-btn.active {
    background-color: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .filter-btn.active {
    background-color: rgba(37, 99, 235, 0.08);
}

.filter-btn:active {
    transform: scale(0.97);
}

.filter-btn:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 767px) {
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .filter-label {
        font-size: 13px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .filter-button-group {
        gap: 4px;
    }
}

/* File input styling for iOS */
input[type="file"] {
    /* iOS Safari fixes */
    -webkit-appearance: none;
    appearance: none;
}

/* ============================================
   Chart Containers
   ============================================ */
.chart-container {
    min-height: 300px;
    height: 300px;
    width: 100%;
    position: relative;
}

/* Scrollable chart containers for mobile */
.chart-container-scrollable {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* On mobile, set minimum width to enable horizontal scrolling */
@media (max-width: 767px) {
    .chart-container-scrollable {
        min-width: 100%;
    }
    
    .chart-container-scrollable .chart-container {
        min-width: 800px; /* Ensures charts are wide enough to scroll */
    }
    
    /* Larger minimum width for complex visualizations */
    #trade-flow-chart {
        min-width: 1000px;
    }
    
    #symbol-pl-chart {
        min-width: 900px;
    }
}

/* Larger chart for P/L trend */
#pl-trend-chart {
    min-height: 400px;
    height: 400px;
}

/* Specific chart heights */
#win-rate-chart,
#pl-breakdown-chart,
#strategy-performance-chart {
    height: 300px;
}

/* P/L by Symbol needs more height for many symbols */
#symbol-pl-chart {
    height: 600px;
    min-height: 600px;
}

/* Add this new rule for the trade flow chart specifically */
#trade-flow-chart-section {
    width: 100%;
    min-width: 800px; /* Ensures chart is wide enough to scroll on mobile */
    overflow-x: auto;
    overflow-y: hidden;
}

/* On mobile, allow the section to scroll */
@media (max-width: 767px) {
    #trade-flow-chart-section {
        min-width: 1000px; /* Even wider on mobile for better visualization */
    }
}

/* ============================================
   Data Table Styles
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background-color: var(--color-background);
    border-bottom: 2px solid var(--color-border);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: var(--color-text-primary);
}

.data-table th.sortable:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--color-border);
}

[data-theme="dark"] .data-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .data-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .data-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.data-table td {
    padding: 12px 16px;
}

.data-table td:first-child {
    font-weight: 500;
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 12px 16px;
    min-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--color-profit);
}

.toast.error {
    border-left: 4px solid var(--color-loss);
}

.toast.warning {
    border-left: 4px solid var(--color-warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
    body {
        font-size: 13px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    .chart-container {
        min-height: 250px;
    }
    
    #pl-trend-chart {
        min-height: 300px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    body {
        font-size: 12px;
    }
    
    h1 {
        font-size: 18px;
    }
    
    h2 {
        font-size: 16px;
    }
    
    .chart-container {
        min-height: 200px;
    }
    
    #pl-trend-chart {
        min-height: 250px;
    }
    
    main {
        padding: 12px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }
    
    /* Keep header items on same line on mobile */
    #main-header .flex.items-center {
        flex-wrap: nowrap;
    }
    
    #header-title-section {
        flex: 1;
        min-width: 0;
    }
    
    #header-title-section h1 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #header-subtitle {
        display: none;
    }
}

/* ============================================
   Compact Header Mode
   ============================================ */
#main-header.compact {
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(8px);
    background-color: rgba(var(--color-surface-rgb), 0.95);
}

[data-theme="dark"] {
    --color-surface-rgb: 20, 27, 45;
}

[data-theme="light"] {
    --color-surface-rgb: 255, 255, 255;
}

#main-header.compact h1 {
    font-size: 18px;
}

#main-header.compact #header-subtitle {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

#main-header.compact .btn-secondary,
#main-header.compact .btn-primary {
    padding: 6px 12px;
    font-size: 13px;
}

#main-header.compact .theme-toggle {
    padding: 3px;
}

#main-header.compact .theme-btn {
    width: 28px;
    height: 28px;
}

/* Mobile compact header */
@media (max-width: 767px) {
    #main-header.compact {
        padding: 6px 12px;
    }
    
    #main-header.compact h1 {
        font-size: 16px;
    }
    
    #main-header.compact .btn-secondary,
    #main-header.compact .btn-primary {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* ============================================
   Collapsible Filters
   ============================================ */
.filters-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filters-collapsible.expanded {
    max-height: 500px;
}

#filters-toggle {
    cursor: pointer;
    user-select: none;
}

#filters-toggle:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

#filters-icon.expanded {
    transform: rotate(90deg);
}

#filters-summary {
    transition: opacity 0.2s ease;
}

/* Mobile filters */
@media (max-width: 767px) {
    .filters-collapsible.expanded {
        max-height: 800px;
    }
}

/* ============================================
   Focus Indicators (Accessibility)
   ============================================ */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ============================================
   Grid Layout Utilities
   ============================================ */
@media (min-width: 1024px) {
    .grid {
        display: grid;
    }
    
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Visibility Utilities
   ============================================ */
.hidden {
    display: none !important;
}

.visible {
    display: block;
}

/* ============================================
   Upload Zone & Drop Zone - iOS Fixes
   ============================================ */
#upload-zone {
    /* Ensure proper z-index and touch handling on iOS */
    -webkit-overflow-scrolling: touch;
}

#drop-zone {
    cursor: pointer;
    /* iOS Safari fixes */
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

#drop-zone:active {
    background-color: rgba(59, 130, 246, 0.05);
}

/* ============================================
   Color Coding for P/L Values
   ============================================ */
.pl-positive {
    color: var(--color-profit);
}

.pl-negative {
    color: var(--color-loss);
}

.pl-neutral {
    color: var(--color-text-secondary);
}

/* ============================================
   Collapsible Section Component
   ============================================ */
.collapsible-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

[data-theme="dark"] .collapsible-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .collapsible-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

.collapsible-header:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.collapsible-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.collapsible-summary {
    color: var(--color-text-secondary);
    font-size: 13px;
    transition: opacity 0.2s ease;
}

.collapsible-summary.hidden {
    opacity: 0;
    pointer-events: none;
}

.collapsible-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.collapsible-icon.expanded {
    transform: rotate(90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-inner {
    padding: 0 20px 20px 20px;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .collapsible-header {
        padding: 12px 16px;
    }
    
    .collapsible-title {
        font-size: 16px;
        gap: 8px;
    }
    
    .collapsible-summary {
        font-size: 12px;
    }
    
    .collapsible-inner {
        padding: 0 16px 16px 16px;
    }
}

/* ============================================
   Advanced Visualization Panel Component - Vertical Layout
   ============================================ */
.advanced-viz-panel-vertical {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.viz-panels-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.viz-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    overflow: hidden;
}

.viz-panel-header {
    margin-bottom: 20px;
}

.viz-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.viz-panel-content {
    min-height: 500px;
    height: 500px;
    width: 100%;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
}

.viz-panel-content svg {
    min-width: 100%;
    height: 100%;
    display: block;
}

/* Error state */
.viz-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
    height: 100%;
}

.viz-error-icon {
    font-size: 48px;
}

.viz-error-message {
    color: var(--color-text-secondary);
    font-size: 14px;
    max-width: 400px;
}

/* Mobile responsive */
@media (max-width: 767px) {
    .advanced-viz-panel-vertical {
        gap: 16px;
    }
    
    .viz-panels-container {
        gap: 16px;
    }
    
    .viz-panel {
        padding: 16px;
    }
    
    .viz-panel-header {
        margin-bottom: 16px;
    }
    
    .viz-panel-title {
        font-size: 16px;
    }
    
    .viz-panel-content {
        min-height: 450px;
        height: 450px;
    }
}

/* Tablet responsive */
@media (min-width: 768px) and (max-width: 1023px) {
    .advanced-viz-panel-vertical {
        gap: 20px;
    }
    
    .viz-panels-container {
        gap: 20px;
    }
    
    .viz-panel {
        padding: 20px;
    }
    
    .viz-panel-title {
        font-size: 17px;
    }
    
    .viz-panel-content {
        min-height: 450px;
        height: 450px;
    }
}

/* ============================================
   Icon Button Component
   ============================================ */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
    /* iOS Safari fixes */
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    touch-action: manipulation;
}

.icon-btn:hover {
    color: var(--color-text-primary);
    border-color: var(--color-text-secondary);
}

[data-theme="dark"] .icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 767px) {
    .icon-btn {
        width: 36px;
        height: 36px;
    }
    
    .icon-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Compact header icon buttons */
#main-header.compact .icon-btn {
    width: 32px;
    height: 32px;
}

#main-header.compact .icon-btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 767px) {
    #main-header.compact .icon-btn {
        width: 28px;
        height: 28px;
    }
    
    #main-header.compact .icon-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   Actions Menu Component
   ============================================ */
.actions-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
    overflow: hidden;
}

[data-theme="light"] .actions-menu {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    /* iOS Safari fixes */
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    touch-action: manipulation;
}

.menu-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.menu-item:active {
    background: rgba(59, 130, 246, 0.15);
}

.menu-item svg {
    flex-shrink: 0;
    color: var(--color-text-secondary);
}

.menu-item:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}

/* Mobile responsive */
@media (max-width: 767px) {
    .actions-menu {
        min-width: 180px;
    }
    
    .menu-item {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* ============================================
   Tab Navigation Styles
   ============================================ */
.tab-btn {
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--color-text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.tab-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.tab-btn:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.tab-panel {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive tabs */
@media (max-width: 767px) {
    .tab-btn {
        padding: 12px 16px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }
}

/* ============================================
   Light Theme Specific Adjustments
   ============================================ */
[data-theme="light"] {
    /* Adjust shadows for light mode */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toast {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .btn-secondary:active {
    background-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] #drop-zone:active {
    background-color: rgba(37, 99, 235, 0.05);
}

[data-theme="light"] .theme-btn:hover {
    background: rgba(37, 99, 235, 0.1);
}

/* Smooth theme transition */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body,
.bg-surface,
.bg-background,
.btn-secondary,
.filter-select,
.theme-toggle {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   SVG Chart Theme Colors
   ============================================ */

/* Dark theme SVG colors */
[data-theme="dark"] {
    --svg-text-primary: #e5e7eb;
    --svg-text-secondary: #9ca3af;
    --svg-background: #141b2d;
    --svg-surface: #141b2d;
    --svg-border: #1f2937;
    --svg-grid-line: #1f2937;
    --svg-axis-line: #1f2937;
    --svg-zero-line: #9ca3af;
    --svg-profit: #10b981;
    --svg-loss: #ef4444;
    --svg-accent: #3b82f6;
}

/* Light theme SVG colors */
[data-theme="light"] {
    --svg-text-primary: #1e293b;
    --svg-text-secondary: #64748b;
    --svg-background: #ffffff;
    --svg-surface: #ffffff;
    --svg-border: #cbd5e1;
    --svg-grid-line: #e2e8f0;
    --svg-axis-line: #cbd5e1;
    --svg-zero-line: #64748b;
    --svg-profit: #059669;
    --svg-loss: #dc2626;
    --svg-accent: #2563eb;
}

/* Apply theme colors to chart tooltips */
.chart-tooltip {
    background-color: var(--svg-surface) !important;
    border-color: var(--svg-border) !important;
    color: var(--svg-text-primary) !important;
}

[data-theme="light"] .chart-tooltip {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="dark"] .chart-tooltip {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}
