/* CSS Reset and Layout Fix - Place at the beginning of style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 100vh;
    position: relative;
}

/* Ensure no top margin/padding on any top-level containers */
body > * {
    margin-top: 0 !important;
}

.main-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.topbar {
    margin-top: 0 !important;
}
/* GACS Dashboard Custom Styles */

:root {
    /* Modern Professional Color Palette */
    --primary-color: #4F46E5;        /* Indigo - Modern & Professional */
    --primary-dark: #3730A3;         /* Darker Indigo */
    --primary-light: #6366F1;        /* Lighter Indigo */

    --secondary-color: #64748B;      /* Slate Gray */
    --success-color: #10B981;        /* Emerald Green */
    --danger-color: #EF4444;         /* Red */
    --warning-color: #F59E0B;        /* Amber */
    --info-color: #3B82F6;           /* Blue */

    --dark-color: #1E293B;           /* Dark Slate */
    --darker-color: #0F172A;         /* Darker Slate */
    --light-color: #F8FAFC;          /* Very Light Gray */
    --gray-100: #F1F5F9;             /* Light Gray */
    --gray-200: #E2E8F0;             /* Medium Light Gray */
    --gray-300: #CBD5E1;             /* Medium Gray */

    --sidebar-bg: #1E293B;           /* Dark Professional Sidebar */
    --sidebar-hover: #334155;        /* Sidebar Hover */
    --topbar-bg: #FFFFFF;            /* Clean White Topbar */

    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    min-height: 100vh;
    height: 100%;
    margin: 0;
    padding: 0;
    zoom: 80%;
}

/* Sidebar Styles */
.sidebar {
    position: relative;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    min-height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width) !important;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.sidebar-toggle {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    z-index: 1001;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar.collapsed .sidebar-toggle {
    left: 15px;
}

.sidebar.collapsed .sidebar-header {
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .sidebar-header i {
    font-size: 1.8rem !important;
    margin-bottom: 0 !important;
}

.sidebar-header h3 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
    word-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-header h3 {
    opacity: 0;
    height: 0;
    font-size: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    background: transparent;
    position: relative;
}

.sidebar.collapsed .sidebar-menu a {
    padding: 1rem 0;
    justify-content: center;
}

.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-menu a.active {
    background: var(--sidebar-hover);
    color: white;
    border-left: 4px solid var(--primary-color);
    padding-left: calc(1.25rem - 4px);
}

.sidebar.collapsed .sidebar-menu a:hover,
.sidebar.collapsed .sidebar-menu a.active {
    padding-left: 0;
    border-left: none;
    border-bottom: 3px solid var(--primary-color);
}

.sidebar-menu i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar-menu span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-menu span {
    opacity: 0;
    width: 0;
    display: none;
}

/* Menu Section Titles */
.menu-section {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding: 0 1.25rem;
    list-style: none;
}

.menu-section:first-child {
    margin-top: 0.5rem;
}

.section-title {
    display: block;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.5rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .menu-section {
    padding: 0;
    margin-top: 1rem;
}

.sidebar.collapsed .section-title {
    display: none;
}

/* Menu Divider */
.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 1.25rem;
    list-style: none;
}

.sidebar.collapsed .menu-divider {
    margin: 1rem 0.5rem;
}

/* Logout Link Special Styling */
.logout-link {
    color: rgba(255, 255, 255, 0.7) !important;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #EF4444 !important;
}

.logout-link i {
    color: rgba(255, 255, 255, 0.7);
}

.logout-link:hover i {
    color: #EF4444;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-menu a {
    position: relative;
}

.sidebar.collapsed .sidebar-menu a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--darker-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-left: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1002;
}

.sidebar.collapsed .sidebar-menu a:hover::after {
    opacity: 1;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--light-color);
    transition: margin-left 0.3s ease;
}

.main-content.collapsed {
    margin-left: var(--sidebar-collapsed-width) !important;
}

