@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary-green: #0d9472;
    --primary-green-light: #e6f7f3;
    --text-main: #1a1a1a;
    --text-muted: #6c757d;
    --bg-light: #f8f9fc;
    --border-color: #e5e7eb;
}

html, body {
    touch-action: manipulation;
}

body {
    font-family: 'Inter', 'Pyidaungsu', 'Padauk', 'Myanmar Text', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
}

/* Myanmar Unicode Typography & Spacing Fixes */
html[lang="my-MM"], html[lang="my-MM"] body {
    font-family: 'Pyidaungsu', 'Padauk', 'Myanmar Text', 'Inter', sans-serif;
}

html[lang="my-MM"] * {
    letter-spacing: normal !important;
}

html[lang="my-MM"] .station-card span,
html[lang="my-MM"] .station-card div {
    line-height: normal;
}

html[lang="my-MM"] .station-card .water-level-num {
    line-height: 1.35 !important;
    display: inline-block;
    padding-bottom: 4px;
}

/* Navbar specific styling */
.custom-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.brand-icon {
    background-color: var(--primary-green);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.nav-pill-btn {
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.4rem 1.2rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    background: transparent;
    transition: all 0.2s;
    text-decoration: none;
}
.nav-pill-btn:hover {
    background-color: var(--bg-light);
}
.nav-pill-btn.active {
    background-color: var(--primary-green-light);
    color: var(--primary-green);
    border-color: var(--primary-green-light);
}

/* Dashboard Filter Bar */
.filter-btn {
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.4rem 1.2rem;
}
.filter-btn.active {
    background-color: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}
.custom-search, .custom-select {
    border-radius: 20px;
    font-size: 0.85rem;
    background-color: white;
}

/* Station Cards */
.station-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}
.station-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.status-badge-normal {
    background-color: var(--primary-green-light);
    color: var(--primary-green);
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.frequency-badge {
    background-color: var(--primary-green-light);
    color: var(--primary-green);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
}

/* Presenter Panel */
.presenter-panel {
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
}

.simulation-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.bg-light-purple { background-color: #f3e8ff; }
.text-purple { color: #9333ea; }
.fs-7 { font-size: 0.85rem; }

/* Login Modal / Card */
.auth-wrapper {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3rem;
}
.auth-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
}
.auth-icon-top {
    width: 60px;
    height: 60px;
    background-color: var(--primary-green-light);
    color: var(--primary-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1.5rem auto;
}

/* Admin Layout */
.admin-layout-wrapper {
    height: calc(100vh - 65px);
    overflow: hidden;
}

.admin-sidebar {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.admin-sidebar.collapsed {
    width: 70px;
    min-width: 70px;
}

.admin-sidebar.collapsed .menu-label,
.admin-sidebar.collapsed .nav-text,
.admin-sidebar.collapsed .user-details {
    display: none;
}

.admin-sidebar.collapsed .admin-nav-link {
    justify-content: center;
    padding: 0.75rem 0;
}
.admin-sidebar.collapsed .admin-nav-link i {
    margin-right: 0;
    font-size: 1.25rem;
}

.admin-sidebar.collapsed .user-profile {
    justify-content: center;
}

.admin-sidebar.collapsed .logout-form {
    padding: 0 !important;
    display: flex;
    justify-content: center;
}

.admin-sidebar.collapsed .logout-form button {
    width: auto !important;
    border-radius: 50%;
    padding: 0.5rem;
}
.admin-sidebar.collapsed .logout-form button i {
    margin-right: 0;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1.2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.admin-nav-link:hover, .admin-nav-link.active {
    background-color: var(--primary-green-light);
    color: var(--primary-green);
}
.admin-content {
    flex-grow: 1;
    padding: 2rem;
}

/* Telemetry Entry Specifics */
.header-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.panel-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.number-control-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background-color: #ffffff;
}

.number-btn {
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}
.number-btn:hover {
    background-color: var(--bg-light);
    color: var(--primary-green);
}

.number-input-lg {
    border: none;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    width: 100%;
    color: var(--text-main);
}
.number-input-lg:focus {
    outline: none;
}

.freq-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 12px;
    padding: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}
.freq-btn.active {
    border-color: var(--primary-green);
    color: var(--primary-green);
    background-color: var(--primary-green-light);
}

.status-tag {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}
.status-tag.active {
    background-color: var(--primary-green-light);
    color: var(--primary-green);
    border-color: var(--primary-green-light);
}

.dispatch-item {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}
.dispatch-item:last-child {
    border-bottom: none;
}

/* Modal Specifics */
.custom-tabs {
    border-bottom: 2px solid var(--border-color);
}
.custom-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    position: relative;
    background: transparent;
}
.custom-tabs .nav-link.active {
    color: var(--primary-green);
}
.custom-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-green);
}

