/* Rivers Project - Home Page (Dashboard) Styles */
/* River table, favorites, drag-and-drop, skeleton loaders */

.table-container {
    margin-top: 20px;
    overflow-x: auto;
}

.monitoring-info {
    margin-top: 15px;
    font-size: 14px;
    color: #7f8c8d;
    text-align: center;
}

.river-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.river-table thead {
    background: #34495e;
    color: white;
}

.river-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.river-table th:last-child {
    width: 40px;
    text-align: center;
}

.river-row {
    border-bottom: 1px solid #e1e8ed;
    cursor: pointer;
    transition: background 0.2s;
}

.river-row:hover {
    background: #f8f9fa;
}

.river-table td {
    padding: 12px;
    vertical-align: middle;
}

/* River Name Column */
.river-name {
    min-width: 200px;
}

.river-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
}

.river-link:hover {
    text-decoration: underline;
}

.river-meta-row {
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.difficulty-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #3498db;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.site-code-inline {
    color: #95a5a6;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.site-code-inline.no-gauge {
    font-style: italic;
}

.site-code {
    color: #95a5a6;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    margin-top: 3px;
}

.aw-flow-link {
    color: #3498db;
    text-decoration: none;
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    transition: color 0.2s;
}

.aw-flow-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Current Level Column */
.river-level {
    min-width: 150px;
    font-weight: 600;
    position: relative;
    padding-right: 26px;
}

.river-level .value {
    font-size: 20px;
    margin-right: 5px;
}

.river-level .unit {
    font-size: 13px;
    color: #7f8c8d;
    font-weight: 400;
}

.advisory-range-hint {
    font-size: 11px;
    color: #7f8c8d;
    font-weight: 400;
    margin-top: 3px;
}

.no-data {
    color: #95a5a6;
    font-style: italic;
}

/* Level Status Color Coding */
.level-status-good {
    background: #d4edda;
    color: #155724;
}

.level-status-low {
    background: #fff3cd;
    color: #856404;
}

.level-status-high {
    background: #f8d7da;
    color: #721c24;
}

.level-status-unknown {
    background: transparent;
}

/* Difficulty Class Column */
.difficulty-class {
    min-width: 60px;
    text-align: center;
}

.difficulty-class .difficulty-badge {
    background: #3498db;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
}

.difficulty-class .no-data {
    color: #95a5a6;
}

/* Status indicator in meta row */
.river-meta-row .status-indicator {
    margin-right: 4px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid transparent;
}

.river-level .status-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
}

.status-active {
    background: #27ae60;
    box-shadow: 0 0 4px rgba(39, 174, 96, 0.5);
}

.status-inactive {
    background: #95a5a6;
    border-color: #7f8c8d;
}

.status-unknown {
    background: #e0e0e0;
    border-color: #bdc3c7;
}

/* Last Updated Column */
.last-updated {
    color: #7f8c8d;
    font-size: 13px;
    min-width: 150px;
}

/* Expand Icon Column */
.expand-icon {
    text-align: center;
    color: #95a5a6;
    font-size: 12px;
}

.expand-indicator {
    transition: transform 0.2s;
    display: inline-block;
}