.topbar {
    background: var(--topbar-bg);
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.topbar h4 {
    margin: 0;
    color: var(--dark-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-wrapper {
    padding: 2rem;
    max-width: 100%;
    width: 100%;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

/* Spacing between main dashboard sections */
.content-wrapper > .row {
    margin-bottom: 1.5rem;
}

.content-wrapper > .row:last-child {
    margin-bottom: 0;
}

/* Dashboard section spacing */
.content-wrapper > .row.mt-4 {
    margin-top: 2rem !important;
    margin-bottom: 1.5rem;
}

/* Ensure consistent spacing for dashboard cards */
.content-wrapper .card > .card-body > .row {
    margin-bottom: 0;
}

.content-wrapper .card > .card-body > .row + .row {
    margin-top: 1rem;
}

.card-header {
    background: white;
    color: var(--dark-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-grid {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    flex: 1 1 0;
    min-width: 0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    border-color: var(--gray-300);
}

.stat-card.primary {
    border-top: 3px solid var(--primary-color);
}

.stat-card.success {
    border-top: 3px solid var(--success-color);
}

.stat-card.danger {
    border-top: 3px solid var(--danger-color);
}

.stat-card.warning {
    border-top: 3px solid var(--warning-color);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.3;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.stat-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    margin: 0.25rem 0 0 0;
    color: var(--secondary-color);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--gray-100);
}

table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--secondary-color);
}

table tbody tr:hover {
    background: var(--gray-100);
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.online {
    background: #D1FAE5;
    color: #065F46;
}

.badge.offline {
    background: #FEE2E2;
    color: #991B1B;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--secondary-color);
}

/* Footer */
.footer {
    background: white;
    padding: 1.5rem;
    text-align: center;
    color: var(--secondary-color);
    margin-top: 2rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* Map Styles */
#map {
    height: 600px;
    border-radius: 10px;
    overflow: hidden;
}

/* Alert Styles */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    font-size: 0.9375rem;
}

.alert:last-child {
    margin-bottom: 0;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-color: #10B981;
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #EF4444;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-color: #F59E0B;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #3B82F6;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* Inline spin animation for icons */
.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Modal Styles */
.modal-content {
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
}

.modal-header .modal-title {
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.125rem;
}

.modal-header .modal-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    border-radius: 0 0 12px 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1 1 calc(50% - 0.25rem);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1 1 100%;
    }
}

/* Fullscreen modal backdrop - Complete coverage fix with percentage */
.modal-backdrop,
.modal-backdrop.show,
.modal-backdrop.fade,
.modal-backdrop.in {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1040 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    transform: none !important;
    display: block !important;
}

/* Ensure body doesn't scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
    height: 100% !important;
}

/* Fix for html element */
html.modal-open {
    overflow: hidden !important;
}

/* Modal positioning */
.modal {
    z-index: 1050 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.modal-dialog {
    position: relative !important;
    z-index: 1055 !important;
    margin: 1.75rem auto !important;
}

/* Specific modals */
#editWiFiModal {
    z-index: 1050 !important;
}

#editWiFiModal .modal-dialog {
    z-index: 1055 !important;
}

/* Black border for edit WLAN modal */
#editWiFiModal .modal-content {
    border: 3px solid #000 !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5) !important;
}

/* Full height page layout - keeps footer at bottom */
body {
    min-height: 100vh;
}

.main-content {
    flex: 1;
}

/* Users page specific */
/* Global sticky footer - applies to all pages */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
}

.main-content {
}

footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* ============================================
   STICKY FOOTER - GLOBAL (ALL PAGES)
   ============================================ */
html {
    height: 100%;
}

body {
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

.main-content {
}

footer {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

/* ============================================
   STICKY FOOTER - FORCE FOOTER TO BOTTOM
   ============================================ */
html {
    height: 100%;
}

body {
    min-height: 100vh;
}

.main-content {
}

footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* ============================================
   MOBILE HAMBURGER MENU
   ============================================ */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    width: 45px;
    height: 45px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

/* Show hamburger on mobile */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* Change icon to hamburger on mobile */
    .sidebar-toggle i::before {
        content: "\f479" !important; /* Bootstrap Icons: list */
    }
    
    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
    }
    
    /* Show sidebar when active */
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay when sidebar is open */
    .sidebar.active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: -1;
    }
}

/* Mobile hamburger button in topbar */
#sidebarToggle {
    display: none;
}

@media (max-width: 768px) {
    #sidebarToggle {
        display: inline-block !important;
    }
}

