:root {
    /* "Support Team Dashboard" Inspired Dark Theme */
    --bg-color: #0f1219;
    /* Very dark background */
    --bg-gradient: linear-gradient(135deg, #0f1219 0%, #151926 100%);

    /* Sidebar */
    --sidebar-bg: #151926;
    --sidebar-text: #9ca3af;
    --sidebar-text-muted: #6b7280;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);

    /* Card Styling - Dark Panels */
    --card-bg: #1c2035;
    /* Dark Blue/Purpleish Gray */
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;

    /* Accents - Vibrant Neon Colors */
    --accent-color: #3b82f6;
    /* Bright Blue */
    --accent-hover: #2563eb;

    /* Stats Colors (from image) */
    --success-color: #22c55e;
    /* Green (Promoters) */
    --warning-color: #eab308;
    /* Yellow (Passives) */
    --danger-color: #ef4444;
    /* Red (Detractors) */
    --info-color: #06b6d4;
    /* Cyan */
    --purple-color: #8b5cf6;

    --border-color: #2d3348;
    /* Dark border */
    --hover-bg: #2d3348;

    /* Chart Colors */
    --chart-grid-color: #374151;

    --chart-grid-color: #374151;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100%;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    padding: 25px;
    display: flex;
    flex-direction: column;
    color: var(--sidebar-text);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border-right: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: white;
    gap: 12px;
    letter-spacing: -0.5px;
}

.logo i {
    color: var(--accent-color);
    /* Indigo accent in logo */
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 8px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--sidebar-text-muted);
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-item:hover {
    background-color: var(--sidebar-hover-bg);
    color: white;
    transform: translateX(3px);
}

.nav-item.active {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    /* Colored shadow */
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

/* --- Top Bar --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(79, 70, 229, 0.2);
}

.action-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* --- Status Indicator --- */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--warning-color);
}

.status-dot.connected {
    background-color: var(--success-color);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.gauges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.gauges-grid .chart-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    position: relative;
    background: var(--card-bg);
}

.gauges-grid canvas {
    max-height: 200px;
}

