/* ===================================
   UNIFIED CSS VARIABLES - EMERGENCY-COM SYNC
   =================================== */
:root {
    --primary-color: #4c8a89;
    --primary-hover: #3d706f;
    --secondary-color: #3a506b;
    --tertiary-color: #1c2541;
    --dark-color: #0b132b;
    --light-bg: #f8fafc;
    
    --text-color: #171717;
    --text-secondary: #575757;
    --bg-color: #f4f7f6;
    --header-bg: #ffffff;
    --footer-bg: #fafafa;
    --nav-text: #171717;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --max-width: 1400px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Admin Header & Sidebar Tokens */
    --admin-header-height: 70px;
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #1e293b;
    --sidebar-surface: #0f172a;
    --sidebar-border: #334155;
    --sidebar-text: #f8fafc;
    --sidebar-text-muted: #94a3b8;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: #4c8a89;
    --sidebar-active-text: #ffffff;
}

/* Dark mode variables */
[data-theme="dark"] {
    --text-color: #f8fafc;
    --text-secondary: #94a3b8;
    --bg-color: #0f172a;
    --header-bg: #1e293b;
    --footer-bg: #1e293b;
    --nav-text: #f8fafc;
    --border-color: #334155;
    --card-bg: #1e293b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    
    --sidebar-bg: #0f172a;
    --sidebar-surface: #020617;
    --sidebar-border: #1e293b;
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ===================================
   CUSTOM SCROLLBAR STYLES
   =================================== */
/* Main scrollbar (body/html) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color-1);
    border-left: 1px solid var(--border-color-1);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color-1);
    border-radius: 5px;
    border: 2px solid var(--bg-color-1);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary-1);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color-1) var(--bg-color-1);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* For containers that might have overflow */
.scrollable-container,
.mobile-nav,
.modal-content,
.dropdown-menu,
.overflow-auto,
.overflow-y-auto,
.overflow-x-auto {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color-1) var(--card-bg-1);
}

.scrollable-container::-webkit-scrollbar,
.mobile-nav::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.dropdown-menu::-webkit-scrollbar,
.overflow-auto::-webkit-scrollbar,
.overflow-y-auto::-webkit-scrollbar,
.overflow-x-auto::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollable-container::-webkit-scrollbar-track,
.mobile-nav::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.dropdown-menu::-webkit-scrollbar-track,
.overflow-auto::-webkit-scrollbar-track,
.overflow-y-auto::-webkit-scrollbar-track,
.overflow-x-auto::-webkit-scrollbar-track {
    background: var(--card-bg-1);
    border-radius: 3px;
}

.scrollable-container::-webkit-scrollbar-thumb,
.mobile-nav::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.dropdown-menu::-webkit-scrollbar-thumb,
.overflow-auto::-webkit-scrollbar-thumb,
.overflow-y-auto::-webkit-scrollbar-thumb,
.overflow-x-auto::-webkit-scrollbar-thumb {
    background: var(--border-color-1);
    border-radius: 3px;
}

.scrollable-container::-webkit-scrollbar-thumb:hover,
.mobile-nav::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.dropdown-menu::-webkit-scrollbar-thumb:hover,
.overflow-auto::-webkit-scrollbar-thumb:hover,
.overflow-y-auto::-webkit-scrollbar-thumb:hover,
.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary-1);
}


/* ===================================
   HEADER STYLES
   =================================== */
.header {
    background-color: var(--header-bg-1);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color-1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    gap: 1rem;
}

/* ====== LOGO FIXES ====== */

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-img {
    height: 60px;             /* Better size for visibility */
    width: auto;               /* Maintain proportions */
    object-fit: contain;       /* Prevent distortion */
    transition: transform 0.25s ease;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .logo-img {
        height: 80px;          /* smaller on tablets */
    }
}

@media (max-width: 480px) {
    .logo-img {
        height: 70px;          /* smaller on phones */
    }
}


/* Navigation */
.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 800px;
    background: transparent;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    justify-content: center;
    flex-wrap: nowrap;
    background: transparent;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
    position: relative;
}

.nav-link:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

.nav-link.active {
    color: #ffffff;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color-1);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

/* Navigation Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--nav-text-1);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.mobile-menu-toggle:hover {
    background-color: var(--border-color-1);
}

/* ===================================
   BUTTON STYLES
   =================================== */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Disabled / non-interactive buttons (including anchor-like buttons) */
.btn.disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
}