/* Fix sidebar visibility on desktop vs mobile */
@media (min-width: 769px) {
    /* Desktop - sidebar always visible */
    .sidebar {
        transform: translateX(0) !important;
        position: relative !important;
    }
    
    #sidebarToggle {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Mobile - sidebar slides in/out */
    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        height: 100vh;
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    /* Hamburger button visible on mobile */
    #sidebarToggle {
        display: inline-block !important;
    }
}
/* Remove all sticky footer duplicates - keep content at top */
body {
    margin: 0;
    padding: 0;
}

.main-content {
}

.container-fluid {
    padding-top: 1rem;
}
/* Fix for layout issues - remove conflicting styles and ensure proper alignment */

/* Reset HTML and Body */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #F8FAFC;
    display: flex;
    min-height: 100vh;
    zoom: 80%;
}

/* Main Content Area - ensure it fills space properly */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #F8FAFC;
    transition: margin-left 0.3s ease;
    position: relative;
}

.main-content.collapsed {
    margin-left: var(--sidebar-collapsed-width) !important;
}

/* Topbar - fixed positioning to prevent gaps */
.topbar {
    background: #FFFFFF;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Content wrapper should grow to fill available space */
.content-wrapper {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
    max-width: 100%;
    width: 100%;
}

/* Footer at bottom */
.footer {
    background: white;
    padding: 1rem 2rem;
    border-top: 1px solid #E2E8F0;
    text-align: center;
    font-size: 0.875rem;
    color: #64748B;
    margin-top: auto;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Remove any duplicate wrapper styles */
.wrapper {
    display: none !important;
}

/* Ensure sidebar stays fixed */
.sidebar {
    position: relative;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: #1E293B;
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease;
}

/* SIDEBAR HEIGHT FIX - Ensure sidebar is always full height */
.sidebar {
    position: relative;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    overflow-y: auto !important;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease, left 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width) !important;
}

/* Mobile sidebar - slide from left */
@media (max-width: 991px) {
    .sidebar {
        left: -280px !important;
    }
    
    .sidebar.active {
        left: 0 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* Desktop - ensure toggle button is visible */
@media (min-width: 992px) {
    .sidebar-toggle {
        display: flex !important;
    }
}

/* Sidebar Toggle Button - Hidden by default, appears on hover */
.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background: var(--primary-color);
    border: none;
    border-radius: 0 8px 8px 0;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}

.sidebar:hover .sidebar-toggle-btn {
    opacity: 1;
}

.sidebar-toggle-btn:hover {
    background: var(--primary-dark);
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h3,
.sidebar.collapsed .sidebar-menu span {
    display: none;
}

.sidebar.collapsed .sidebar-header img {
    max-width: 40px;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-toggle-btn {
    right: -15px;
}

/* Main content adjustment */
.main-content {
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
}

/* ========================================
   HOVER TOGGLE BUTTON - ADDITION
   ======================================== */
.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background: #4F46E5;
    border: none;
    border-radius: 0 8px 8px 0;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}

.sidebar:hover .sidebar-toggle-btn {
    opacity: 1;
}

.sidebar-toggle-btn:hover {
    background: #3730A3;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-header h3,
.sidebar.collapsed .sidebar-menu span {
    display: none;
}

.sidebar.collapsed .sidebar-header img {
    max-width: 40px;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 0.75rem;
}

/* ========================================
   LOGIN PAGE - CENTERED LAYOUT FIX
   ======================================== */
body.login-page {
    margin: 0 !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.login-page .login-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 100vh !important;
    padding: 2rem;
    width: 100%;
}

body.login-page .login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    animation: slideIn 0.5s ease;
}

body.login-page .footer {
    position: fixed;
    bottom: 20px;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 0.9rem;
}

body.login-page .footer a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

body.login-page .footer a:hover {
    text-decoration: underline;
}

/* Hide footer on login page */
body.login-page .footer {
    display: none !important;
}

/* ========================================
   MOBILE RESPONSIVE - ALL PAGES
   ======================================== */

/* Mobile viewport adjustments */
@media (max-width: 991px) {
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        left: -280px;
        width: 250px;
        transition: left 0.3s ease;
    }
    
    /* Show sidebar when active */
    .sidebar.active {
        left: 0;
    }
    
    /* Main content takes full width on mobile */
    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }
    
    /* Adjust topbar for mobile */
    .topbar {
        padding: 0.75rem 1rem;
    }
    
    .topbar h4 {
        font-size: 1rem;
    }
    
    .user-info {
        font-size: 0.85rem;
    }
    
    .user-info span {
        display: none;
    }
    
    .user-info i {
        font-size: 1.5rem;
    }
    
    /* Hide hover toggle button on mobile */
    .sidebar-toggle-btn {
        display: none !important;
    }
    
    /* Content wrapper padding */
    .content-wrapper {
        padding: 1rem;
        max-width: 100%;
        width: 100%;
    }
    
    /* Cards responsive */
    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Adjust bottom spacing for mobile columns */
    .card-body .col-md-6,
    .card-body .col-lg-6,
    .card-body .col-xl-3,
    .card-body [class*='col-'] {
        margin-bottom: 0.75rem;
        padding-bottom: 0.25rem;
    }

    .content-wrapper > .row {
        margin-bottom: 1rem;
    }
    
    /* Tables responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small mobile devices */
@media (max-width: 576px) {
    body {
        font-size: 14px;
    }
    
    .topbar h4 {
        font-size: 0.9rem;
    }
    
    .content-wrapper {
        padding: 0.75rem;
        max-width: 100%;
        width: 100%;
    }

    .card-header h5 {
        font-size: 1rem;
    }
    
    /* Login page mobile */
    body.login-page .login-card {
        padding: 2rem 1.5rem;
    }
    
    body.login-page .login-header img {
        width: 120px !important;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    button,
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .sidebar-menu a {
        padding: 1rem;
    }
    
    /* Remove hover effects on touch devices */
    .sidebar:hover .sidebar-toggle-btn {
        opacity: 0;
    }
}

/* Landscape mobile */
@media (max-width: 991px) and (orientation: landscape) {
    .topbar {
        padding: 0.5rem 1rem;
    }

    .content-wrapper {
        padding: 0.75rem;
        max-width: 100%;
        width: 100%;
    }
}

/* Prevent zoom on input focus (iOS) */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    font-size: 16px !important;
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-left)) {
    .sidebar {
        padding-left: env(safe-area-inset-left);
    }
    
    .topbar,
    .content-wrapper {
        padding-left: calc(1rem + env(safe-area-inset-left));
        padding-right: calc(1rem + env(safe-area-inset-right));
    }
}

/* ========================================
   BURGER BUTTON & SIDEBAR - FINAL FIX
   ======================================== */

/* Burger Button - Always visible */
.burger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-color);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.burger-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.burger-btn i {
    transition: transform 0.3s ease;
}

