/* =====================================================
   1. GLOBAL / BASE
===================================================== */
html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.container-fluid {
    padding: 0;
    margin-top: 70px; /* header offset */
}

.table {
    border: none;
}

.table th,
.table td {
    border: none;
    padding: 0 !important;
}

/* =====================================================
   2. HEADER / NAVBAR
===================================================== */
.map-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.logo-section img {
    height: 40px;
}

.logo-section h5 {
    margin: 0;
    font-weight: 700;
}

.header-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-buttons .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1.2rem;
}

/* =====================================================
   3. MAP
===================================================== */
#map {
    height: calc(100svh - 70px);
    width: 100%;
}

/* =====================================================
   4. LEAFLET MARKERS
===================================================== */
.map-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.leaflet-marker-icon {
    display: grid !important;
    place-items: center;
}

.map-marker:hover {
    width: 50px;
    height: 50px;
    font-size: 22px;
    transform: scale(1.1);
}

.map-marker.complete-data {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.map-marker.incomplete-data {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.map-marker.no-data {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
}

/* =====================================================
   5. LEAFLET POPUP (FIXED LAYOUT)
===================================================== */
.leaflet-popup {
    z-index: 1000;
}

.site-popup-wrapper {
    z-index: 1001 !important;
}

.leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: 12px;
    background: transparent !important;
    box-shadow: none !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
}

.leaflet-popup-close-button {
    color: rgb(237, 233, 233) !important;
    top: 4px !important;
    right: 4px !important;
}
.leaflet-popup-close-button:hover {
    color: white !important;
}
.leaflet-popup-tip {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* =====================================================
   6. SITE POPUP CARD
===================================================== */
.site-popup {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    min-width: 250px;
}

.site-popup .popup-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px;
    font-weight: bold;
}

.site-popup .popup-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 12px;
}

.popup-content .item-label {
    font-weight: bold;
}

.site-popup .data-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.site-popup .data-row:last-child {
    border-bottom: none;
}

/* =====================================================
   7. WATER ANIMATIONS
===================================================== */
.water-flow,
.site-popup .water-flow-mini {
    background: linear-gradient(180deg, #4a90e2, #2c5aa0);
    overflow: hidden;
    position: relative;
}

.water-flow {
    height: 150px;
    border-bottom: 3px solid #1a3a5c;
}

.water-wave {
    width: 200%;
    height: 100%;
    background-size: 600px 120px;
    animation: wave 10s linear infinite;
}

@keyframes wave {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(600px);
    }
}

/* =====================================================
   8. CANVAS / LAYOUT EDITOR
===================================================== */
#siteCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.canvas-legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 8px;
}

/* =====================================================
   9. TABLES & DATA BLOCKS
===================================================== */
.table .data-item {
    border: 1px solid silver;
    padding: 4px 8px;
    display: flex;
    align-items: center;
}

.table .data-item span:first-child {
    font-weight: 700;
    margin-right: 10px;
}

.btn-gates {
    padding: 2px 4px !important;
    font-size: 10px;
}

/* =====================================================
   10. MODALS
===================================================== */
.modal {
    z-index: 9999 !important;
}

.modal-backdrop {
    z-index: 9998 !important;
}

.custom-modal-body {
    padding: 0 !important;
}

.custom-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    height: 30px !important;
    padding: 0.125rem !important;
    font-size: 16px !important;
}

.modal-header-gate {
    background: linear-gradient(135deg, #18783e, #764ba2) !important;
    color: white !important;
}

.modal-header-sub-site {
    background: linear-gradient(135deg, #18783e, #764ba2) !important;
}

.btn-close {
    margin: unset !important;
    width: 0.5rem !important;
    height: 0.5rem !important;
    background: transparent
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e")
        center/1em auto no-repeat !important;
}

/* =====================================================
   11. RESPONSIVE
===================================================== */
@media (max-width: 768px) {
    .header-buttons {
        flex-direction: column;
        width: 100%;
    }

    .site-popup .popup-content {
        flex-direction: column;
    }
}

.container {
    display: flex;
    width: 100%;
}

.canvas {
    width: 1050px;
    flex-shrink: 0;
}

.site-content {
    flex: 1;
    max-height: calc(100vh - 100px);
}
.tab-content {
    max-height: calc(100vh - 100px);
    overflow-y: scroll;
}

.gate-details-panel {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-top: 3px solid #667eea;
}

.water-level-table {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.level-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.level-bar {
    width: 30px;
    height: 20px;
    background: #e0e0e0;
    border-radius: 3px;
    margin-right: 10px;
    overflow: hidden;
}

.level-bar-fill {
    height: 100%;
    background: linear-gradient(180deg, #2196f3 0%, #1976d2 100%);
    transition: width 0.3s ease;
}

.tanks-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 20px;
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.tank-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tank {
    width: 60px;
    height: 200px;
    border: 3px solid #333;
    border-radius: 0 0 15px 15px;
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.tank-water {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(180deg, #2196f3 0%, #1565c0 100%);
    transition: height 0.8s ease;
}

.tank-water::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 60 10' preserveAspectRatio='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,5 Q15,0 30,5 T60,5 L60,10 L0,10' fill='rgba(255,255,255,0.2)'/%3E%3C/svg%3E")
        repeat-x;
    background-size: 60px 10px;
    animation: wave-animation 2s linear infinite;
}

@keyframes wave-animation {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 60px 0;
    }
}

.tank-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    max-width: 80px;
}

.tank-value {
    font-size: 0.9rem;
    color: #2196f3;
    font-weight: bold;
}

.right-info-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.right-info-panel.open {
    right: 0;
}

.panel-header {
    color: white;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.panel-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.right-panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.25);
    z-index: 1049;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.right-panel-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.right-panel-info-label {
    display: inline-block;
    width: 120px;
}


.fs-14{
    font-size: 14px;
}
.placed-item-label {
   display:none !important;
}

/* =====================================================
   12. DISCHARGE DATA CARDS
===================================================== */
.discharge-summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 16px;
    color: white;
}

.location-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.location-indicator {
    width: 4px;
    height: 24px;
    border-radius: 2px;
}

.location-indicator.left-sluice {
    background: #0d6efd;
}

.location-indicator.right-sluice {
    background: #dc3545;
}

.location-indicator.main-weir {
    background: #ffc107;
}

.discharge-value-box {
    background: #f8f9fa;
    border-radius: 6px;
}

.total-summary-card {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-radius: 12px;
    color: white;
}

.total-summary-box {
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* =====================================================
   13. CANAL CARDS
===================================================== */
.canal-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.canal-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.canal-name {
    font-size: 14px;
}

.canal-code {
    font-size: 12px;
}

.section-indicator {
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    margin-right: 10px;
}

/* =====================================================
   14. BUTTONS
===================================================== */
.btn-view-details {
    border-radius: 10px;
    padding: 10px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
    transition: all 0.3s ease;
}

.btn-view-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.alert-warning-custom {
    border-radius: 10px;
    border-left: 4px solid #ffc107;
}

/* =====================================================
   15. Gate Details Modal Layout
===================================================== */
#gateDetailsModal .modal-dialog {
    height: 100vh;
}

#gateDetailsModal .modal-content {
    height: 100%;
}

.gate-modal-body {
    height: calc(100vh - 70px); /* account for modal header height */
    overflow-y: auto;
}

.gate-modal-left {
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.gate-modal-left .video {
    height: 100%;
}
.table-padding th,
.table-padding td{
    padding: 5px 8px !important;
}
.table-padding{
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
    &:hover {
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }
}