.btn-primary {
    background-color: var(--primary-color-1);
    color: white;
    border-color: var(--primary-color-1);
}

.btn-primary:hover {
    background-color: #4ca8a6;
    border-color: #4ca8a6;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color-1);
    border-color: var(--border-color-1);
}

.btn-secondary:hover {
    background-color: var(--border-color-1);
    border-color: var(--primary-color-1);
    color: var(--primary-color-1);
}

/* ===================================
   MOBILE NAVIGATION
   =================================== */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--header-bg-1);
    border-left: 1px solid var(--border-color-1);
    transition: right 0.3s ease, visibility 0s 0.3s;
    z-index: 1001;
    overflow-y: auto;
    overflow-x: hidden;
    display: block !important;
    visibility: hidden;
}

.mobile-nav.active {
    right: 0;
    visibility: visible;
    transition: right 0.3s ease, visibility 0s 0s;
}

.mobile-nav-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color-1);
    background: var(--header-bg-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    width: 100%;
}

.mobile-nav-logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color-1);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-nav-logo i {
    color: var(--primary-color-1);
}

.mobile-nav-close {
    background: none;
    border: none;
    color: var(--nav-text-1);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.mobile-nav-close:hover {
    background-color: var(--border-color-1);
    color: var(--primary-color-1);
}

.mobile-nav-menu {
    list-style: none;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
}

.mobile-nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color-1);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mobile-nav-link:hover {
    background-color: var(--border-color-1);
    color: var(--primary-color-1);
}

.mobile-nav-link.active {
    background-color: var(--primary-color-1);
    color: white;
}

/* Mobile Divider */
.mobile-nav-divider {
    height: 1px;
    background-color: var(--border-color-1);
    margin: 1rem 0;
}

/* Mobile Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   FOOTER STYLES
   =================================== */
.footer {
    background-color: var(--footer-bg-1);
    color: var(--text-color);
    margin-top: auto;
    transition: all 0.3s ease;
    border-top: 1px solid var(--border-color-1);
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-main {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 3rem;
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border-color-1);
}

/* Footer Brand */
.footer-brand {
    max-width: 280px;
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color-1);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.footer-logo i {
    color: var(--primary-color-1);
}

.footer-logo-img {
    width: auto;
    height: 60px;
    object-fit: contain;
}

.footer-description {
    color: var(--text-secondary-1);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-social {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color-1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary-1);
    text-decoration: none;
    transition: all 0.2s ease;
}

.social-link:hover {
    border-color: var(--primary-color-1);
    color: var(--primary-color-1);
    transform: translateY(-1px);
}

/* Footer Columns */
.footer-column h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color-1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-link {
    color: var(--text-secondary-1);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-color-1);
}

/* Footer Bottom */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    flex-wrap: nowrap;
    gap: 1rem;
}

.footer-copyright {
    color: var(--text-secondary-1);
    font-size: 12px;
    flex-shrink: 0;
}

.footer-legal {
    display: flex;
    gap: 1.5rem;
    flex-shrink: 0;
}

.footer-legal .footer-link {
    font-size: 12px;
}

/* ===================================
   THEME TOGGLE
   =================================== */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--card-bg-1);
    border: 1px solid var(--border-color-1);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary-1);
    font-size: 14px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.theme-toggle-btn:hover {
    color: var(--text-color-1);
    background-color: var(--border-color-1);
}

