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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    transition: all 0.3s ease;
}

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

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: #6b7280;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.header-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Three Column Layout - Fixed Side by Side */
.three-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: start; /* Align to top */
}

.column {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 400px; /* Ensure consistent height */
}

/* Ensure all control panels have consistent styling and proper height */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: visible;
    height: fit-content;
    min-height: 400px; /* Ensure minimum height for consistency */
    width: 100%;
    flex: 1; /* Take up equal space */
}

.control-panel h3 {
    color: #374151;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-section h2 {
    color: #374151;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Enhanced Drag Handle - Positioned to avoid price overlap */
.drag-handle {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #9ca3af;
    font-size: 16px;
    cursor: grab;
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 4px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    z-index: 10;
    line-height: 1;
}

.symbol-card:hover .drag-handle {
    opacity: 1;
    color: #667eea;
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.drag-handle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.3);
}

.drag-handle:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* Collapsible Settings Styles */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 5px 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.collapsible-header:hover {
    color: #667eea;
}

.collapsible-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    color: #6b7280;
}

.collapsible-header:hover .collapsible-icon {
    color: #667eea;
}

.collapsible-icon.rotated {
    transform: rotate(180deg);
}

/* Fixed Collapsible Content Styles */
.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
    max-height: 2000px; /* Large enough for all content */
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden;
}

/* Button Styles */
.btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

/* Input Styles */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.stock-input-container {
    display: flex;
    gap: 10px;
}

.stock-input-container input {
    flex: 1;
}

/* Timer Styles */
.timer-display {
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    margin: 20px 0;
    color: #4f46e5;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.timer-display.warning {
    color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #f59e0b;
    animation: pulse 1s infinite;
}

.timer-display.critical {
    color: #ef4444;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: #ef4444;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.timer-controls {
    display: flex;
    gap: 10px;
}

.timer-controls .btn {
    flex: 1;
}

/* Timer Panel Enhancements */
.timer-info {
    text-align: center;
    margin-top: 15px;
}

.quick-actions h4 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 5px;
}

.data-source-status h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #0369a1;
}

/* Symbols List Styles */
.symbols-list {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stock-item:hover {
    background: #f3f4f6;
}

.stock-item:last-child {
    border-bottom: none;
}

.stock-checkbox {
    width: auto !important;
    margin-right: 10px;
}

.stock-symbol {
    font-weight: 600;
    color: #374151;
}

.stock-date {
    font-size: 0.8rem;
    color: #6b7280;
}

.drag-info {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 20px;
    padding: 10px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Enhanced Symbol Cards */
.symbol-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    cursor: grab;
    position: relative;
    overflow: hidden;
}

.symbol-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.symbol-card:active {
    cursor: grabbing;
}

.symbol-card.dragging {
    opacity: 0.6;
    transform: rotate(5deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.symbol-card.drop-target {
    border: 2px dashed #667eea;
    background: #f0f9ff;
}

/* Fixed Symbol Header Layout */
.symbol-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-right: 35px; /* Space for drag handle */
}

.symbol-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.2;
}

.symbol-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    background: #f8f9fa;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    min-width: fit-content;
    white-space: nowrap;
}

