/* ΘDTE Toolbox - Excel Format Dashboard v2 */

:root {
    /* Brand Colors */
    --dark-navy: #0B1E2D;
    --electric-blue: #007BFF;
    --vibrant-orange: #FF6B00;
    --light-gray: #E8E8E8;
    --medium-gray: #666666;
    
    /* UI Colors */
    --bg-primary: #0D1B2A;
    --bg-secondary: #1B263B;
    --bg-tertiary: #415A77;
    --text-primary: #E0E1DD;
    --text-secondary: #778DA9;
    
    /* Table Colors */
    --call-color: #DC3545;
    --put-color: #28A745;
    --atm-color: #FFC107;
    --border-color: #2D3748;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.brand h1 {
    font-size: 2rem;
    color: var(--electric-blue);
    margin-bottom: 5px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.controls label {
    font-weight: 600;
    color: var(--text-secondary);
}

select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

select:hover {
    border-color: var(--electric-blue);
}

select:focus {
    outline: none;
    border-color: var(--electric-blue);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Info Bar */
.info-bar {
    display: flex;
    gap: 20px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.info-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-value {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.status-indicator {
    font-size: 1.2rem;
}

.status-indicator.connecting {
    color: var(--vibrant-orange);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.connected {
    color: var(--put-color);
}

.status-indicator.error {
    color: var(--call-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Table Container */
.table-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    max-height: calc(100vh - 280px);
    display: flex;
    flex-direction: column;
}

/* Table Wrapper - handles scrolling */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
}

/* Table */
.options-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.options-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-tertiary);
}

.options-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
}

.options-table th {
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.section-header {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.volume-header {
    background: linear-gradient(135deg, var(--call-color) 0%, var(--put-color) 100%);
}

.oi-header {
    background: linear-gradient(135deg, #4A90E2 0%, #50E3C2 100%);
}

.exposure-header {
    background: linear-gradient(135deg, var(--electric-blue) 0%, var(--vibrant-orange) 100%);
}

.strike-header {
    background: var(--dark-navy) !important;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
}

.strike-header:hover {
    background: var(--electric-blue) !important;
}

.options-table tbody tr {
    transition: background-color 0.2s;
}

.options-table tbody tr:hover {
    background: rgba(0, 123, 255, 0.1);
}

.options-table td {
    padding: 6px 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

/* Bar chart cells */
.bar-cell {
    position: relative;
    padding: 4px 6px !important;
    min-width: 80px;
}

.bar-background {
    position: absolute;
    top: 0;
    height: 100%;
    opacity: 0.6;
    transition: width 0.3s ease, opacity 0.2s;
}

.bar-cell:hover .bar-background {
    opacity: 0.8;
}

.bar-value {
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* Bar directions */
/* Call bars: RED, Right to Left, solid red gradient */
.bar-call .bar-background {
    right: 0;
    background: linear-gradient(to left, #dc2626 0%, #ef4444 50%, rgba(220, 38, 38, 0.3) 100%);
}

.bar-call .bar-value {
    color: #dc2626 !important;
    font-weight: 600;
}

/* Put bars: GREEN, Left to Right, solid green gradient */
.bar-put .bar-background {
    left: 0;
    background: linear-gradient(to right, #059669 0%, #10b981 50%, rgba(5, 150, 105, 0.3) 100%);
}

.bar-put .bar-value {
    color: #059669 !important;
    font-weight: 600;
}

/* Total bars: Left to Right, purple */
.bar-total .bar-background {
    left: 0;
    background: linear-gradient(90deg, #8b5cf6, rgba(139, 92, 246, 0.1));
}

.bar-total .bar-value {
    color: #8b5cf6;
}

/* Exposure bars from center */
.bar-positive .bar-background {
    left: 50%;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), #10b981);
}

.bar-positive .bar-value {
    color: #10b981;
}

.bar-negative .bar-background {
    right: 50%;
    background: linear-gradient(270deg, rgba(239, 68, 68, 0.1), #ef4444);
}

.bar-negative .bar-value {
    color: #ef4444;
}

.bar-neutral .bar-background {
    left: 0;
    background: linear-gradient(90deg, transparent, #60a5fa);
}

.strike-cell {
    font-weight: 700;
    background: var(--bg-tertiary);
    font-size: 1rem;
}

.atm-row {
    background: rgba(255, 193, 7, 0.15);
}

.atm-row .strike-cell {
    background: var(--atm-color);
    color: var(--dark-navy);
}

.call-col {
    color: var(--call-color);
    font-weight: 600;
}

.put-col {
    color: var(--put-color);
    font-weight: 600;
}

.total-col {
    color: var(--electric-blue);
    font-weight: 700;
}

.exposure-col {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

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

.empty-state-message {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.empty-state-hint {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--electric-blue);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--electric-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Ranking Colored Boxes */
.rank-1 {
    background: rgba(220, 38, 38, 0.35) !important;
    border: 2px solid rgba(220, 38, 38, 1) !important;
    font-weight: 700 !important;
}

.rank-2 {
    background: rgba(255, 107, 0, 0.35) !important;
    border: 2px solid rgba(255, 107, 0, 1) !important;
    font-weight: 600 !important;
}

.rank-3 {
    background: rgba(255, 193, 7, 0.35) !important;
    border: 2px solid rgba(255, 193, 7, 1) !important;
    font-weight: 600 !important;
}

/* Responsive */
@media (max-width: 1600px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }
}

@media (max-width: 1200px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .info-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .options-table {
        font-size: 0.85rem;
    }
    
    .bar-cell {
        min-width: 70px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 5px;
    }
    
    .header {
        padding: 15px;
    }
    
    .brand h1 {
        font-size: 1.5rem;
    }
    
    .info-bar {
        padding: 10px;
        gap: 8px;
        font-size: 0.85rem;
    }
    
    .options-table {
        font-size: 0.75rem;
    }
    
    .options-table th {
        padding: 6px 4px;
        font-size: 0.75rem;
    }
    
    .options-table td {
        padding: 4px 3px;
    }
    
    .bar-cell {
        min-width: 60px;
        padding: 3px 4px !important;
    }
    
    .strike-cell {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .brand h1 {
        font-size: 1.2rem;
    }
    
    .tagline {
        font-size: 0.75rem;
    }
    
    .controls {
        width: 100%;
    }
    
    .controls select {
        font-size: 0.85rem;
        padding: 6px 8px;
    }
    
    .info-bar {
        font-size: 0.75rem;
    }
    
    .options-table {
        font-size: 0.7rem;
    }
    
    .bar-cell {
        min-width: 50px;
    }
}
