/* ========================================
   BASE STYLES (Desktop First - ≥1024px)
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 20px;
}

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

/* ========================================
   HEADER - DESKTOP
   ======================================== */
.header {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.spy-info {
    display: flex;
    align-items: center;
}

.spy-price {
    font-size: 32px;
    font-weight: bold;
    color: #00ff88;
    display: inline-block;
    margin-right: 15px;
}

.price-change {
    font-size: 18px;
    font-weight: bold;
    display: inline-block;
    padding: 5px 12px;
    border-radius: 5px;
}

.price-change.positive {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.15);
}

.price-change.negative {
    color: #ff0064;
    background: rgba(255, 0, 100, 0.15);
}

.range-info {
    text-align: right;
}

.range-info div {
    margin: 5px 0;
    font-size: 14px;
}

.range-value {
    color: #00d4ff;
    font-weight: bold;
}

/* ========================================
   STATUS BANNER - DESKTOP
   ======================================== */
.status {
    display: inline-block;
    padding: 5px 15px;
    background: transparent;
    border: 2px solid;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
}

@keyframes pulse-error {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 rgba(255, 0, 0, 0.4);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
    }
}

.status.disconnected {
    color: #ff0000;
    border-color: #ff0000;
    background: rgba(255, 0, 0, 0.1);
    animation: pulse-error 1.5s infinite;
}

.status.market-closed {
    color: #ffa500;
    border-color: #ffa500;
    background: rgba(255, 165, 0, 0.1);
}

.status.connected {
    color: #00ff88;
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.status.data-paused {
    color: #ffd700;
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

/* ========================================
   TIME CLOCKS - DESKTOP
   ======================================== */
.time-clocks {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.clock-card {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
    border: 2px solid #2a2a4e;
    border-radius: 8px;
    padding: 15px 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 180px;
    text-align: center;
}

.clock-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.clock-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    font-weight: bold;
}

.clock-time {
    font-size: 24px;
    font-weight: bold;
    color: #00d4ff;
    font-family: 'Courier New', monospace;
}

.countdown-card {
    animation: pulse-countdown 3s ease-in-out infinite;
}

.countdown {
    color: #00ff88;
}

@keyframes pulse-countdown {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow: 0 4px 16px rgba(0, 212, 255, 0.4);
    }
}

.market-open {
    border-color: #00ff88 !important;
}

.market-open .clock-time {
    color: #00ff88 !important;
}

.market-closed {
    border-color: #00d4ff !important;
}

.market-closed .clock-time {
    color: #ff0064 !important;
}

.market-premarket {
    border-color: #ffa500 !important;
}

.market-premarket .clock-time {
    color: #ffa500 !important;
}

/* Language-enabled clocks */
.clock-lang {
    cursor: pointer;
    user-select: none;
}

.clock-lang.active {
    border-color: #69788d !important;
    box-shadow: 0 0 20px rgba(105, 120, 141, 0.5);
}

.clock-lang.active .clock-label {
    color: #00d4ff;
}

/* ========================================
   MAIN GRID & PANELS - DESKTOP
   ======================================== */
.main-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-title {
    font-size: 18px;
    margin-bottom: 15px;
    color: #00d4ff;
    border-bottom: 2px solid #00d4ff;
    padding-bottom: 10px;
    text-align: center;
}

/* ========================================
   CHART - DESKTOP
   ======================================== */
.chart-panel {
    margin-top: 0;
}

#flowChart {
    width: 100%;
    height: 350px;
    border-radius: 5px;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
    font-size: 13px;
}

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

.legend-item div {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-item .calls-color {
    background: #00ff88;
}

.legend-item .puts-color {
    background: #ff4444;
}

.legend-item .spy-color {
    background: #ffd700;
}

#netflow-pulse.bullish {
    background: radial-gradient(circle at 30% 50%, rgba(0, 255, 136, 0.15), transparent 70%);
}

#netflow-pulse.bearish {
    background: radial-gradient(circle at 30% 50%, rgba(255, 68, 68, 0.15), transparent 70%);
}