.gauge-label {
    margin-top: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    /* Sharper corners like reference */
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Add colored top border like reference for variety */
.stat-card:nth-child(1) {
    border-top: 3px solid var(--accent-color);
}

.stat-card:nth-child(2) {
    border-top: 3px solid var(--success-color);
}

.stat-card:nth-child(3) {
    border-top: 3px solid var(--danger-color);
}

.stat-card:nth-child(4) {
    border-top: 3px solid var(--warning-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--sidebar-text-muted);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    /* Darker semi-transparent backgrounds */
    background: rgba(255, 255, 255, 0.05);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

/* --- Charts & Tables --- */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.charts-container .chart-wrapper {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.charts-container canvas {
    flex: 1;
    max-height: 340px;
    width: 100% !important;
}

.chart-wrapper,
.table-container,
.operator-card {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    padding: 20px;
}

.chart-wrapper h3,
.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* --- Filters --- */
.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background: white;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.filter-input,
.search-input {
    background: #151926;
    /* Dark input bg */
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.filter-input:focus,
.search-input:focus {
    border-color: var(--accent-color);
    background: #0f1219;
}

.filter-btn {
    background-color: var(--text-primary);
    /* Dark button for filter */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
    /* Subtle hover */
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-badge::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.answered {
    background: #dcfce7;
    color: #166534;
}

.status-badge.busy {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.failed,
.status-badge.no-answer {
    background: #fee2e2;
    color: #991b1b;
}

/* --- Emergency Panel (Modern Cards) --- */
.emergency-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.emergency-card {
    border-radius: 8px;
    padding: 20px;
    border: none;
    position: relative;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    color: white;
    overflow: hidden;
}

.emergency-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(to top right, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.card-101 {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.card-102 {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.card-103 {
    background: linear-gradient(135deg, #22c55e, #15803d);
}

.card-104 {
    background: linear-gradient(135deg, #eab308, #a16207);
}

.e-card-number {
    font-size: 2.5rem;
    font-weight: 800;
}

.e-card-counter {
    font-size: 3rem;
    font-weight: 700;
}

/* --- Modals (Backdrop Blur) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    /* Slate backdrop */
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-btn {
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s;
    background: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn.primary {
    background-color: var(--accent-color);
    color: white;
}

.modal-btn:hover {
    transform: scale(1.02);
}

/* --- Responsive --- */
@media screen and (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        flex-direction: row;
        justify-content: space-around;
        padding: 10px;
        order: 2;
        /* Sidebar at bottom */
    }

    .main-content {
        padding: 15px;
        padding-bottom: 80px;
    }

    .nav-item span {
        display: none;
    }

    .nav-item {
        padding: 10px;
        justify-content: center;
    }

    .nav-item i {
        font-size: 1.4rem;
    }

    .logo,
    .sidebar-footer {
        display: none;
    }
}

/* Animations */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Page specific tweaks */
.login-background {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.login-card {
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-btn {
    background: var(--accent-color);
    border-radius: 10px;
    font-weight: 600;
}

.login-btn:hover {
    background: var(--accent-hover);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    background-attachment: fixed;
    /* Keep gradient fixed on scroll */
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* No blur needed for solid color */
    color: var(--sidebar-text);
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--sidebar-text);
    /* White logo text */
    gap: 10px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--sidebar-text-muted);
    /* Light grey for inactive */
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    /* Subtle white overlay */
    color: white;
    box-shadow: none;
    /* Flat style */
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

/* Base Responsive */
@media screen and (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100% !important;
        height: auto !important;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 999;
        border-right: none !important;
        border-top: 1px solid var(--border-color);
        padding: 8px 10px !important;
        flex-direction: row !important;
        justify-content: space-around;
        background: rgba(15, 23, 42, 0.95) !important;
        backdrop-filter: blur(15px);
    }

    .logo {
        display: none !important;
    }

    .nav-menu {
        flex-direction: row !important;
        width: 100%;
        gap: 0 !important;
        justify-content: space-around;
    }

    .nav-item {
        flex-direction: column;
        gap: 4px !important;
        padding: 8px !important;
        font-size: 0.65rem !important;
        flex: 1;
        justify-content: center;
        border-radius: 10px !important;
    }

    .nav-item i {
        font-size: 1.1rem;
        margin: 0 !important;
    }

    .nav-item span {
        font-size: 0.65rem;
    }

    .main-content {
        padding: 15px !important;
        padding-bottom: 90px !important;
        /* Space for bottom nav */
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .top-bar h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 15px !important;
        gap: 10px !important;
    }

    .stat-icon {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
    }

    .stat-value {
        font-size: 1.2rem !important;
    }

    .charts-container {
        grid-template-columns: 1fr !important;
    }

    .filters {
        width: 100%;
    }

    .filter-input,
    .search-input {
        flex: 1 1 45%;
        font-size: 0.85rem;
        padding: 8px 12px !important;
    }

    .table-container {
        padding: 10px !important;
        border-radius: 15px !important;
    }

    table {
        font-size: 0.75rem;
    }

    th,
    td {
        padding: 10px 8px !important;
    }
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--warning-color);
}

.status-dot.connected {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    /* Sharper corners for enterprise */
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: var(--card-bg);
    /* Keep transparent/white */
}

/* ... existing icons ... */

.chart-wrapper {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ... existing ... */

.table-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.incoming {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

.stat-icon.outgoing {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-icon.missed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stat-icon.duration {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2.2rem;
    /* Bigger for impact */
    font-weight: 700;
    color: var(--stats-number-color);
}

/* Charts & Widgets */
.charts-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.chart-wrapper {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.chart-wrapper h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.recent-calls-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mini-call-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.mini-call-item:last-child {
    border-bottom: none;
}

.mini-call-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.caller-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.call-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Tables */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input,
.filter-input {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-family);
}

.filter-input[type="date"] {
    color-scheme: light;
}

.filter-input option {
    background: var(--card-bg);
    color: var(--text-primary);
}

.table-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-weight: 500;
}

tbody tr:hover {
    background: var(--hover-bg);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.answered {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.status-badge.busy {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.status-badge.no-answer {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* Operators Grid */
.operators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

.operator-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.operator-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.operator-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.operator-avatar {
    width: 60px;
    height: 60px;
    background: var(--hover-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.operator-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.operator-extension {
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
}

.operator-status-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-online {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.status-busy {
    background: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
}

.status-offline {
    background: var(--text-secondary);
}

.operator-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.op-stat-item {
    text-align: center;
}

.op-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
}

.op-stat-value {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Emergency Services Panel */
.emergency-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.emergency-card {
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    color: white;
    /* Force white text for these dark cards */
}

/* Specific Service Colors */
.card-101 {
    background: linear-gradient(135deg, #4a1010 0%, #2c0b0b 100%);
    border-color: #ef4444;
}

.card-102 {
    background: linear-gradient(135deg, #102a4a 0%, #0b1a2c 100%);
    border-color: #3b82f6;
}

.card-103 {
    background: linear-gradient(135deg, #104a1f 0%, #0b2c12 100%);
    border-color: #22c55e;
}

.card-104 {
    background: linear-gradient(135deg, #4a3e10 0%, #2c250b 100%);
    border-color: #eab308;
}

.e-card-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
    line-height: 1;
}

.e-card-title {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.e-card-counter {
    font-size: 4rem;
    font-weight: 800;
    color: #fff;
    margin: 10px 0;
    line-height: 1;
}

.e-card-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 25px;
}

.e-card-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.e-card-ops {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.e-card-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Status badge overrides for specific cards */
.card-101 .e-card-status {
    background: #ef4444;
    color: white;
}

.card-102 .e-card-status {
    background: #3b82f6;
    color: white;
}

.card-103 .e-card-status {
    background: #22c55e;
    color: white;
}

.card-104 .e-card-status {
    background: #eab308;
    color: black;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.action-btn:hover {
    background-color: #059669;
    /* Slightly darker green */
}

.action-btn i {
    font-size: 1rem;
}

/* Login Page Styles */
/* Premium Login Page Styles */
.login-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    background: #0f172a;
}

.shape {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite ease-in-out alternate;
}

.shape-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
    animation-delay: 0s;
}

.shape-2 {
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
    animation-delay: -5s;
}

.shape-3 {
    top: 30%;
    left: 40%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, #10b981 0%, transparent 70%);
    opacity: 0.4;
    animation-delay: -2s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(30px, 30px) rotate(10deg);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 50px 40px;
    border-radius: 30px;
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

/* Shine effect on card hover */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    transition: 0.5s;
}

.login-card:hover::before {
    left: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo-icon {
    font-size: 3.5rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 6px rgba(59, 130, 246, 0.3));
}

.login-header h2 {
    font-size: 2rem;
    color: #ffffff;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-header p {
    color: #94a3b8;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 500;
    margin-left: 5px;
}

.input-wrapper {
    position: relative;
    transition: all 0.3s ease;
}

.input-wrapper i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    transition: color 0.3s;
    font-size: 1.1rem;
}

.input-wrapper .toggle-password {
    left: auto;
    right: 18px;
    cursor: pointer;
}

.input-wrapper .toggle-password:hover {
    color: #e2e8f0;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-wrapper input::placeholder {
    color: #475569;
}

.input-wrapper input:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.input-wrapper input:focus+i {
    color: #3b82f6;
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    margin-top: 10px;
}

.login-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn i {
    transition: transform 0.3s;
}

.login-btn:hover i {
    transform: translateX(4px);
}

.error-message {
    color: #ef4444;
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.95rem;
    min-height: 24px;
    font-weight: 500;
    background: rgba(239, 68, 68, 0.1);
    padding: 8px;
    border-radius: 8px;
    display: none;
    /* Hide when empty */
}

.error-message:not(:empty) {
    display: block;
    animation: shake 0.4s ease-in-out;
}

/* Filter Button */
.filter-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    height: 38px;
    /* Match typical input height */
}

.filter-btn:hover {
    background-color: #2563eb;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 15% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 450px;
    border-radius: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-btn {
    padding: 12px;
    border: 1px solid var(--border-color);
    background: var(--hover-bg);
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.modal-btn:hover {
    background: var(--bg-color);
    border-color: var(--accent-color);
}

.modal-btn.primary {
    background: var(--accent-color);
    color: white;
    border: none;
}

.modal-btn.primary:hover {
    background: #2563eb;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
}

.page-btn {
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-family: var(--font-family);
    backdrop-filter: blur(5px);
}

.page-btn:hover:not(:disabled) {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.page-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Chat Widget Styles --- */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    font-family: var(--font-family);
    transition: all 0.3s ease;
}

.chat-widget.collapsed {
    width: 250px;
    height: 50px;
}

.chat-header {
    background: var(--accent-color);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
}

.chat-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
}

.chat-body {
    display: flex;
    flex-direction: column;
    height: 350px;
    background: #f8fafc;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.sent {
    align-self: flex-end;
    background: var(--accent-color);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.received {
    align-self: flex-start;
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: white;
    border-bottom-left-radius: 2px;
}

.message.system {
    align-self: center;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-radius: 20px;
    padding: 4px 10px;
    text-align: center;
}

.message-meta {
    display: block;
    font-size: 0.7rem;
    margin-bottom: 2px;
    opacity: 0.8;
    font-weight: 600;
}

.message-time {
    display: block;
    font-size: 0.65rem;
    margin-top: 2px;
    opacity: 0.7;
    text-align: right;
}

.chat-input-area {
    padding: 10px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    background: #0f1219;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: white;
}

.chat-input-area input:focus {
    border-color: var(--accent-color);
}

.chat-input-area button {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-input-area button:hover {
    background: var(--accent-hover);
}

@media screen and (max-width: 768px) {
    .chat-widget {
        bottom: 70px;
        /* Above bottom nav */
        width: 100%;
        right: 0;
        left: 0;
        border-radius: 20px 20px 0 0;
    }

    .chat-widget.collapsed {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        bottom: 80px;
        right: 20px;
        left: auto;
    }

    .chat-widget.collapsed .chat-header span {
        display: none;
    }
}

/* File Attachment Styles */
.chat-input-area .icon-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.chat-input-area .icon-btn:hover {
    background: #f1f5f9;
    color: var(--accent-color);
}

.file-attachment {
    margin-bottom: 5px;
    background: rgba(0, 0, 0, 0.03);
    padding: 6px;
    border-radius: 8px;
}

.file-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.85rem;
}

.file-link:hover {
    text-decoration: underline;
}

.message.sent .file-link {
    color: white;
}