:root {
    --bg-main: #0c101a;          /* Darker canvas background */
    --bg-card: #151b26;          /* Deep rich blue-grey card backgrounds */
    --border-color: #222b3d;     /* Subtle panel separation borders */
    --text-main: #f3f4f6;
    --text-muted: #8a96a8;       /* Softer muted text color */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-brand: #3b82f6;      /* Modern neon tech accent */
	--ms-blue: #0078d4;
    --ms-blue-dark: #005a9e;
    --ms-blue-light: #deecf9;
    --healthy-bg: #dff6dd;
    --healthy-text: #107c10;
    --healthy-border: #bad80a;
    --degraded-bg: #fff4ce;
    --degraded-text: #835c00;
    --degraded-border: #ffd335;
    --outage-bg: #fde7e9;
    --outage-text: #a4262c;
    --outage-border: #d13438;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

.container {
    display: grid;
    grid-template-columns: 260px 1fr; /* 1st col is fixed sidebar, 2nd col takes all remaining space */
    height: 100vh;
transition: grid-template-columns 0.3s ease; /* Smoothly animates shrinkage */
}

/* When the sidebar is collapsed, shrink the grid column down to icon/button width */
.container.sidebar-collapsed {
    grid-template-columns: 60px 1fr;
}


iframe {
  width: 100%;              /* ✅ responsive */
  max-height: 70dvh;           /* ✅ better than 100vh on mobile */
  height: 400px;        /* fallback */
  border: none;
  background-color: #ffffff;
}


/* 1. Ensure the parent container holding the iframe uses Flexbox */
#incidents-container {
    display: none;             /* Toggled by your JS */
    flex-direction: column;    /* Stack contents vertically */
    height: calc(100vh - 40px); /* Adjust '40px' to match any top layout margins/padding you have */
}

/* 2. Update the iframe rules */
#incident {
    width: 100%;
    flex: 1;                   /* ✅ Forces the frame to grow and fill all remaining height */
    border: none;
    background-color: #ffffff;
    display: block;            /* Prevents tiny white-space gaps at the bottom */
	height: calc(100vh - 40px);
	max-height: calc(100vh - 40px);
}
/* --- Left Sidebar UI --- */
asideOLD {
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
}
aside h2 { 
    font-size: 0.95rem; 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    margin: 0 0 35px 15px; 
    color: var(--color-brand);
    font-weight: 800;
}


/* Sidebar structure adjustments */
aside {
    position: relative; /* Allows positioning the toggle button absolutely if desired */
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevents text elements from breaking out when squeezed */
    transition: padding 0.3s ease;
}

/* Shrunk sidebar spacing adjustments */
aside.collapsed {
    padding: 30px 8px;
}

/* Hide text headers and menu names smoothly when shrunk */
aside.collapsed .sidebar-title,
aside.collapsed .menu-item {
    font-size: 0;
    padding: 12px 0;
    text-align: center;
    text-indent: -9999px; /* Hides raw text lines gracefully */
}

/* Simple control button layout */
.collapse-btn {
    position: absolute;
    top: 5px;
    right: 15px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    z-index: 10;
}

/* Rotate the arrow icon when collapsed */
aside.collapsed .collapse-btn {
    right: 0;
    left: 0;
    margin: 0 auto;
    width: fit-content;
    transform: rotate(180deg);
}

/* Base icon alignment inside sidebar items */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px; /* Spaces the icon from the text span */
    padding: 12px 18px;
    transition: padding 0.3s ease, justify-content 0.3s ease;
	cursor:pointer;
}

.menu-item i {
    width: 20px; /* Force consistent bounding box so icons align perfectly down the line */
    text-align: center;
    font-size: 1.1rem;
}