#netflow-pulse.neutral {
    background: radial-gradient(circle at 30% 50%, rgba(128, 128, 128, 0.1), transparent 70%);
}

/* ========================================
   ALERTS GRID - DESKTOP (2 COLUMNS)
   ======================================== */
.alerts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.alerts-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-card {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
    border: 2px solid #2a2a4e;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.alert-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.alert-line-1 {
    font-size: 15px;
    font-weight: bold;
    text-align: left;
}

.alert-line-2 {
    font-size: 13px;
    color: #ccc;
    text-align: left;
}

.alert-line-3 {
    font-size: 11px;
    color: #888;
    text-align: right;
}

.severity-high {
    color: #ff0064;
    font-weight: bold;
}

.severity-med {
    color: #ffa500;
}

.severity-low {
    color: #00d4ff;
}

/* ========================================
   OPTIONS TABLE - DESKTOP
   ======================================== */
.options-table {
    width: 100%;
    border-collapse: collapse;
}

.options-table th {
    background: rgba(0, 212, 255, 0.1);
    padding: 12px 8px;
    text-align: center;
    font-size: 11px;
    color: #00d4ff;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.options-table td {
    padding: 15px 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    text-align: center;
}

.options-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.strike-cell {
    font-weight: bold;
    font-size: 16px;
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
}

.atm-row {
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid #00ff88 !important;
}

.atm-row .strike-cell {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    font-size: 18px;
}

.call-section {
    background: rgba(0, 255, 136, 0.05);
}

.put-section {
    background: rgba(255, 100, 100, 0.05);
}

.volume-bar-container {
    display: flex;
    gap: 3px;
    align-items: center;
    height: 30px;
}

.volume-bar {
    height: 100%;
    border-radius: 3px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #000;
}

.bid-bar {
    background: linear-gradient(90deg, #00ff88, #00d4ff);
}

.ask-bar {
    background: linear-gradient(90deg, #ff6b9d, #ff0064);
}

.bid-volume {
    color: #00ff88;
}

.ask-volume {
    color: #ff6b9d;
}

.anomaly {
    background: rgba(255, 0, 100, 0.2) !important;
    border-left: 4px solid #ff0064;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    100% {
        background: rgba(255, 0, 100, 0.2);
    }

    50% {
        background: rgba(255, 0, 100, 0.4);
    }
}

.alert-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #ff0064;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 10px;
}

.price-positive {
    color: #00ff88;
}

.price-negative {
    color: #ff0064;
}

/* ========================================
   TABLET (768px - 1023px) - Reducciones
   ======================================== */
@media (min-width: 768px) and (max-width: 1023px) {

    /* Header */
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .range-info {
        text-align: center;
    }

    .spy-price {
        font-size: 28px;
    }

    /* Chart */
    #flowChart {
        height: 250px;
    }

    /* Alerts - DOS COLUMNAS (fix) */
    .alerts-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 15px;
        min-height: 200px;
    }

    .calls-column,
    .puts-column {
        display: flex !important;
        flex-direction: column;
        gap: 10px;
    }

    .alert-card {
        display: block !important;
        width: 100%;
    }

    /* Table - ajustes */
    .options-table th,
    .options-table td {
        padding: 8px 4px;
    }
}

/* ========================================
   MOBILE (<768px) - Reducciones máximas
   ======================================== */
@media (max-width: 767px) {
    body {
        padding: 10px;
    }

    /* Header */
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .range-info {
        text-align: center;
    }

    .spy-price {
        font-size: 24px;
        margin-right: 10px;
    }

    .price-change {
        font-size: 14px;
    }

    /* Panel */
    .panel {
        padding: 12px;
    }

    .panel-title {
        font-size: 14px;
    }

    /* Chart */
    #flowChart {
        height: 200px;
    }

    .chart-legend {
        flex-direction: column;
        gap: 10px;
    }

    /* Alerts - UNA columna en móvil */
    .alerts-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .alert-card {
        padding: 10px;
    }

    .alert-line-1 {
        font-size: 14px;
    }

    .alert-line-2 {
        font-size: 12px;
    }

    /* Table */
    .options-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}