/* ==========================================================
   WA SaaS Gateway Ultra - Custom CSS
   Modern Glassmorphism & Sleek Dark-Accent UI
   ========================================================== */

:root {
    --primary-color: #25D366;
    --primary-hover: #1EBE5D;
    --primary-dark: #075E54;
    --primary-darker: #128C7E;
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-card: #1e293b;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --topbar-height: 65px;
    --accent-purple: #6366f1;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8fafc;
    color: #334155;
    overflow-x: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background: #0f172a;
    color: #e2e8f0;
    z-index: 1040;
    overflow-y: auto;
    transition: all 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
}

.sidebar .brand-section {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link {
    color: #94a3b8;
    padding: 0.7rem 1.15rem;
    margin: 0.15rem 0.8rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.sidebar .nav-link i:first-child,
.sidebar .nav-link > div > i {
    font-size: 1.15rem;
    margin-right: 0.75rem;
    color: #64748b;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-link:hover i:first-child,
.sidebar .nav-link:hover > div > i {
    color: #38bdf8;
}

.sidebar .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
    font-weight: 600;
}

.sidebar .nav-link.active i:first-child,
.sidebar .nav-link.active > div > i {
    color: #ffffff;
}

/* Dropdown Toggle & Chevron Animation */
.sidebar .nav-dropdown-toggle {
    user-select: none;
    font-size: 0.86rem;
    padding: 0.6rem 1rem;
}

.sidebar .nav-dropdown-toggle .arrow-icon {
    font-size: 0.7rem;
    margin-right: 0;
    color: #64748b;
    transition: transform 0.25s ease, color 0.2s ease;
}

.sidebar .nav-dropdown-toggle[aria-expanded="true"] .arrow-icon,
.sidebar .nav-dropdown-toggle:not(.collapsed) .arrow-icon {
    transform: rotate(180deg);
    color: #38bdf8;
}

.sidebar .nav-dropdown-toggle.active-parent {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.07);
    font-weight: 600;
}

.sidebar .nav-dropdown-toggle.active-parent > div > i {
    color: #25D366;
}

/* Sub-Menu Container & Hierarchical List */
.sidebar .sub-menu-list {
    border-left: 2px solid rgba(255, 255, 255, 0.12);
    margin-left: 1.6rem;
    padding-left: 0.35rem;
    margin-top: 0.15rem;
    margin-bottom: 0.35rem;
}

.sidebar .sub-nav-link,
.sidebar .nav-link.sub-nav-link {
    color: #94a3b8 !important;
    padding: 0.32rem 0.65rem !important;
    margin: 0.08rem 0.25rem 0.08rem 0 !important;
    border-radius: 0.375rem;
    font-size: 0.77rem !important;
    font-weight: 450;
    line-height: 1.35;
    transition: all 0.2s ease;
}

.sidebar .sub-nav-link i,
.sidebar .nav-link.sub-nav-link i,
.sidebar .sub-nav-link div i,
.sidebar .nav-link.sub-nav-link div i,
.sidebar .nav-link.sub-nav-link > div > i {
    font-size: 0.72rem !important;
    margin-right: 0.45rem !important;
    color: #64748b;
    transition: all 0.2s ease;
}

.sidebar .sub-nav-link:hover,
.sidebar .nav-link.sub-nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.sidebar .sub-nav-link:hover i,
.sidebar .nav-link.sub-nav-link:hover i,
.sidebar .nav-link.sub-nav-link:hover div i {
    color: #38bdf8 !important;
}

.sidebar .sub-nav-link.active,
.sidebar .nav-link.sub-nav-link.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0d9488 0%, #10b981 100%) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    font-weight: 600;
}

.sidebar .sub-nav-link.active i,
.sidebar .nav-link.sub-nav-link.active i,
.sidebar .nav-link.sub-nav-link.active div i {
    color: #ffffff !important;
}

.sidebar .sidebar-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 1.25rem 0.3rem;
    color: #475569;
    font-weight: 700;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow-x: hidden;
}

.top-navbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.content-body {
    padding: 1.75rem;
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Card Modern Style */
.card {
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 0.85rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    background: #ffffff;
    transition: all 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    border-radius: 0.85rem;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.stat-card .icon-shape {
    width: 48px;
    height: 48px;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Buttons & Badges */
.btn-wa {
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
    color: #ffffff;
    border: none;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-wa:hover {
    background: linear-gradient(135deg, #075E54 0%, #1EBE5D 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.bg-purple {
    background-color: #6366f1 !important;
}

.badge {
    padding: 0.4em 0.7em;
    font-weight: 500;
    font-size: 0.78rem;
    border-radius: 0.4rem;
}

/* Table Design */
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #64748b;
    border-top: none;
    background: #f8fafc;
}

.table td {
    vertical-align: middle;
    font-size: 0.88rem;
}

/* Code & Pre */
pre.code-block {
    background: #0f172a;
    color: #38bdf8;
    padding: 1rem;
    border-radius: 0.65rem;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.85rem;
    overflow-x: auto;
}

/* QR Code Box */
.qr-box {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 1rem;
    display: inline-block;
    border: 2px dashed #cbd5e1;
    text-align: center;
}

/* Auth Pages Background */
.auth-bg {
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #ffffff;
    border-radius: 1.2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 460px;
    width: 100%;
}

.auth-card .form-control {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.auth-card .form-control:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
    color: #ffffff;
}

/* Responsive Sidebar Toggle */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.show {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
}