/* Desktop: Sidebar starts visible */
@media (min-width: 992px) {
    .sidebar {
        left: 0;
        transform: translateX(0);
    }
    
    .sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 250px;
        transition: margin-left 0.3s ease;
    }
    
    .sidebar.hidden ~ .main-content {
        margin-left: 0;
    }
}

/* Mobile: Sidebar starts hidden */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        z-index: 1050;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    /* Overlay when sidebar is open on mobile */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
}

/* Remove old hover toggle button */
.sidebar-toggle-btn {
    display: none !important;
}

/* ========================================
   FIX DESKTOP SIDEBAR - Keep it fixed
   ======================================== */
@media (min-width: 992px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        transform: translateX(0) !important;
        transition: transform 0.3s ease !important;
    }
    
    .sidebar.hidden {
        transform: translateX(-100%) !important;
    }
    
    .main-content {
        margin-left: 250px !important;
        transition: margin-left 0.3s ease !important;
    }
    
    .sidebar.hidden ~ .main-content {
        margin-left: 0 !important;
    }
}

/* ============================================================================
   OPTICAL SIGNAL MONITORING STYLES
   ============================================================================ */

/* Toast notifications container */
#toast-container {
    z-index: 9999;
    max-width: 400px;
}

/* Optical signal notification styling */
.optical-signal-notification {
    font-size: 14px;
}

.optical-signal-notification .fw-bold {
    font-size: 16px;
    margin-bottom: 4px;
}