.theme-toggle-btn.active {
    background: var(--primary-color-1);
    color: white;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Desktop - Hide mobile elements */
@media (min-width: 1025px) {
    .mobile-nav {
        display: none !important;
    }
    
    .mobile-nav-overlay {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* Tablet - Show mobile menu */
@media (max-width: 1024px) {
    .nav-center {
        display: none;
    }
    
    .nav-actions .btn {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .mobile-nav {
        display: block !important;
    }
}

/* Medium screens - Adjust navigation */
@media (max-width: 900px) {
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 13px;
    }
    
    .header-container {
        gap: 1rem;
    }
}

/* Mobile - Adjust layouts */
@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
    }
    
    .mobile-nav-menu {
        padding-bottom: 2rem;
    }
    
    .mobile-nav-menu .btn {
        margin-top: 1rem;
    }
    
    .mobile-nav-link {
        margin-bottom: 0.5rem;
    }
    
    .footer-container {
        padding: 0 0.75rem;
    }
    
    .footer-main {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 2rem 0 1.5rem;
    }
    
    .footer-brand {
        grid-column: 1 / -1;
        max-width: 100%;
        margin-bottom: 1rem;
        text-align: center;
        margin: 0 auto 1rem;
    }
    
    .footer-logo {
        justify-content: center;
    }
    
    .footer-description {
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        padding: 1.5rem 0;
    }
    .theme-toggle {
        order: -1;
    }
}

/* Small Mobile - Single column */
@media (max-width: 480px) {
    .header-container {
        padding: 0 0.75rem;
    }
    
    .footer-container {
        padding: 0 0.5rem;
    }
    
    .footer-main {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-column {
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-bottom {
        text-align: center;
        align-items: center;
    }
    
    .theme-toggle {
        order: 0;
    }
}

/* ===================================
   CASE DETAILS STYLES
   =================================== */
.timeline-item {
    border-left: 3px solid #0d6efd;
    padding-left: 20px;
    margin-bottom: 20px;
    position: relative;
}

.timeline-item:before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    width: 12px;
    height: 12px;
    background: #0d6efd;
    border-radius: 50%;
    border: 2px solid white;
}

.status-badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.priority-badge {
    font-weight: 600;
}

.cursor-pointer {
    cursor: pointer;
}

.attachment-item:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s;
}

/* ===================================
   BLOTTER VIEW STYLES
   =================================== */
/* Hide AI Assistant Chatbot */
.alertara-chat,
.alertara-chat-widget,
iframe[src*="chat"],
iframe[src*="assistant"],
[class*="ai-chat"],
[class*="ai-assistant"],
[id*="ai-chat"],
[id*="ai-assistant"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.letter-header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 3px solid #1a5490;
    margin-bottom: 20px;
    position: relative;
}

.letter-header-logo {
    height: 60px;
    margin-bottom: 10px;
}

.favicon-top-right {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 80px;
    height: 80px;
}

.letter-header h3 {
    margin: 5px 0;
    color: #1a5490;
    font-weight: bold;
}

.letter-header p {
    margin: 2px 0;
    color: #666;
    font-size: 13px;
}

.blotter-print-container {
    font-family: Arial, sans-serif;
}

.blotter-print-container h6 {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.blotter-print-container p {
    font-size: 14px;
    color: #222;
    margin: 0;
    padding-bottom: 8px;
}

.signature-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.signature-block {
    display: inline-block;
    width: 30%;
    text-align: center;
    margin-right: 5%;
    vertical-align: top;
    page-break-inside: avoid;
}

.signature-line {
    border-top: 1px solid #000;
    margin-top: 50px;
    margin-bottom: 5px;
    height: 1px;
}

.signature-name {
    font-weight: bold;
    font-size: 13px;
    margin-top: 5px;
}

.signature-title {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.signature-date {
    margin-top: 20px;
    font-size: 13px;
    text-align: center;
}

.blotter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 12px;
    padding-bottom: 12px;
}

.blotter-row-4col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 12px;
    padding-bottom: 12px;
}

.blotter-field {
    min-height: auto;
}

.blotter-field h6 {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html, body {
        margin: 0;
        padding: 0;
        background: white;
    }

    .main-content {
        margin: 0;
        padding: 20px;
        background: white;
    }

    .content-container {
        margin: 0;
        padding: 0;
        background: white;
    }

    .d-flex.justify-content-between,
    .action-buttons,
    .navbar,
    .footer,
    .btn,
    button,
    .alertara-chat,
    .alertara-chat-widget,
    iframe[src*="chat"],
    iframe[src*="assistant"],
    [class*="chat"],
    [class*="assistant"],
    [id*="chat"],
    [id*="assistant"] {
        display: none !important;
    }

    .card {
        border: 1px solid #333;
        page-break-inside: avoid;
        margin: 0;
        box-shadow: none;
    }

    .card-header {
        background-color: #f5f5f5 !important;
        border-bottom: 2px solid #333;
        padding: 12px 15px !important;
    }

    .card-header h5 {
        margin: 0;
        font-size: 16px;
        font-weight: bold;
    }

    .card-body {
        padding: 20px !important;
    }

    .blotter-row,
    .blotter-row-4col {
        border-bottom: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .blotter-field {
        page-break-inside: avoid;
    }

    .alert,
    hr {
        display: none !important;
    }

    .bg-light {
        background-color: #f9f9f9 !important;
        border: 1px solid #ddd;
        padding: 12px !important;
        margin: 8px 0;
    }

    p {
        margin: 0;
        padding: 0;
        line-height: 1.4;
    }

    h6 {
        margin: 0;
        padding: 0;
    }

    .letter-header {
        text-align: center;
        border-bottom: 3px solid #1a5490 !important;
        padding: 20px 0 !important;
        margin-bottom: 20px !important;
        position: relative;
    }

    .favicon-top-right {
        display: block !important;
        position: absolute;
        top: 10px;
        right: 10px;
        width: 80px;
        height: 80px;
    }

    .letter-header-logo {
        display: none;
    }

    .signature-section {
        page-break-inside: avoid;
    }

    .signature-block {
        page-break-inside: avoid;
        display: inline-block;
        width: 30%;
    }
}

/* ===================================
   ADMIN HEADER & SIDEBAR SYNC (EMERGENCY-COM)
   =================================== */

/* Admin Header */
.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--admin-header-height);
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease, left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 993px) {
    body.has-sidebar .admin-header {
        left: 280px;
        width: calc(100% - 280px);
    }

    body.has-sidebar.sidebar-collapsed .admin-header {
        left: 0 !important;
        width: 100% !important;
    }
}