.stat-card {
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.log-item {
    transition: background-color 0.2s;
}
.log-item:hover {
    background-color: var(--bg-light);
}

/* Station Switcher */
.current-station-card {
    background-color: var(--primary-green-light) !important;
    border-radius: 12px !important;
    padding: 0.75rem !important;
    transition: all 0.2s;
}
.current-station-card:hover {
    background-color: #d1f0e8 !important;
}

.admin-sidebar.collapsed .current-station-card {
    padding: 0.25rem !important;
    justify-content: center !important;
    margin-bottom: 0.5rem;
}
.admin-sidebar.collapsed .station-card-container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}
.admin-sidebar.collapsed .current-station-card i.bi-chevron-expand {
    display: none !important;
}
.admin-sidebar.collapsed .current-station-card .nav-text-container {
    justify-content: center !important;
    width: 100%;
}

.station-selector-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s;
}
.station-selector-card:hover {
    border-color: var(--primary-green);
    background-color: var(--primary-green-light);
    transform: translateY(-2px);
}
.station-selector-card.active-station {
    border-color: var(--primary-green);
    background-color: var(--primary-green-light);
    box-shadow: 0 4px 12px rgba(13, 148, 114, 0.15);
}

.system-title {
    font-size: 1.1rem;
}

/* -----------------------------------------
   Mobile Responsiveness & Media Queries
----------------------------------------- */
@media (max-width: 768px) {
    /* Navbar Adjustments */
    .custom-navbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .custom-navbar > div:first-child {
        width: auto;
    }
    
    .custom-navbar > div:last-child {
        width: auto;
        margin-left: auto;
    }
    
    .brand-container {
        justify-content: flex-start !important;
    }
    
    .system-title {
        font-size: 0.8rem;
    }

    .custom-navbar .d-flex.gap-3 {
        width: 100%;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: 0.5rem !important;
        order: 3;
        margin-top: 0.5rem;
    }
    
    .nav-pill-btn {
        flex-grow: 1;
        text-align: center;
        padding: 0.4rem 0.5rem;
    }
    
    /* Layout Adjustments */
    .admin-layout-wrapper {
        position: relative;
    }
    
    /* Off-Canvas Sidebar */
    .admin-sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        z-index: 1050;
        width: 280px;
        min-width: 280px;
        box-shadow: 10px 0 30px rgba(0,0,0,0.15);
        transition: left 0.3s cubic-bezier(0.1, 0.7, 0.1, 1); /* springy feel */
        border-radius: 0 24px 24px 0; /* native drawer look */
        padding-top: calc(1.5rem + env(safe-area-inset-top)); /* account for notch */
    }
    
    body.sidebar-open .admin-sidebar {
        left: 0;
    }
    
    /* Overlay Backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 1040;
    }
    
    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    /* Larger Sidebar Text for Mobile Touch */
    .admin-nav-link {
        font-size: 1.1rem !important;
        padding: 0.75rem 1.2rem !important;
    }
    .admin-nav-link i {
        font-size: 1.3rem !important;
    }
    .menu-label {
        font-size: 0.9rem !important;
    }
    
    /* Mobile Toggle Button */
    .mobile-sidebar-toggle {
        display: block !important;
    }
    
    .desktop-sidebar-toggle {
        display: none !important;
    }
    
    /* Admin Content */
    .admin-content {
        padding: 1rem;
        padding-bottom: 90px; /* Space for the bottom nav */
    }
}

/* Mobile Bottom Navigation Styles */
.mobile-bottom-nav {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 20px;
    width: calc(100% - 40px);
    height: 70px;
    background-color: #ffffff;
    border-radius: 50px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.12);
    z-index: 1030;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    width: 20%;
    height: 100%;
    transition: color 0.2s;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--primary-green);
}

.bottom-nav-center-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 20%;
    height: 100%;
}

.bottom-nav-center-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-green);
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
    box-shadow: 0 8px 20px rgba(13, 148, 114, 0.4);
}

.bottom-nav-center-btn:active {
    transform: scale(0.95);
}

/* Hide mobile toggle on desktop */
.mobile-sidebar-toggle {
    display: none;
}

/* --- Skeleton Loader Overlay --- */
#page-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-light);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    padding: 20px;
    box-sizing: border-box;
}

#page-loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.skeleton-box {
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 12px;
    margin-bottom: 15px;
}

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

.skeleton-header { height: 60px; width: 100%; margin-bottom: 30px; }
.skeleton-card { height: 120px; width: 100%; margin-bottom: 20px; }

.spinner-border.text-primary-custom {
    color: #0d9472 !important;
    width: 3rem;
    height: 3rem;
    border-width: 0.25rem;
}

/* --- Pull to Refresh --- */
#ptr-container {
    position: fixed;
    top: -60px;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1040;
    transition: transform 0.2s cubic-bezier(0.1, 0.7, 0.1, 1);
}

#ptr-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-green);
    font-size: 1.5rem;
    transform: rotate(0deg);
}