/* Signal change indicator in table */
.signal-change-indicator {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Row highlight for signal changes */
tr.signal-changed {
    background-color: rgba(255, 193, 7, 0.1) !important;
    border-left: 3px solid var(--warning-color);
    transition: all 0.3s ease;
}

/* Enhanced badge colors for signal quality */
.badge.bg-success {
    background-color: var(--success-color) !important;
}

.badge.bg-info {
    background-color: var(--info-color) !important;
}

.badge.bg-warning {
    background-color: var(--warning-color) !important;
    color: #000 !important;
}

.badge.bg-danger {
    background-color: var(--danger-color) !important;
}

/* Toast notification enhancements */
.toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.toast-body {
    padding: 12px 16px;
}

/* Responsive adjustments for notifications */
@media (max-width: 768px) {
    #toast-container {
        max-width: 90vw;
        right: 5vw !important;
    }
}

/* Dashboard Signal Highlighting */
.signal-highlight {
    animation: dashboard-signal-pulse 2s ease-in-out;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.5) !important;
}

@keyframes dashboard-signal-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 193, 7, 0);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    }
}

/* MikroTik Location Map Marker */
.mikrotik-location-marker {
    background: none !important;
    border: none !important;
}

#mikrotik-location-map {
    cursor: crosshair;
}

#mikrotik-location-map .leaflet-marker-icon {
    cursor: move;
}

/* MikroTik Modal Improvements */
#mikrotikModal .modal-body {
    padding: 1.5rem;
}

#mikrotikModal .modal-body h6 {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

#mikrotikModal .form-label {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 0.375rem;
}

#mikrotikModal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#mikrotikModal .modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#mikrotikModal .modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#mikrotikModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================================================
   SIMPLE MIKROTIK DEVICES - CLEAN DESIGN
   ============================================================================ */

/* Use black text instead of gray */
.card h6,
.card small.text-dark {
    color: #000 !important;
    font-weight: 600;
}

/* ============================================================================
   DASHBOARD GENERAL IMPROVEMENTS
   ============================================================================ */

/* Replace gray text with black for better readability */
.card .text-muted {
    color: #2d2d2d !important;
    font-weight: 600 !important;
}

.card small.text-muted {
    color: #333 !important;
    font-weight: 600 !important;
}

/* Improve card titles */
.card .card-title {
    font-weight: 700 !important;
    color: #1a1a1a !important;
}

/* Better card styling */
.card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.card-header {
    background: white;
    border-bottom: 2px solid #e9ecef;
    font-weight: 700;
    color: #1a1a1a;
}

/* Progress bars */
.progress {
    background-color: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

/* Badge improvements */
.badge {
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Better alignment for stat cards */
.row {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.row > [class*='col-'] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Ensure dashboard cards can expand to fit content */
.content-wrapper .row {
    max-width: 100%;
    flex-wrap: wrap;
}

.content-wrapper .card {
    width: 100%;
}

.content-wrapper .card-body {
    width: 100%;
}

/* Dashboard specific - allow content to expand fully */
.main-content {
    max-width: 100%;
    overflow-x: auto;
}

.content-wrapper {
    min-width: 100%;
    overflow-x: visible;
}

/* Allow Bootstrap grid to expand beyond default constraints */
.container-fluid {
    max-width: 100% !important;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Ensure cards in rows can be side by side without constraint */
.row .col-lg-6,
.row .col-lg-12,
.row .col-md-6,
.row [class*='col-'] {
    max-width: 100%;
}

/* Dashboard card grid layouts - allow expansion */
#device-overview-cards .row,
#uplink-signal-cards .row,
#mikrotik-combined-stats .row {
    width: 100%;
    max-width: none;
}

#device-overview-cards .card,
#uplink-signal-cards .card,
#mikrotik-combined-stats .card {
    max-width: 100%;
    width: 100%;
}

/* Dashboard item spacing - bottom padding adjustments */
.card {
    margin-bottom: 1.5rem;
}

.row {
    margin-bottom: 0;
}

.row + .row {
    margin-top: 1.5rem;
}

/* Adjust spacing for columns within cards */
.card-body .col-md-6,
.card-body .col-lg-6,
.card-body .col-xl-3,
.card-body [class*='col-'] {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

/* Additional spacing for stat cards */
.card-body .col-md-6 .card,
.card-body .col-lg-6 .card,
.card-body .col-xl-3 .card {
    margin-bottom: 0;
}

/* Remove bottom margin from last row items */
.card-body .row:last-child [class*='col-'] {
    margin-bottom: 0;
}

/* Dashboard stat card inner items spacing */
.card-body .card {
    margin-bottom: 1rem;
}

.card-body .card:last-child {
    margin-bottom: 0;
}

/* Progress bars and badges spacing */
.progress {
    margin-bottom: 0.75rem;
}

.progress:last-child {
    margin-bottom: 0;
}

/* Badge spacing in cards */
.badge {
    margin-bottom: 0.25rem;
}

/* Adjust spacing for PPPoE and device stat cards */
.card-body .border-top {
    margin-top: 1rem;
    padding-top: 1rem;
}

/* Bottom spacing for MikroTik device cards */
#mikrotik-combined-stats .card {
    margin-bottom: 1.5rem;
}

#mikrotik-combined-stats .row > [class*='col-']:last-child .card {
    margin-bottom: 1.5rem;
}

/* Allow inner card rows to wrap naturally */
.card-body .row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.card-body .row > [class*='col-'] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    flex: 0 0 auto;
}

