/* Grid Comparison Styles */

/* Index Value Color Coding */
.index-severe-payout {
    background-color: #dc3545 !important;
    color: white !important;
    font-weight: bold;
}

.index-payout {
    background-color: #fd7e14 !important;
    color: white !important;
}

.index-near-payout {
    background-color: #ffc107 !important;
    color: black !important;
}

.index-normal {
    background-color: #28a745 !important;
    color: white !important;
}

.index-excess {
    background-color: #17a2b8 !important;
    color: white !important;
}

/* Statistic Card Styles */
.stat-card {
    padding: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.stat-card:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #212529;
}

.stat-subvalue {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Winner Card Highlight */
.border-success {
    border-width: 3px !important;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.3);
}

/* Interval Comparison Table */
.interval-comparison-table {
    font-size: 0.875rem;
}

.interval-comparison-table thead th {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.interval-comparison-table .interval-name {
    font-weight: 600;
    white-space: nowrap;
}

/* Accordion Customization */
.accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: #0c63e4;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0,0,0,.125);
}

/* Responsive Table */
.table-responsive {
    max-height: 600px;
    overflow-y: auto;
}

/* Print Styles */
@media print {
    .btn, .accordion-button {
        display: none;
    }

    .accordion-collapse {
        display: block !important;
        height: auto !important;
    }

    .card {
        page-break-inside: avoid;
    }

    .index-severe-payout,
    .index-payout,
    .index-near-payout,
    .index-normal,
    .index-excess {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Top Grids Quick Select */
.btn-outline-secondary.w-100 {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-outline-secondary.w-100:hover {
    background-color: #6c757d;
    color: white;
}

/* Badge Styling */
.badge.bg-danger {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Tooltip Support */
[data-bs-toggle="tooltip"] {
    cursor: help;
    border-bottom: 1px dotted #6c757d;
}

/* Comparison Metrics */
.card-header.bg-primary,
.card-header.bg-info,
.card-header.bg-secondary {
    font-weight: 600;
}

/* Error Alert */
.alert-danger {
    border-left: 4px solid #dc3545;
}

/* Success Banner */
.alert-success.mb-4 {
    border-left: 4px solid #28a745;
}

.alert-info.mb-4 {
    border-left: 4px solid #17a2b8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stat-value {
        font-size: 1.25rem;
    }

    .interval-comparison-table {
        font-size: 0.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }
}

/* Smooth Transitions */
.accordion-collapse {
    transition: height 0.3s ease;
}

.btn {
    transition: all 0.2s ease;
}

/* Table Striping Enhancement */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Grid Selection Section */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Year Statistics Cards */
.card.bg-light {
    background-color: #f8f9fa !important;
}

.card.bg-light .card-title {
    color: #495057;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

/* Alignment Utilities */
.text-end {
    text-align: right !important;
}

.align-middle {
    vertical-align: middle !important;
}

/* Gap Utilities for Older Bootstrap */
.gap-2 {
    gap: 0.5rem !important;
}

.g-3 {
    gap: 1rem !important;
}

/* Grid Map Label Styles */
.grid-label {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #6c757d;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.grid-label span {
    display: block;
}

.grid-label-selected {
    background: rgba(255, 255, 255, 0.95);
    border-width: 2px;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.grid-label-blue {
    border-color: #3388ff;
    color: #3388ff;
}

.grid-label-red {
    border-color: #ff3838;
    color: #ff3838;
}

/* Optimization Panel Styles */
.optimization-panel {
    margin-bottom: 1rem;
}

.optimization-panel .card {
    transition: all 0.3s ease;
}

.optimization-panel .card.border-warning {
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.3);
}

.optimization-panel .card-body {
    max-height: 600px;
    overflow-y: auto;
}

/* Dynamic Map Height */
#comparison-map,
#multi-grid-map {
    transition: height 0.3s ease;
}

/* Full viewport height map on larger screens */
@media (min-width: 992px) {
    .map-fullheight {
        height: calc(100vh - 200px) !important;
        min-height: 500px;
    }
}

/* Compact optimization results */
.optimization-panel .table-sm th,
.optimization-panel .table-sm td {
    padding: 0.4rem 0.5rem;
    font-size: 0.875rem;
}

.optimization-panel .sticky-top {
    background-color: #f8f9fa;
    z-index: 5;
}

/* Responsive optimization panel */
@media (max-width: 768px) {
    .optimization-panel .card-body {
        max-height: 400px;
    }

    .optimization-panel .row .col-md-3 {
        margin-bottom: 0.5rem;
    }
}
