/* ============================================================
   CWC FMISC STANDALONE GIS — TABLES STYLESHEET
   Page-specific styles for CwcStations.html & AllStations.html
   Zero Inline Styles Architecture
   ============================================================ */

.table-page-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-body);
}

.table-page-container {
    padding: 1.5rem;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Page Header & Summary Section */
.page-title-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1.15rem;
}

.page-heading {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.page-subheading {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Category Tabs (Uttar Pradesh vs Other States) */
.category-tabs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface-table-head);
    padding: 0.35rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tab-btn {
    padding: 0.55rem 1.35rem;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
    background: #0284c7;
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.45);
}

/* Data Table Container Card */
.data-table-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.data-table-card:hover {
    box-shadow: var(--shadow-md);
}

.table-card-header {
    padding: 0.95rem 1.35rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

[data-theme="dark"] .table-card-header {
    background: #0c182c;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.table-card-header.header-border-hfl {
    border-left: 4px solid var(--status-hfl);
}

.table-card-header.header-border-danger {
    border-left: 4px solid var(--status-danger);
}

.table-card-header.header-border-warning {
    border-left: 4px solid var(--status-warning);
}

.table-card-header.header-border-normal {
    border-left: 4px solid var(--status-normal);
}

.table-card-title {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.table-toolbar-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.search-wrap-relative {
    position: relative;
    display: flex;
    align-items: center;
}

.table-toolbar-wrap .form-input,
.table-toolbar-wrap .form-select {
    height: 38px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    border-radius: 6px;
    padding: 0 0.85rem;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .table-toolbar-wrap .form-input,
[data-theme="dark"] .table-toolbar-wrap .form-select {
    background: #081220;
    border-color: rgba(255, 255, 255, 0.16);
    color: #f8fafc;
}

.table-toolbar-wrap .form-input::placeholder {
    color: #64748b;
    opacity: 1;
}

[data-theme="dark"] .table-toolbar-wrap .form-input::placeholder {
    color: #94a3b8;
}

.table-toolbar-wrap .form-input:focus,
.table-toolbar-wrap .form-select:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
    outline: none;
}

.table-toolbar-wrap .input-search-wide {
    width: 320px;
}

.table-toolbar-wrap .form-select {
    min-width: 190px;
    cursor: pointer;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    appearance: none;
    -webkit-appearance: none;
}

.table-meta-note {
    font-size: 0.76rem;
    font-weight: 500;
    color: #475569;
}

[data-theme="dark"] .table-meta-note {
    color: #94a3b8;
}

.th-index-col {
    width: 50px;
    text-align: center !important;
}

.table-scroll-wrap {
    width: 100%;
    overflow-x: auto;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    text-align: left;
}

.styled-table th {
    background: var(--surface-table-head);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.6px;
    padding: 0.8rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.styled-table td {
    padding: 0.8rem 1.15rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    white-space: nowrap;
}

.styled-table tbody tr {
    transition: background 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.styled-table tbody tr:nth-child(even) {
    background: var(--surface-table-alt);
}

.styled-table tbody tr:hover {
    background: var(--surface-table-hover);
    color: var(--text-primary);
}

/* Status Highlighting on Rows */
.styled-table tbody tr.row-hfl {
    background: rgba(239, 68, 68, 0.12) !important;
    border-left: 4px solid var(--status-hfl);
}

.styled-table tbody tr.row-danger {
    background: rgba(249, 115, 22, 0.1) !important;
    border-left: 4px solid var(--status-danger);
}

.styled-table tbody tr.row-warning {
    background: rgba(245, 158, 11, 0.08) !important;
    border-left: 4px solid var(--status-warning);
}

.styled-table tbody tr.row-normal {
    border-left: 4px solid var(--status-normal);
}

/* Numeric Values in Tables */
.val-numeric {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-primary);
}

.val-water-level {
    font-weight: 700;
    color: #38bdf8;
    font-variant-numeric: tabular-nums;
}

/* Table Empty & Loading States */
.table-empty-message, .table-loading-message {
    padding: 3.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.88rem;
}

/* Impact Analysis Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--surface-card);
    border: 1px solid var(--surface-panel-border);
    border-radius: 12px;
    width: 90%;
    max-width: 920px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    padding: 1rem 1.35rem;
    background: var(--surface-table-head);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-meta-row {
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-note-coords {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* Responsive Table Page */
@media (max-width: 768px) {
    .table-page-container {
        padding: 0.85rem;
    }
    .page-title-section {
        flex-direction: column;
        align-items: flex-start;
    }
    .input-search-wide {
        width: 100%;
    }
    .table-toolbar-wrap {
        width: 100%;
    }
}
