/* ============================================================================
   STITCH-INSPIRED DARK DESIGN
   Based on user's Google Stitch design
   ============================================================================ */

/* ============================================================================
   DARK THEME COLORS
   ============================================================================ */

:root {
    /* Dark Navy Background */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;

    /* Card Backgrounds */
    --card-bg: #1e293b;
    --card-border: #334155;

    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    /* Blue Accent */
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;

    /* Status Colors */
    --status-active: #10b981;
    --status-inactive: #64748b;
}

/* ============================================================================
   BASE - DARK THEME
   ============================================================================ */

body {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ============================================================================
   HEADER - DARK
   ============================================================================ */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--card-border);
    box-shadow: none;
}

/* ============================================================================
   NAVIGATION - DARK
   ============================================================================ */

.nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--card-border);
}

.nav-link {
    color: var(--text-secondary);
}

.nav-link:hover {
    color: var(--text-primary);
    background: transparent;
}

.nav-link.active {
    color: var(--accent-blue);
    background: transparent;
    border-bottom: 2px solid var(--accent-blue);
    border-radius: 0;
}

/* ============================================================================
   TABS - STITCH STYLE
   ============================================================================ */

.tabs {
    background: transparent;
    padding: 0;
    border-bottom: 1px solid var(--card-border);
    box-shadow: none;
    border-radius: 0;
    gap: 0;
    margin-bottom: var(--space-8);
}

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: var(--space-4) var(--space-6);
    font-weight: var(--font-medium);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: transparent;
    border-bottom-color: var(--text-tertiary);
}

.tab-btn.active {
    color: var(--accent-blue);
    background: transparent;
    border-bottom-color: var(--accent-blue);
    box-shadow: none;
}

/* ============================================================================
   TAB CONTENT - CRITICAL FOR HIDING INACTIVE TABS
   ============================================================================ */

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================================================
   SECTION HEADER - DARK
   ============================================================================ */

.section-header {
    background: transparent;
    border-bottom: none;
    padding: var(--space-6) 0;
}

.section-header h2 {
    color: var(--text-primary);
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
}

/* ============================================================================
   CARDS - OUTLINED DARK STYLE
   ============================================================================ */

.pair-card,
.strategy-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: none;
}

.pair-card:hover,
.strategy-card:hover {
    border-color: var(--accent-blue);
    background: var(--card-bg);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

/* ============================================================================
   DASHBOARD CARDS - DARK THEME
   ============================================================================ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: none;
}

.card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

/* ============================================================================
   CARDS GRID - RESPONSIVE LAYOUT
   ============================================================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--card-border);
    padding: var(--space-3);
}

.card-header h3 {
    color: var(--text-primary);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin: 0;
}

.card-body {
    background: var(--card-bg);
    padding: var(--space-4);
}

.stat-value {
    color: var(--text-primary);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.stat-label {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

.trading-window {
    color: var(--accent-blue);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    margin-top: var(--space-1);
}

/* ============================================================================
   BUTTONS - STITCH STYLE
   ============================================================================ */

.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: none;
    box-shadow: none;
    font-weight: var(--font-medium);
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-tertiary);
}

/* Delete button */
.btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================================================
   FORMS - DARK
   ============================================================================ */

.backtest-config {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

@media (max-width: 768px) {
    .backtest-config {
        grid-template-columns: 1fr;
    }
}

.backtest-config .btn-large {
    grid-column: 1 / -1;
}

.backtest-config #cacheInfo {
    grid-column: 1 / -1;
}

.backtest-config #backtestResults {
    grid-column: 1 / -1;
}

.form-group label {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-primary);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    box-shadow: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    background: var(--bg-primary);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

/* ============================================================================
   BADGES - DARK
   ============================================================================ */

.badge {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-active);
    border: 1px solid var(--status-active);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-active);
    border: 1px solid var(--status-active);
    text-transform: uppercase;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    letter-spacing: 0.05em;
}

.status-inactive {
    background: rgba(100, 116, 139, 0.2);
    color: var(--status-inactive);
    border: 1px solid var(--status-inactive);
}

/* ============================================================================
   DETAIL ITEMS - DARK
   ============================================================================ */

.detail-item {
    background: transparent;
    border: none;
    padding: 0;
}

.detail-label {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    margin-bottom: var(--space-1);
}

.detail-value {
    color: var(--text-primary);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
}

/* Date input calendar icon - make it white */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}


/* ============================================================================
   TABLE - DARK
   ============================================================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.trades-table-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.trades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.trades-table thead {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--card-border);
}

.trades-table th {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-semibold);
    padding: var(--space-3);
    text-align: left;
}

.trades-table tbody tr {
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    transition: background 0.2s;
}

.trades-table tbody tr:nth-child(even) {
    background: var(--card-bg);
}

.trades-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.trades-table td {
    color: var(--text-primary);
    font-size: var(--text-sm);
    padding: var(--space-3);
}

.trade-win {
    background: rgba(16, 185, 129, 0.05);
    border-left: 2px solid var(--status-active);
}

.trade-loss {
    background: rgba(239, 68, 68, 0.05);
    border-left: 2px solid #ef4444;
}

/* Empty state for tables */
.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: var(--space-6);
    font-size: var(--text-sm);
}

/* ============================================================================
   STATISTICS GRID - HORIZONTAL LAYOUT
   ============================================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.stat-icon {
    font-size: var(--text-2xl);
}

.stat-info {
    flex: 1;
}

.stat-info .stat-label {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    margin-bottom: var(--space-1);
}

.stat-info .stat-value {
    color: var(--text-primary);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
}

/* ============================================================================
   MODALS - DARK
   ============================================================================ */

.modal {
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

.modal-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--card-border);
}

.modal-header h3 {
    color: var(--text-primary);
}

.modal-close {
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    background: var(--card-bg);
}

.modal-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--card-border);
}

/* ============================================================================
   LOADING - DARK
   ============================================================================ */

.loading {
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    color: var(--text-secondary);
}

/* ============================================================================
   METRICS - DARK
   ============================================================================ */

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--accent-blue);
}

.metric-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.metric-label {
    color: var(--text-secondary);
}

.metric-value {
    color: var(--text-primary);
}

/* ============================================================================
   LISTS - DARK
   ============================================================================ */

.pairs-list,
.strategies-list {
    padding: 0;
    background: transparent;
}

/* ============================================================================
   CONTAINER - DARK
   ============================================================================ */

main.container {
    background: transparent;
}

/* ============================================================================
   PAIR/STRATEGY DETAILS
   ============================================================================ */

.pair-header,
.strategy-header {
    margin-bottom: var(--space-4);
}

.pair-title h3,
.strategy-title h3 {
    color: var(--text-primary);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.pair-title p,
.strategy-title p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.pair-details,
.strategy-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-4);
}