/* ================================================================== */
/* VoIP Switch — Custom CSS                                           */
/* Dark sidebar theme with light content area                          */
/* Responsive: sidebar collapses on tablet/mobile                      */
/* ================================================================== */

/* ---- CSS Variables for consistent theming ---- */
:root {
    --sidebar-bg: #1a1c23;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --sidebar-text: #b7b9cc;
    --sidebar-active-bg: rgba(78, 115, 223, 0.15);
    --sidebar-active-text: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --content-bg: #f4f6f9;
    --accent-color: #4e73df;
    --success-color: #1cc88a;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    --navbar-height: 60px;
}

/* ---- Global Reset / Body ---- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--content-bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ================================================================== */
/* SIDEBAR STYLES                                                      */
/* ================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar-bg);
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* ---- Sidebar Header / Brand ---- */
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-header i {
    font-size: 1.6rem;
    color: var(--accent-color);
}

/* ---- Sidebar Navigation ---- */
.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

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

.sidebar-item {
    margin: 2px 8px;
    border-radius: 6px;
}

/* ---- Sidebar Links ---- */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    gap: 12px;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link span {
    font-size: 0.9rem;
}

/* ---- Active Sidebar Item ---- */
.sidebar-item.active > .sidebar-link {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left: 3px solid var(--accent-color);
}

/* ---- Submenu Arrow ---- */
.submenu-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.sidebar-item.has-submenu.open .submenu-arrow,
.sidebar-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

/* ---- Sidebar Submenu ---- */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0 0 0 20px;
}

.sidebar-submenu li {
    margin: 2px 0;
}

.sidebar-submenu a {
    display: block;
    padding: 7px 16px 7px 36px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-submenu a:hover {
    color: #fff;
    background-color: var(--sidebar-hover-bg);
}

.sidebar-submenu li.active a {
    color: var(--sidebar-active-text);
    font-weight: 600;
}

/* ================================================================== */
/* MAIN CONTENT AREA                                                   */
/* ================================================================== */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* ---- Top Navbar ---- */
.top-navbar {
    height: var(--navbar-height);
    background-color: #fff;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.navbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.user-dropdown {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.user-dropdown:hover {
    color: var(--accent-color);
}

/* ---- Sidebar Toggle Button (mobile) ---- */
.sidebar-toggle {
    color: #333;
    text-decoration: none;
    padding: 4px 8px;
    margin-right: 12px;
}

/* ---- Content Area ---- */
.content-area {
    padding: 24px;
    flex: 1;
}

/* ================================================================== */
/* SIDEBAR OVERLAY — mobile backdrop                                   */
/* ================================================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ================================================================== */
/* LOGIN PAGE STYLES                                                   */
/* ================================================================== */

.login-page {
    background: linear-gradient(135deg, #1a1c23 0%, #2c3e50 50%, #1a1c23 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    font-size: 3rem;
    color: var(--accent-color);
}

.login-header h2 {
    font-weight: 700;
    color: #333;
    margin-top: 10px;
}

/* ================================================================== */
/* CARD & TABLE STYLING                                                */
/* ================================================================== */

.card {
    border: none;
    border-radius: 8px;
}

.card-header {
    border-bottom: 1px solid #e3e6f0;
    padding: 16px 20px;
}

.card-body {
    padding: 20px;
}

/* Hoverable table rows */
.table-hover tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.04);
}

/* Compact table cells */
.table-sm td, .table-sm th {
    padding: 8px 12px;
}

/* Table header styling */
.table-light th {
    background-color: #f8f9fc;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #666;
    border-bottom: 2px solid #e3e6f0;
}

/* ================================================================== */
/* FORM SWITCH (Toggle) — custom colors                                */
/* ================================================================== */

.form-check-input:checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

/* ================================================================== */
/* BADGE STYLING                                                       */
/* ================================================================== */

.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 4px 8px;
}

/* ================================================================== */
/* STAT CARDS (Dashboard)                                              */
/* ================================================================== */

.stat-card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

/* ---- Stat card left border colors ---- */
.stat-card.border-left-primary { border-left: 4px solid var(--accent-color); }
.stat-card.border-left-success { border-left: 4px solid var(--success-color); }
.stat-card.border-left-danger  { border-left: 4px solid var(--danger-color); }
.stat-card.border-left-warning { border-left: 4px solid var(--warning-color); }
.stat-card.border-left-info    { border-left: 4px solid var(--info-color); }

/* ================================================================== */
/* TOAST NOTIFICATIONS                                                 */
/* ================================================================== */

.toast-custom {
    min-width: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-custom .toast-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 0.9rem;
}

.toast-custom.toast-success { border-left: 4px solid var(--success-color); }
.toast-custom.toast-error   { border-left: 4px solid var(--danger-color); }
.toast-custom.toast-warning { border-left: 4px solid var(--warning-color); }
.toast-custom.toast-info    { border-left: 4px solid var(--info-color); }

/* ================================================================== */
/* PAGINATION                                                          */
/* ================================================================== */

.pagination .page-link {
    color: var(--accent-color);
    border-radius: 4px;
    margin: 0 2px;
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

/* ================================================================== */
/* MODAL OVERRIDES                                                     */
/* ================================================================== */

.modal-header {
    padding: 16px 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
}

/* ================================================================== */
/* RESPONSIVE — Tablet (992px and below)                               */
/* Sidebar collapses to icon-only mode                                 */
/* ================================================================== */

@media (max-width: 992px) and (min-width: 769px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar .sidebar-brand-text,
    .sidebar .sidebar-link span,
    .sidebar .submenu-arrow,
    .sidebar .sidebar-submenu {
        display: none;
    }

    .sidebar-header {
        padding: 20px 10px;
        justify-content: center;
    }

    .sidebar-link {
        justify-content: center;
        padding: 12px;
    }

    .sidebar-link i {
        font-size: 1.3rem;
    }

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

/* ================================================================== */
/* RESPONSIVE — Mobile (768px and below)                               */
/* Sidebar becomes off-canvas, toggled via hamburger button             */
/* ================================================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

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

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

    .content-area {
        padding: 16px;
    }

    /* Make stat cards stack on mobile */
    .stat-card .stat-value {
        font-size: 1.3rem;
    }

    /* Full-width modals on mobile */
    .modal-dialog {
        margin: 10px;
    }
}

/* ================================================================== */
/* UTILITY CLASSES                                                     */
/* ================================================================== */

/* Text truncation for long content in tables */
.text-truncate-custom {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Monospace font for numbers and IPs */
.font-mono {
    font-family: 'SFMono-Regular', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.85rem;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.4;
}