/* Signal Badge */
.signal-badge {
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    margin: 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.signal-badge.buy {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.signal-badge.sell {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.signal-badge.watch {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.signal-badge.hold {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.3);
}

.signal-badge.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* RSI Information */
.rsi-info {
    margin: 15px 0;
}

.rsi-main {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 8px;
    font-weight: 600;
}

.rsi-details {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.rsi-trend {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 8px;
}

.rsi-trend.rising {
    background: #dcfce7;
    color: #16a34a;
}

.rsi-trend.falling {
    background: #fee2e2;
    color: #dc2626;
}

.rsi-trend.flat {
    background: #f3f4f6;
    color: #6b7280;
}

/* Source Information */
.source-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.source-text {
    font-weight: 500;
}

.timestamp {
    opacity: 0.8;
}

/* Error State */
.symbol-card.error {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
}

.error-text {
    color: #dc2626;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    margin: 10px 0;
}

/* Loading State */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border: 2px dashed #d1d5db;
}

.loading-text {
    font-size: 1.2rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

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

/* Empty State Enhanced */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border: 2px dashed #d1d5db;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    color: #6b7280;
    margin: 0;
}

/* Toggle Switch Styles */
.feature-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.toggle-switch {
    width: 50px;
    height: 25px;
    background: #e5e7eb;
    border-radius: 25px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 21px;
    height: 21px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.toggle-switch.active::before {
    transform: translateX(25px);
}

.toggle-label {
    font-size: 14px;
    color: #374151;
}

/* Alert Styles */
.alert-item {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid;
}

.alert-item.warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-item.info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.alert-time {
    font-size: 12px;
    opacity: 0.7;
    margin-left: 10px;
}

/* Settings Page Specific Styles */
.settings-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-top: 0;
}

.settings-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.settings-panel h3 {
    color: #374151;
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 12px;
}

/* Info Boxes */
.api-info-box,
.login-info-box,
.test-info-box,
.export-info-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.api-info-box h4,
.login-info-box h4,
.test-info-box h4,
.export-info-box h4 {
    color: #0369a1;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.api-info-box p,
.login-info-box p,
.test-info-box p,
.export-info-box p {
    color: #075985;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.api-info-box ol {
    margin: 10px 0 0 20px;
    color: #075985;
}

.api-info-box li {
    margin-bottom: 5px;
}

/* API Key Groups */
.api-key-group {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
}

.api-key-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.api-key-group input {
    width: 100%;
    margin-bottom: 8px;
}

.api-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.api-limit {
    color: #6b7280;
    font-weight: 500;
}

.api-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.api-link:hover {
    text-decoration: underline;
}

/* API Actions */
.api-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.api-actions .btn {
    flex: 1;
    min-width: 120px;
    font-size: 0.9rem;
}

/* API Status */
.api-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.api-status.enhanced {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

/* Login Container */
.login-container {
    margin-top: 15px;
}

.login-form {
    max-width: 400px;
}

.login-form h4 {
    margin-bottom: 15px;
    color: #374151;
    font-size: 1.2rem;
}

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

.login-actions .btn {
    flex: 1;
}

/* Logged In Section */
.logged-in-section {
    max-width: 400px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
}

.user-details h4 {
    margin: 0 0 5px 0;
    color: #166534;
    font-size: 1.1rem;
}

.user-email {
    color: #15803d;
    font-size: 0.9rem;
    font-weight: 500;
}

.sync-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.sync-actions .btn {
    flex: 1;
}

.sync-status {
    padding: 10px;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #1e40af;
    text-align: center;
}

/* Test Actions */
.test-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.test-actions .btn {
    flex: 1;
    min-width: 140px;
}

.test-results {
    padding: 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #374151;
    min-height: 60px;
    white-space: pre-wrap;
}

/* Export Actions */
.export-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-actions .btn {
    flex: 1;
    min-width: 160px;
}

/* RSI Settings Section within Timer Panel */
.rsi-settings-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e5e7eb;
}

.rsi-settings-section h4 {
    margin-bottom: 15px;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Animation for new cards */
.symbol-card.new-card {
    animation: slideIn 0.5s ease-out;
}

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

/* Enhanced stock input hint */
.stock-input-container input::placeholder {
    opacity: 0.7;
}

.stock-input-container input:focus::placeholder {
    opacity: 0.5;
}

/* Dark Mode - Enhanced Readability */
body.dark-mode {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #f9fafb;
}

body.dark-mode .control-panel,
body.dark-mode .results-section,
body.dark-mode .header {
    background: rgba(31, 41, 55, 0.95);
    color: #f9fafb;
    border-color: #4b5563;
}

body.dark-mode .control-panel h3,
body.dark-mode .results-section h2,
body.dark-mode .header h1 {
    color: #f9fafb;
    border-color: #4b5563;
}

body.dark-mode .header p {
    color: #d1d5db;
}

/* Enhanced symbol cards in dark mode */
body.dark-mode .symbol-card {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

body.dark-mode .symbol-card:hover {
    border-color: #667eea;
}

body.dark-mode .symbol-card.drop-target {
    background: #1e3a8a;
    border-color: #3b82f6;
}

body.dark-mode .symbol-name {
    color: #f9fafb;
}

body.dark-mode .symbol-price {
    background: #4b5563;
    color: #f9fafb;
    border: 1px solid #6b7280;
}

body.dark-mode .rsi-main {
    color: #e5e7eb;
}

body.dark-mode .rsi-details {
    color: #d1d5db;
}

body.dark-mode .source-info {
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .source-text {
    color: #e5e7eb;
}

body.dark-mode .timestamp {
    color: #d1d5db;
}

/* Enhanced watchlist in dark mode */
body.dark-mode .symbols-list {
    background: #374151;
    border-color: #4b5563;
}

body.dark-mode .stock-item {
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .stock-item:hover {
    background: #4b5563;
}

body.dark-mode .stock-symbol {
    color: #f9fafb;
}

body.dark-mode .stock-date {
    color: #d1d5db;
}

/* Enhanced inputs in dark mode */
body.dark-mode input,
body.dark-mode select {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode input::placeholder {
    color: #9ca3af;
}

body.dark-mode input:focus,
body.dark-mode select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Enhanced labels and text in dark mode */
body.dark-mode .input-group label {
    color: #f9fafb;
}

body.dark-mode .toggle-label {
    color: #e5e7eb;
}

body.dark-mode .feature-toggle {
    color: #e5e7eb;
}

/* Enhanced notifications and info areas */
body.dark-mode .drag-info {
    background: #1e3a8a;
    color: #bfdbfe;
    border-color: #3b82f6;
}

body.dark-mode .loading,
body.dark-mode .empty-state {
    background: #374151;
    border-color: #4b5563;
}

body.dark-mode .loading-text,
body.dark-mode .empty-state p {
    color: #e5e7eb;
}

body.dark-mode .empty-state-icon {
    opacity: 0.7;
}

/* Enhanced performance stats in dark mode */
body.dark-mode #performanceStats {
    background: #374151 !important;
    border-color: #4b5563 !important;
}

body.dark-mode #performanceStats h4 {
    color: #f9fafb !important;
}

body.dark-mode #performanceStats div[style*="color: #6b7280"] {
    color: #d1d5db !important;
}

body.dark-mode #performanceStats div[style*="color: #4f46e5"] {
    color: #818cf8 !important;
}

/* Enhanced timer in dark mode */
body.dark-mode .timer-display {
    background: linear-gradient(135deg, #374151, #4b5563);
    color: #818cf8;
    border-color: #4b5563;
}

/* Enhanced error states in dark mode */
body.dark-mode .error-text {
    color: #fca5a5;
}

body.dark-mode .symbol-card.error {
    background: #991b1b;
    border-color: #dc2626;
}

/* Better contrast for small text */
body.dark-mode small {
    color: #d1d5db !important;
}

/* Better button contrast in dark mode */
body.dark-mode .btn-secondary {
    background: linear-gradient(135deg, #4b5563, #374151);
    color: #f9fafb;
}

body.dark-mode .btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(75, 85, 99, 0.4);
}

/* Dark mode for new timer elements */
body.dark-mode .quick-actions h4 {
    color: #f9fafb;
    border-color: #4b5563;
}

body.dark-mode .data-source-status {
    background: #1e3a8a !important;
    border-color: #3b82f6 !important;
}

body.dark-mode .data-source-status h4 {
    color: #bfdbfe !important;
}

body.dark-mode .data-source-status div {
    color: #dbeafe !important;
}

body.dark-mode .timer-info p {
    color: #d1d5db !important;
}

/* Dark Mode for Settings */
body.dark-mode .settings-panel {
    background: rgba(31, 41, 55, 0.95);
    color: #f9fafb;
    border-color: #4b5563;
}

body.dark-mode .settings-panel h3 {
    color: #f9fafb;
    border-color: #4b5563;
}

body.dark-mode .api-info-box,
body.dark-mode .login-info-box,
body.dark-mode .test-info-box,
body.dark-mode .export-info-box {
    background: #1e3a8a;
    border-color: #3b82f6;
}

body.dark-mode .api-info-box h4,
body.dark-mode .login-info-box h4,
body.dark-mode .test-info-box h4,
body.dark-mode .export-info-box h4 {
    color: #bfdbfe;
}

body.dark-mode .api-info-box p,
body.dark-mode .login-info-box p,
body.dark-mode .test-info-box p,
body.dark-mode .export-info-box p,
body.dark-mode .api-info-box ol,
body.dark-mode .api-info-box li {
    color: #dbeafe;
}

body.dark-mode .api-key-group {
    background: #374151;
    border-color: #4b5563;
}

body.dark-mode .api-key-group label {
    color: #f9fafb;
}

body.dark-mode .api-limit {
    color: #d1d5db;
}

body.dark-mode .api-link {
    color: #60a5fa;
}

body.dark-mode .api-status {
    background: #fbbf24;
    color: #92400e;
    border-color: #f59e0b;
}

body.dark-mode .api-status.enhanced {
    background: #065f46;
    color: #d1fae5;
    border-color: #059669;
}

body.dark-mode .user-info {
    background: #065f46;
    border-color: #059669;
}

body.dark-mode .user-details h4 {
    color: #d1fae5;
}

body.dark-mode .user-email {
    color: #a7f3d0;
}

body.dark-mode .sync-status {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #bfdbfe;
}

body.dark-mode .test-results {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

body.dark-mode .login-form h4 {
    color: #f9fafb;
}

/* Dark mode drag handle */
body.dark-mode .drag-handle {
    color: #d1d5db;
    background: rgba(0, 0, 0, 0.2);
}

body.dark-mode .symbol-card:hover .drag-handle {
    color: #818cf8;
    background: rgba(129, 140, 248, 0.2);
}

body.dark-mode .drag-handle:hover {
    color: #818cf8;
    background: rgba(129, 140, 248, 0.3);
}

/* Dark mode collapsible */
body.dark-mode .collapsible-header {
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .collapsible-header:hover {
    color: #818cf8;
}

body.dark-mode .collapsible-icon {
    color: #9ca3af;
}

body.dark-mode .collapsible-header:hover .collapsible-icon {
    color: #818cf8;
}

/* Dark mode for RSI settings section */
body.dark-mode .rsi-settings-section {
    border-top-color: #4b5563;
}

body.dark-mode .rsi-settings-section h4 {
    color: #f9fafb;
}

/* Responsive Design - Keep Side by Side Longer */
@media (max-width: 1400px) {
    .three-columns {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 15px;
    }
    
    .control-panel {
        padding: 20px;
        min-height: 350px;
    }
}

@media (max-width: 1200px) {
    .three-columns {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .three-columns .column:nth-child(3) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .three-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .three-columns .column:nth-child(3) {
        grid-column: 1;
    }
    
    .control-panel {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .three-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .header-controls {
        justify-content: center;
    }

    .header h1 {
        font-size: 2rem;
    }

    .timer-display {
        font-size: 2rem;
        padding: 15px;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }

    .stock-input-container {
        flex-direction: column;
    }

    .timer-controls {
        flex-direction: column;
    }
    
    .quick-actions div {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .control-panel {
        min-height: 250px;
        padding: 15px;
    }

    /* Settings page responsive */
    .settings-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .settings-panel {
        padding: 20px;
    }
    
    .api-actions,
    .login-actions,
    .sync-actions,
    .test-actions,
    .export-actions {
        flex-direction: column;
    }
    
    .api-actions .btn,
    .login-actions .btn,
    .sync-actions .btn,
    .test-actions .btn,
    .export-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .api-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .control-panel,
    .results-section {
        padding: 15px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}