/* Dashboard stat cards - uniform height with proper overflow handling */
.card-body .card {
    box-sizing: border-box;
    overflow: hidden;
}

.card-body .card .card-body {
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-body .row {
    max-width: 100%;
}

.card-body .row [class*='col-'] {
    max-width: 100%;
}

/* Ensure dashboard cards maintain uniform height */
#device-overview-cards .card,
#uplink-signal-cards .card {
    overflow: hidden;
}

#device-overview-cards .card-body,
#uplink-signal-cards .card-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

/* Optimize spacing for dashboard stat cards */
#device-overview-cards .card-body,
#uplink-signal-cards .card-body {
    padding: 1rem !important;
}

#device-overview-cards .card h3,
#uplink-signal-cards .card h3 {
    font-size: 1.75rem !important;
    margin-bottom: 0.5rem !important;
}

#device-overview-cards .card h4,
#uplink-signal-cards .card h4 {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem !important;
}

#device-overview-cards .card h5,
#uplink-signal-cards .card h5 {
    font-size: 1.25rem !important;
    margin-bottom: 0.5rem !important;
}

#device-overview-cards .card h6,
#uplink-signal-cards .card h6 {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
}

#device-overview-cards .card small,
#uplink-signal-cards .card small {
    font-size: 0.875rem !important;
}

#device-overview-cards .card .mb-3,
#uplink-signal-cards .card .mb-3 {
    margin-bottom: 0.75rem !important;
}

#device-overview-cards .card .mb-2,
#uplink-signal-cards .card .mb-2 {
    margin-bottom: 0.5rem !important;
}

#device-overview-cards .card .mt-2,
#uplink-signal-cards .card .mt-2 {
    margin-top: 0.5rem !important;
}

#device-overview-cards .card .progress,
#uplink-signal-cards .card .progress {
    height: 8px !important;
}

/* Responsive handling for dashboard expansion */
@media (min-width: 992px) {
    /* Allow horizontal scroll on large screens if content exceeds viewport */
    .content-wrapper {
        overflow-x: auto;
        min-width: 0;
    }

    /* Prevent card content from being cut off */
    .row .col-lg-6 {
        min-width: 0;
        flex: 0 0 50%;
    }

    .row .col-lg-12 {
        min-width: 0;
        flex: 0 0 100%;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    /* Tablet view - stack cards for better readability */
    .row .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 767px) {
    /* Mobile - full width cards */
    .row [class*='col-'] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .content-wrapper {
        overflow-x: auto;
    }

    /* Reduce bottom spacing on mobile for better use of screen space */
    .card {
        margin-bottom: 1rem;
    }

    .card-body .col-md-6,
    .card-body .col-lg-6,
    .card-body .col-xl-3,
    .card-body [class*='col-'] {
        margin-bottom: 0.75rem;
    }

    .row + .row {
        margin-top: 1rem;
    }
}