.view-as-wrapper {
    padding: 12px 18px;
    font-size: 0.8rem;
    transition: padding 0.3s ease;
}
.view-as-wrapper a {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   COLLAPSED STATES (Triggered when .sidebar-collapsed is on .container)
   ========================================================================== */

/* Drop the padding down to keep icons centered nicely */
/* Drop the padding down to keep icons centered nicely */
.container.sidebar-collapsed aside {
    padding: 30px 8px;
}

.container.sidebar-collapsed .menu-item {
    padding: 12px 0;
    justify-content: center; /* Center icons horizontally */
}

.container.sidebar-collapsed .view-as-wrapper {
    padding: 12px 0;
    display: flex;
    justify-content: center;
}

/* Hide all text blocks cleanly */
.container.sidebar-collapsed .menu-text {
    display: none !important;
}
.menu-item.active { 
    background-color: rgba(59, 130, 246, 0.15); 
    color: #fff; 
    font-weight: 600;
    border-left: 3px solid var(--color-brand);
}
.menu-item:hover:not(.active) { 
    background-color: rgba(255, 255, 255, 0.03); 
    color: var(--text-main); 
}

/* --- Center Window Layout --- */
main {
    padding: 30px;
    overflow-y: auto;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 25px;
    align-content: start;
}

.header-panel {
    display: flex;
    justify-content: space-between; /* Pushes title left and date right */
    align-items: center;            /* Vertically centers both elements */
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 5px;
}

/* Ensure the parent header container wraps it safely */
header, .top-header-container {
    position: relative;
}

/* Pin the date directly to the top right */
.header-date {
    position: absolute;
    top: 16px;    /* Distance from the very top edge */
    right: 18px;  /* Distance from the very right edge */
    
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin: 0;    /* Wipe out any default element margins */
}
.header-panel h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.grid-top {
    display: grid;
    grid-template-columns: 2fr 2fr;  /* Two equal-width columns */
    grid-template-rows: auto;        /* Rows scale automatically based on content height */
    gap: 15px;
    align-items: start;              /* Aligns cards to the top of their grid cells */
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.card2 {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    
    padding: 2px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.card3 {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Global Circular Badge & Banner */
.global-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 140px;
}
.global-status-indicator {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-top: 15px;
    text-transform: uppercase;
}

/* Fleet Metrics Styling */
.card h3 {
    font-size: 1.1rem;
    margin: 0 0 20px 0;
    font-weight: 600;
    color: #fff;
}
.service-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.service-row:last-child { border-bottom: none; }
.service-name { font-weight: 500; font-size: 0.95rem; }
.service-latency { font-size: 0.8rem; color: var(--text-muted); margin-left: 8px; }

/* Status Badges */
.badgeold {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.bg-success { background-color: rgba(16, 185, 129, 0.12); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.2); }
.bg-warning { background-color: rgba(245, 158, 11, 0.12); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.bg-danger { background-color: rgba(239, 68, 68, 0.12); color: var(--color-danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* Incident Panels */
.incident-alert {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    margin-top: 15px;
    border-radius: 4px 12px 12px 4px;
    border-left: 4px solid #6b7280; /* default/fallback */
}

.incident-alert.investigating { border-left-color: #a78bfa; } /* light purple */
.incident-alert.identified    { border-left-color: #eab308; } /* yellow */
.incident-alert.monitoring    { border-left-color: #f97316; } /* orange */
.incident-alert.resolved      { border-left-color: #22c55e; } /* green */

.incident-alert i.fa {
    margin-right: 8px;
    font-size: 1.1em;
}

.badge {
    background-color: rgba(255,255,255,0.08);
    color: #ccc;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.85em;
    text-transform: capitalize;
}
/* --- Right Chat Stream Panel --- */
.chat-panel {
    background-color: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.chat-header { 
    padding: 24px; 
    border-bottom: 1px solid var(--border-color); 
}
.chat-header h3 { font-size: 1.1rem; margin: 0 0 4px 0; font-weight: 600; }

.chat-messages { 
    flex: 1; 
    padding: 24px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
}
.msg-bubble { 
    background: rgba(255, 255, 255, 0.02); 
    padding: 14px; 
    border-radius: 8px; 
    border: 1px solid var(--border-color); 
}
.msg-user { font-weight: 600; font-size: 0.85rem; color: var(--color-brand); margin-bottom: 6px; }
.msg-text { font-size: 0.9rem; line-height: 1.4; color: #e5e7eb; }

.chat-footer { padding: 24px; border-top: 1px solid var(--border-color); background: rgba(0,0,0,0.1); }
.chat-footer input[type="text"] {
    width: 100%;
    padding: 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    box-sizing: border-box;
    margin-bottom: 10px;
    font-size: 0.9rem;
}
.chat-footer input[type="text"]:focus { border-color: var(--color-brand); outline: none; }
.chat-footer button {
    width: 100%;
    padding: 12px;
    background: var(--color-brand);
    border: none;
    color: white;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}
.chat-footer button:hover { background: #2563eb; }

.global-banner h3 { font-size: 1.3rem; margin: 10px 0; }
.status-good { color: var(--color-success); }
        .status-warn { color: var(--color-warning); }
        .status-bad { color: var(--color-danger); }
		
		.admin-resolve-btn {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-resolve-btn:hover {
    background-color: var(--color-success);
    color: #ffffff;
    border-color: var(--color-success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
.admin-revert-btn {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-revert-btn:hover {
    background-color: var(--color-warning);
    color: #ffffff;
    border-color: var(--color-warning);
}


/* ==========================================================================
   3. MOBILE RESPONSIVE MEDIA QUERIES (Screens under 768px wide)
   ========================================================================== */
@media (max-width: 768px) {
    /* Stack the sidebar on top of main instead of keeping side-by-side columns */
    .container {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto 1fr;
        height: auto;
    }
    
    /* Convert sidebar into a horizontal navbar row */
    aside {
        flex-direction: row;
        padding: 10px;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        white-space: nowrap;
        gap: 8px;
    }
    
    /* Hide the collapse arrow button on mobile layouts */
    .collapse-btn {
        display: none !important;
    }
    
    .menu-item {
        margin-bottom: 0;
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    /* Adjust Main padding for smaller screen margins */
    main {
        padding: 15px;
        gap: 15px;
    }
    
    /* Collapse core metrics panels into an organized 1-column layout stack */
    .grid-top {
        grid-template-columns: 1fr !important;
    }
    
    /* Stack Header content elements vertically */
    .header-panel {
        flex-direction: column;
        align-items: start;
        gap: 8px;
    }
    
    .header-panel h1 {
        font-size: 1.4rem;
    }
    
    /* Adjust table flex-rows to prevent clipping text */
    .service-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .service-status-block {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Stack incident headers if names or tickets are long */
    .incident-header-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .incident-actions {
        width: 100%;
        justify-content: space-between;
    }
}

.btn-floating-helpdesk {
    position: fixed;
    top: 20px;
    right: 350px;
    z-index: 9999; /* Keeps it above all cards, headers, and overlays */
    
    display: inline-flex;
    align-items: center;
    gap: 8px;
    
    padding: 10px 16px;
    background: #4b7039; /* Adjust color to fit your theme */
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease-in-out;
}

.btn-floating-helpdesk:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    color: #ffffff;
}


/* Desktop Defaults: Hide mobile topbar & overlay */
.mobile-topbar,
.mobile-overlay {
    display: none;
}

/* ==========================================
   MOBILE MEDIA QUERY (<= 768px)
   ========================================== */
@media (max-width: 768px) {
    /* Hide Desktop Collapse Button on Mobile */
    #sidebar-collapse-btn {
        display: none !important;
    }

    /* Mobile Top Header Bar */
    .mobile-topbar {
        display: flex;
        align-items: center;
        height: 50px;
        background-color: var(--bg-sidebar, #0f172a);
        padding: 0 15px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9998;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hamburger-btn {
        background: transparent;
        border: none;
        color: #ffffff;
        font-size: 1.3rem;
        cursor: pointer;
        padding: 5px 10px;
    }

    .mobile-title {
        color: #ffffff;
        font-weight: 600;
        margin-left: 10px;
        font-size: 1rem;
    }

    /* Backdrop Blur/Overlay when Menu Opens */
    .mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 9998;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Convert Sidebar to Slide-Out Drawer */
    #sidebar {
        position: fixed;
        top: 0;
        left: -260px; /* Hide off-screen by default */
        width: 250px !important;
        height: 100vh;
        z-index: 9999;
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
        padding-top: 15px;
    }

    /* Active Class to Slide Menu In */
    #sidebar.mobile-open {
        transform: translateX(260px);
    }

    /* Shift main content down so mobile topbar doesn't obscure it */
    body, .container {
        padding-top: 55px !important;
    }
}
@media (max-width: 768px) {

    /* Slide-out drawer container */
    #sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 250px !important;
        height: 100vh;
        background-color: var(--bg-sidebar, #0f172a);
        z-index: 9999;
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
        
        /* Flex column to stack items from top to bottom */
        display: flex !important;
        flex-direction: column !important;
        padding: 60px 15px 20px 15px; /* Top padding clears the topbar */
        box-sizing: border-box;
    }

    /* Open state */
    #sidebar.mobile-open {
        transform: translateX(260px);
    }

    /* Individual menu rows */
    #sidebar .menu-item {
        display: flex !important;
        flex-direction: row !important; /* Icon and text side-by-side */
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        padding: 12px 15px !important;
        margin-bottom: 8px !important;
        border-radius: 8px;
        box-sizing: border-box;
    }

    /* Fix menu icon & text alignment inside each row */
    #sidebar .menu-item i {
        font-size: 1.2rem;
        width: 25px; /* Fixed width keeps text vertically aligned across rows */
        text-align: center;
        margin-right: 12px;
    }

    #sidebar .menu-text {
        display: inline-block !important;
        font-size: 0.95rem;
        margin: 0 !important;
    }

    /* View As footer stays at the bottom of the drawer */
    #sidebar .view-as-wrapper {
        margin-top: auto !important;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
    }

    #sidebar .view-as-wrapper a {
        display: flex;
        align-items: center;
        padding: 10px 15px;
    }
}

/* Base Desktop Styling */
.fleet-metrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.fleet-toggle-icon {
    display: none; /* Hide toggle arrow on desktop */
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

/* ==========================================
   MOBILE MEDIA QUERY (<= 768px)
   ========================================== */
@media (max-width: 768px) {
    .fleet-metrics-header {
        cursor: pointer;
        user-select: none;
        padding: 5px 0;
    }

    /* Show arrow indicator on mobile */
    .fleet-toggle-icon {
        display: inline-block;
    }

    /* Collapse content by default on mobile */
    .fleet-metrics-body {
        display: none;
        margin-top: 10px;
    }

    /* Expanded class states toggled by JS */
    .fleet-metrics-body.is-expanded {
        display: block !important;
    }

    .fleet-metrics-header.is-expanded .fleet-toggle-icon {
        transform: rotate(180deg);
    }
}

/* Base Desktop Styles */
.clock-desktop {
    display: inline;
}

.clock-mobile {
    display: none; /* Hide compact time on desktop */
}

/* ==========================================
   MOBILE MEDIA QUERY (<= 768px)
   ========================================== */
@media (max-width: 768px) {
    .clock-desktop {
        display: none !important; /* Hide full date string on mobile */
    }

    .clock-mobile {
        display: inline !important; /* Show compact time on mobile */
        font-size: 0.85rem;
        font-weight: 600;
        white-space: nowrap;
    }
}