body.has-sidebar {
    padding-left: var(--sidebar-width);
    padding-top: var(--admin-header-height);
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.has-sidebar.sidebar-collapsed {
    padding-left: 0 !important;
}

/* Header Left */
.admin-header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.25rem;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 1055 !important;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.menu-toggle i {
    pointer-events: none !important;
}

.menu-toggle:hover {
    background-color: rgba(76, 138, 137, 0.1);
    color: var(--primary-color);
}

.header-brand-title {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

/* Search Bar */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 380px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 138, 137, 0.15);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1050;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.15s ease;
}

.search-result-item:hover,
.search-result-item.selected {
    background-color: rgba(76, 138, 137, 0.1);
    color: var(--primary-color);
}

/* Header Right */
.admin-header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.datetime-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(76, 138, 137, 0.08);
    padding: 0.4rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.time-separator {
    opacity: 0.4;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Theme Toggle Pill */
.theme-toggle-container {
    display: flex;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 3px;
    gap: 2px;
}

.theme-mode-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-mode-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* Header Action Buttons & Notification Dropdown */
.header-action-btn {
    background: var(--bg-color, #ffffff);
    border: 1px solid var(--border-color, #dfe7e6);
    color: var(--text-color, #1f2e2d);
    width: 38px;
    height: 38px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-action-btn:hover {
    background: rgba(76, 138, 137, 0.1);
    color: var(--primary-color, #4c8a89);
}

.notification-badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc2626;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    border: 2px solid #ffffff;
    line-height: 1;
}

.notification-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: #ffffff;
    border: 1px solid #dfe7e6;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1050;
    overflow: hidden;
}

.notification-dropdown-menu.active {
    display: block;
    animation: fadeInDown 0.2s ease;
}

.notification-header {
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #dfe7e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-header h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2e2d;
}

.notification-body {
    max-height: 280px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: #1f2e2d;
    transition: background 0.15s ease;
}

.notification-item:hover {
    background: #f1f5f9;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.icon-blotter { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
.icon-user { background: rgba(37, 99, 235, 0.1); color: #2563eb; }

.notification-content {
    display: flex;
    flex-direction: column;
}

.notification-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1f2e2d;
    line-height: 1.2;
}

.notification-desc {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 2px;
}

.notification-time {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 3px;
}

.notification-footer {
    padding: 0.65rem 1rem;
    text-align: center;
    background: #f8fafc;
    border-top: 1px solid #dfe7e6;
}

.notification-footer a {
    font-size: 0.78rem;
    font-weight: 600;
    color: #4c8a89;
    text-decoration: none;
}

.header-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
}

/* User Profile Badge */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s ease;
}

.user-profile:hover {
    background: rgba(76, 138, 137, 0.08);
}

.user-info {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.user-avatar .avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

/* Sidebar Component */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1e293b;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.08);
}

.sidebar-header,
.sidebar-content,
.sidebar-footer {
    background-color: #ffffff !important;
}

.sidebar-header {
    height: var(--admin-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-close-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.15rem;
    cursor: pointer !important;
    padding: 0.4rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
    background-color: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.sidebar-close-btn i {
    pointer-events: none;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-brand i {
    font-size: 1.4rem;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-muted);
    padding: 0.75rem 0.75rem 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    transition: color 0.2s ease;
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: var(--sidebar-hover-bg);
}

.sidebar-link.active {
    color: var(--sidebar-active-text);
    background-color: var(--sidebar-active-bg);
}

.sidebar-link.active i {
    color: #ffffff;
}

.sidebar-footer {
    padding: 0.85rem 1rem !important;
    border-top: 1px solid var(--sidebar-border, #e2e8f0) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    margin-top: auto !important;
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logout-btn {
    color: #dc2626 !important;
    background: rgba(239, 68, 68, 0.1) !important;
    border: none;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer !important;
    padding: 0.45rem 0.75rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
    color: #ffffff !important;
    background: #dc2626 !important;
}

/* Desktop Sidebar Always Visible */
@media (min-width: 993px) {
    .sidebar {
        transform: translateX(0) !important;
    }
}

/* Sidebar Responsive & Mobile Drawer */
@media (max-width: 992px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        z-index: 1060 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none;
    }

    body.has-sidebar {
        padding-left: 0 !important;
    }

    .sidebar.active,
    .sidebar.show {
        transform: translateX(0) !important;
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.6) !important;
    }

    body.sidebar-mobile-open {
        overflow: hidden !important;
    }
}

.sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(3px) !important;
    z-index: 1050 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
}

.sidebar-overlay.active,
.sidebar-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
}

/* EMERGENCY-COM Sidebar Per-Module Accent Icon Colors */
.sidebar-accent-dashboard i { color: #2563eb !important; }
.sidebar-accent-users i { color: #16a34a !important; }
.sidebar-accent-approvals i { color: #9333ea !important; }
.sidebar-accent-profile i { color: #f97316 !important; }
.sidebar-accent-settings i { color: #64748b !important; }
.sidebar-accent-mass i { color: #dc2626 !important; }
.sidebar-accent-categorization i { color: #0d9488 !important; }
.sidebar-accent-2way i { color: #4f46e5 !important; }
.sidebar-accent-auto i { color: #d97706 !important; }
.sidebar-accent-multilang i { color: #db2777 !important; }
.sidebar-accent-citizen i { color: #64748b !important; }
.sidebar-accent-audit i { color: #06b6d4 !important; }
.sidebar-accent-overview i { color: #06b6d4 !important; }
.sidebar-accent-weather i { color: #0ea5e9 !important; }
.sidebar-accent-language i { color: #8b5cf6 !important; }

/* Light Mode Sidebar Pill Styling matching EMERGENCY-COM */
.sidebar-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6a7f7d;
    padding: 0.85rem 0.85rem 0.35rem;
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    color: #1f2e2d;
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background-color: #d7eeea;
    color: #1b5a56;
}

.sidebar-link.active {
    background-color: #e6f4f2;
    color: #1b5a56;
    font-weight: 600;
}

.sidebar-link.active i {
    color: #1b5a56 !important;
}

/* Sidebar Header Brand Logo Badge */
.alertara-badge-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.5rem;
    background: rgba(76, 138, 137, 0.08);
    border: 1px solid rgba(76, 138, 137, 0.2);
    text-decoration: none;
}

.brand-icon {
    font-size: 1.5rem;
    color: #4c8a89;
}

.brand-text-wrap {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1f2e2d;
    line-height: 1;
    letter-spacing: 0.04em;
}

.brand-subtitle {
    font-size: 0.65rem;
    font-weight: 700;
    color: #6a7f7d;
    letter-spacing: 0.1em;
}

/* Sidebar Footer User Info */
.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid #dfe7e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    margin-top: auto;
}

.sidebar-user-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4c8a89;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2e2d;
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: #6a7f7d;
}

/* Sidebar Dropdown Accordion Styles - Premium & Polished */
.sidebar-section-title {
    font-family: 'Quicksand', 'Inter', system-ui, -apple-system, sans-serif !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #6a7f7d !important;
    padding: 0.85rem 0.85rem 0.35rem !important;
    margin: 0 !important;
}

.sidebar-menu,
.sidebar-submenu {
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sidebar-menu-item,
.sidebar-submenu-item {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove default bullet markers pseudo elements */
.sidebar-submenu-item::before,
.sidebar-submenu-item::after {
    content: none !important;
    display: none !important;
}

.sidebar-menu-item.has-dropdown {
    position: relative !important;
}

.sidebar-dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer !important;
    user-select: none !important;
    text-decoration: none !important;
}

.dropdown-arrow {
    font-size: 0.75rem !important;
    margin-left: auto !important;
    transition: transform 0.25s ease !important;
    opacity: 0.7 !important;
}

.sidebar-menu-item.has-dropdown.open .dropdown-arrow {
    transform: rotate(180deg) !important;
}

.sidebar-link.active-parent {
    background-color: rgba(76, 138, 137, 0.12) !important;
    color: #1b5a56 !important;
    font-weight: 600 !important;
}

/* Submenu container */
.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 0.25rem !important;
    padding: 0.35rem 0 0.35rem 0.85rem !important;
    margin-left: 0.85rem !important;
    border-left: 2px solid rgba(76, 138, 137, 0.2) !important;
}

.sidebar-submenu.show {
    display: flex !important;
}

/* Submenu Link Styling - Clean, bullet-free, no underlines */
aside.sidebar .sidebar-submenu-link,
a.sidebar-submenu-link,
.sidebar-submenu-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
    padding: 0.5rem 0.75rem !important;
    color: #334155 !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    font-family: 'Quicksand', 'Inter', system-ui, -apple-system, sans-serif !important;
    transition: all 0.2s ease !important;
    background: transparent !important;
    box-shadow: none !important;
}

aside.sidebar .sidebar-submenu-link:focus,
aside.sidebar .sidebar-submenu-link:hover,
aside.sidebar .sidebar-submenu-link:visited,
aside.sidebar .sidebar-submenu-link:active,
a.sidebar-submenu-link:focus,
a.sidebar-submenu-link:hover,
a.sidebar-submenu-link:visited,
a.sidebar-submenu-link:active {
    text-decoration: none !important;
}

.sidebar-submenu-link .sidebar-subicon,
.sidebar-submenu-link i {
    font-size: 0.85rem !important;
    width: 18px !important;
    text-align: center !important;
    color: #0284c7 !important;
    transition: transform 0.2s ease, color 0.2s ease !important;
}

aside.sidebar .sidebar-submenu-link:hover,
a.sidebar-submenu-link:hover {
    background-color: #e6f4f2 !important;
    color: #1b5a56 !important;
    transform: translateX(3px) !important;
    text-decoration: none !important;
}

aside.sidebar .sidebar-submenu-link:hover .sidebar-subicon,
aside.sidebar .sidebar-submenu-link:hover i {
    color: #1b5a56 !important;
    transform: scale(1.1) !important;
}

aside.sidebar .sidebar-submenu-link.active,
a.sidebar-submenu-link.active {
    background-color: #4c8a89 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(76, 138, 137, 0.35) !important;
    text-decoration: none !important;
}

aside.sidebar .sidebar-submenu-link.active .sidebar-subicon,
aside.sidebar .sidebar-submenu-link.active i {
    color: #ffffff !important;
}

/* Dark Theme Support for Submenus */
[data-theme="dark"] .sidebar-section-title,
body.dark-mode .sidebar-section-title {
    color: #94a3b8 !important;
}

[data-theme="dark"] .sidebar-submenu,
body.dark-mode .sidebar-submenu {
    border-left-color: rgba(100, 255, 218, 0.25) !important;
}

[data-theme="dark"] .sidebar-link:hover,
body.dark-mode .sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #64ffda !important;
}

[data-theme="dark"] .sidebar-link.active-parent,
body.dark-mode .sidebar-link.active-parent {
    background-color: rgba(100, 255, 218, 0.15) !important;
    color: #64ffda !important;
}

[data-theme="dark"] aside.sidebar .sidebar-submenu-link,
[data-theme="dark"] a.sidebar-submenu-link,
[data-theme="dark"] .sidebar-submenu-link,
body.dark-mode aside.sidebar .sidebar-submenu-link,
body.dark-mode a.sidebar-submenu-link,
body.dark-mode .sidebar-submenu-link {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .sidebar-submenu-link:hover,
body.dark-mode .sidebar-submenu-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #64ffda !important;
}

[data-theme="dark"] .sidebar-submenu-link.active,
body.dark-mode .sidebar-submenu-link.active {
    background-color: #4c8a89 !important;
    color: #ffffff !important;
}