.river-row.expanded .expand-indicator {
    transform: rotate(90deg);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.empty-state h3 {
    color: #7f8c8d;
    margin-bottom: 10px;
}

.empty-state p {
    color: #95a5a6;
    margin: 10px 0;
}

.empty-state pre {
    display: inline-block;
    text-align: left;
    margin-top: 15px;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-container {
        margin-left: -15px;
        margin-right: -15px;
        overflow-x: visible;
        width: calc(100% + 30px);
    }

    .river-table {
        font-size: 13px;
        border-radius: 0;
        table-layout: auto;
    }

    .river-table th,
    .river-table td {
        padding: 8px 6px;
    }

    /* Remove min-width constraints on mobile */
    .river-name {
        min-width: unset;
        width: auto;
    }

    .river-level {
        min-width: unset;
        width: auto;
    }

    .difficulty-class {
        min-width: unset;
        width: auto;
    }

    .last-updated {
        min-width: unset;
        width: auto;
        font-size: 11px;
    }

    .advisory-range-hint {
        display: none;
    }

    /* Make chart rows full-width on mobile */
    .chart-row td {
        padding: 0 !important;
    }

    .chart-container {
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 15px 10px;
        height: 300px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .chart-container canvas {
        max-width: 100% !important;
        width: 100% !important;
    }

    .chart-info {
        text-align: left;
        padding: 0 15px 15px 15px;
        font-size: 11px;
    }

    .chart-info p {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .aw-link-inline {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* Loading Skeleton Styles */
.skeleton-row {
    border-bottom: 1px solid #e1e8ed;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-text {
    height: 14px;
    margin: 4px 0;
}

.skeleton-river-name {
    width: 70%;
    height: 16px;
}

.skeleton-site-code {
    width: 40%;
    height: 12px;
    margin-top: 6px;
}

.skeleton-level {
    width: 60%;
    height: 18px;
}

.skeleton-range {
    width: 80%;
    height: 11px;
    margin-top: 6px;
}

.skeleton-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin: 0 auto;
}

.skeleton-timestamp {
    width: 90%;
    height: 13px;
}

.skeleton-icon {
    width: 12px;
    height: 12px;
    margin: 0 auto;
}

/* Hide skeleton rows once data loads */
.skeleton-row.hidden {
    display: none;
}

/* Utility class for hiding elements (CSP-compliant alternative to inline style) */
.hidden {
    display: none !important;
}

/* Chart rows should display as table-row when shown */
tr.chart-row:not(.hidden) {
    display: table-row;
}

/* Explicit visibility class for chart rows loaded via HTMX */
tr.chart-visible {
    display: table-row !important;
}

/* State header row styling */
.state-header-row {
    background-color: #2c3e50;
    color: white;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
}

.state-header-row:hover {
    background-color: #34495e;
}

.state-header-row td {
    padding: 12px;
}

.state-chevron {
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.3s ease;
    font-size: 12px;
}

/* Star column styling */
.star-column {
    width: 40px;
    text-align: center;
    padding: 8px 12px;
}

.star-btn {
    background: none;
    border: none;
    cursor: pointer !important;
    font-size: 20px;
    padding: 4px;
    transition: transform 0.2s;
}

.star-btn:hover:not(:disabled) {
    transform: scale(1.2);
}

.star-btn:not(:disabled) {
    cursor: pointer;
}

.star-icon {
    display: inline-block;
}

.star-icon.favorited {
    color: #f39c12;  /* Yellow for favorited */
}

.star-icon:not(.favorited) {
    color: #dfe6e9;  /* Light gray for unfavorited */
}

.star-icon.disabled {
    color: #bdc3c7;
    cursor: not-allowed;
}

.star-btn.max-reached {
    opacity: 0.5;
    cursor: not-allowed;
}

.star-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* State star button styling */
.state-star-btn {
    background: none;
    border: none;
    cursor: pointer !important;
    font-size: 18px;
    padding: 4px 8px;
    margin-right: 8px;
    transition: transform 0.2s;
    vertical-align: middle;
}

.state-star-btn:hover:not(.max-reached) {
    transform: scale(1.2);
}

.state-star-icon {
    display: inline-block;
}

.state-star-icon.favorited {
    color: #f39c12;  /* Yellow for favorited */
}

.state-star-icon:not(.favorited) {
    color: #dfe6e9;  /* Light gray for unfavorited */
}

.state-star-icon.disabled {
    color: #bdc3c7;
    cursor: not-allowed;
}

.state-star-btn.max-reached {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Favorites header styling */
.favorites-header {
    background-color: #f39c12 !important;
    color: white;
}

.favorites-header:hover {
    background-color: #e67e22 !important;
}

.drag-hint {
    font-size: 11px;
    font-weight: normal;
    color: #fff;
    opacity: 0.8;
    margin-left: 10px;
}

/* Drag-and-drop states */
.favorite-row.draggable {
    cursor: move;
}

.favorite-row.dragging {
    opacity: 0.5;
    background: #ecf0f1;
}

.favorite-row.drag-over {
    border-top: 3px solid #3498db;
}

.state-chevron.collapsed {
    transform: rotate(-90deg);
}

.state-count {
    font-weight: normal;
    font-size: 13px;
    color: #bdc3c7;
    margin-left: 8px;
}

/* Chart container styling for expanded rows */
.chart-container {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    height: 400px;
    margin: 10px 0;
}

.chart-info {
    margin-top: 10px;
    font-size: 13px;
    color: #95a5a6;
    text-align: center;
}

.chart-info p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.no-chart-data {
    padding: 40px;
    text-align: center;
    color: #7f8c8d;
}

.aw-link-container {
    text-align: center;
    margin-top: 15px;
}

.aw-link-compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1.5px solid #3498db;
    color: #3498db;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.aw-link-compact:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.aw-link-compact svg {
    flex-shrink: 0;
}

.aw-link-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1.5px solid #3498db;
    color: #3498db;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.aw-link-inline:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.aw-link-inline svg {
    flex-shrink: 0;
}
