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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #1a1f2e;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background-color: #252b3d;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3a4155;
}

.nav-brand a {
    color: #4dabf7;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-links a {
    color: #a0a0a0;
    text-decoration: none;
    margin-left: 1.5rem;
}

.nav-links a:hover {
    color: #4dabf7;
}

/* Main container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #fff;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: #4dabf7;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.date-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-picker label {
    color: #888;
    font-size: 0.875rem;
}

.date-picker select {
    background-color: #2d3548;
    color: #fff;
    border: 1px solid #3a4155;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
}

.date-picker select:focus {
    outline: none;
    border-color: #4dabf7;
}

/* Instrument grid */
.instrument-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.instrument-card {
    background-color: #252b3d;
    border: 1px solid #3a4155;
    border-radius: 8px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.instrument-card:hover {
    border-color: #4dabf7;
    transform: translateY(-2px);
}

.instrument-symbol {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

.instrument-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4dabf7;
    margin-bottom: 0.5rem;
}

.instrument-bid-ask {
    font-size: 0.75rem;
    color: #888;
    display: flex;
    justify-content: space-between;
}

/* Instrument info */
.instrument-info {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #252b3d;
    border-radius: 8px;
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
}

.info-item .value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

/* Chart controls wrapper */
.chart-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tenor tabs */
.tenor-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background-color: #252b3d;
    padding: 0.25rem;
    border-radius: 8px;
    width: fit-content;
}

.chart-controls .tenor-tabs,
.chart-controls .range-selector,
.chart-controls .timeframe-selector {
    margin-bottom: 0;
}

.tenor-tab {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: #888;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tenor-tab:hover {
    color: #fff;
    background-color: #3a4155;
}

.tenor-tab.active {
    background-color: #4dabf7;
    color: #fff;
}

/* Options actions */
.options-actions {
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary {
    background-color: #3a4155;
    color: #fff;
    border: 1px solid #4a5169;
}

.btn-secondary:hover {
    background-color: #4a5169;
}

/* Options table */
.options-table-container {
    overflow-x: auto;
}

.options-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #252b3d;
    border-radius: 8px;
    overflow: hidden;
}

.options-table thead {
    background-color: #2d3548;
}

.options-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
}

.options-table td {
    padding: 0.75rem 1rem;
    border-top: 1px solid #3a4155;
    font-size: 0.875rem;
}

.put-header {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.call-header {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.strike-header {
    text-align: center;
    background-color: #3a4155;
    color: #fff;
}

.put-col {
    background-color: rgba(239, 68, 68, 0.05);
}

.call-col {
    background-color: rgba(34, 197, 94, 0.05);
}

.strike-col {
    text-align: center;
    background-color: #2d3548;
    color: #fff;
}

.no-data {
    text-align: center;
    color: #888;
    padding: 2rem;
}

/* Range / Timeframe selector */
.range-selector,
.timeframe-selector {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background-color: #252b3d;
    padding: 0.25rem;
    border-radius: 8px;
    width: fit-content;
}

.range-btn,
.tf-btn {
    padding: 0.5rem 1rem;
    color: #888;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.range-btn:hover,
.tf-btn:hover {
    color: #fff;
    background-color: #3a4155;
}

.range-btn.active,
.tf-btn.active {
    background-color: #4dabf7;
    color: #fff;
}

/* Wide layout for chart page */
.page-chart .container {
    max-width: none;
    margin: 0;
    padding: 2rem;
}

/* Price chart */
.price-chart-container {
    background-color: #252b3d;
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    min-height: 500px;
}

.price-chart-container #price-chart {
    width: 100%;
    height: 500px;
}

.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    color: #888;
    font-size: 0.875rem;
    z-index: 10;
    background-color: rgba(37, 43, 61, 0.85);
    border-radius: 8px;
}

.chart-error {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
    font-size: 0.875rem;
}

/* Chart (volatility) */
.chart-container {
    background-color: #252b3d;
    border-radius: 8px;
    padding: 1.5rem;
    height: 400px;
}

.chart-legend {
    margin-top: 1rem;
    color: #888;
    font-size: 0.875rem;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: #666;
    font-size: 0.75rem;
    border-top: 1px solid #3a4155;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .instrument-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .instrument-info {
        gap: 1rem;
    }

    .tenor-tabs {
        flex-wrap: wrap;
    }

    .options-table {
        font-size: 0.75rem;
    }

    .options-table th,
    .options-table td {
        padding: 0.5rem;
    }
}
