/**
 * ═══════════════════════════════════════════════════════════════════════════
 * ESTILS PER AL SISTEMA D'INFORMES - PROJECTE AIGUA
 * ═══════════════════════════════════════════════════════════════════════════
 * 
 * Estils específics per al sidebar d'informes i tots els seus components
 * 
 * @author Projecte Aigua
 * @date Febrer 2026
 * @version 2.0.0
 */

/* ═══════════════════════════════════════════════════════════════════════════
   TAB NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */

.report-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
}

.report-tab {
    flex: 1;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.report-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.report-tab.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTROL BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.report-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.report-control-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    color: #6ee7b7;
    cursor: pointer;
    transition: all 0.2s;
}

.report-control-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.report-control-btn:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CATEGORY HEADERS
   ═══════════════════════════════════════════════════════════════════════════ */

.report-category-header {
    margin: 20px 0 12px 0;
    padding: 8px 12px;
    background: rgba(37, 99, 235, 0.1);
    border-left: 3px solid #2563eb;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    color: white;
}

.report-category-header:first-of-type {
    margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATISTICS TABLE
   ═══════════════════════════════════════════════════════════════════════════ */

.stats-table {
    width: 100%;
    font-size: 10px;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
}

.stats-table thead th {
    padding: 8px 6px;
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-table thead th:first-child {
    text-align: left;
    padding-left: 12px;
}

.stats-table tbody td {
    padding: 8px 6px;
    text-align: right;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-table tbody td:first-child {
    text-align: left;
    padding-left: 12px;
    font-weight: 600;
    color: white;
}

.stats-table tbody tr:last-child td {
    border-bottom: none;
}

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

.stats-table .alert-count {
    color: #fca5a5;
    font-weight: 700;
}

.stats-table .highlight-value {
    color: #60a5fa;
    font-weight: 600;
}

.stats-table .variable-icon {
    margin-right: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERT BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

.alert-banner {
    padding: 12px;
    margin-bottom: 16px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid #ef4444;
    border-radius: 6px;
}

.alert-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #fca5a5;
}

.alert-banner-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASIN TABS
   ═══════════════════════════════════════════════════════════════════════════ */

.basin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.basin-tab {
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
}

.basin-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.basin-tab.active {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(37, 99, 235, 0.5);
    color: #60a5fa;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════════════════════ */

#report-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
}

.report-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.report-loading-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */

#report-content {
    overflow-y: auto;
}

#report-content::-webkit-scrollbar {
    width: 6px;
}

#report-content::-webkit-scrollbar-track {
    background: transparent;
}

#report-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.report-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIST VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.report-list-section {
    margin-bottom: 24px;
}

.report-list-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-list-table {
    width: 100%;
    font-size: 11px;
    border-collapse: separate;
    border-spacing: 0 2px;
}

.report-list-row {
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
    cursor: pointer;
}

.report-list-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.report-list-row.has-alert {
    background: rgba(239, 68, 68, 0.1);
}

.report-list-table td {
    padding: 6px 8px;
    color: rgba(255, 255, 255, 0.9);
}

.report-list-table td:first-child {
    border-radius: 4px 0 0 4px;
}

.report-list-table td:last-child {
    border-radius: 0 4px 4px 0;
}

.report-value {
    font-weight: 600;
    color: #60a5fa !important;
    white-space: nowrap;
}

.report-station {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASIN VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.basin-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
}

.basin-stat {
    text-align: center;
}

.basin-stat-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.basin-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #60a5fa;
}

.basin-reservoirs-table {
    width: 100%;
    font-size: 11px;
    border-collapse: separate;
    border-spacing: 0 2px;
}

.basin-reservoirs-table thead th {
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.basin-reservoirs-table tbody tr {
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.2s;
}

.basin-reservoirs-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

.basin-reservoirs-table td {
    padding: 8px;
    color: rgba(255, 255, 255, 0.9);
}

/* Sub-basins */
.basin-subconques-list {
    margin: 12px 0 16px 0;
    padding: 12px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

.basin-subconques-title {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.basin-subconca-item {
    padding: 6px 8px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background 0.2s;
}

.basin-subconca-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Basin sections */
.basin-section {
    margin: 20px 0;
}

.basin-section-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

/* Sortable tables */
.basin-sortable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.basin-sortable-table thead {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.15) 100%);
}

.basin-sortable-table th {
    padding: 10px 8px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    position: relative;
}

.basin-sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.basin-sortable-table th.sortable:hover {
    background: rgba(59, 130, 246, 0.2);
}

.basin-sortable-table .sort-indicator {
    display: inline-flex;
    flex-direction: column;
    margin-left: 4px;
    font-size: 8px;
    line-height: 1;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.basin-sortable-table th.sortable:hover .sort-indicator {
    opacity: 0.6;
}

.basin-sortable-table th.sorted .sort-indicator {
    opacity: 1;
}

.basin-sortable-table .sort-indicator .sort-asc,
.basin-sortable-table .sort-indicator .sort-desc {
    display: block;
    color: rgba(255, 255, 255, 0.5);
}

.basin-sortable-table th.sorted.asc .sort-indicator .sort-asc {
    color: #60a5fa;
}

.basin-sortable-table th.sorted.desc .sort-indicator .sort-desc {
    color: #60a5fa;
}

.basin-sortable-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.basin-sortable-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.1);
    cursor: pointer;
}

.basin-sortable-table tbody tr.has-alert {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

.basin-sortable-table td {
    padding: 8px;
    color: rgba(255, 255, 255, 0.9);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .report-controls {
        flex-direction: column;
    }

    .report-control-btn {
        width: 100%;
    }

    .stats-table {
        font-size: 9px;
    }

    .stats-table thead th {
        font-size: 8px;
        padding: 6px 4px;
    }

    .stats-table tbody td {
        padding: 6px 4px;
    }

    .stats-table thead th:first-child,
    .stats-table tbody td:first-child {
        padding-left: 8px;
    }

    .basin-summary {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.clickable {
    cursor: pointer !important;
}

.clickable:hover {
    opacity: 0.8;
}