:root {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #eab308;
    --border: #334155;
    --radius: 0.5rem;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.mobile-bottom-bar {
    display: none;
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 20px;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Auth Pages */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

button.btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

button.btn:hover {
    background: var(--primary-hover);
}

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    /* WIDER (Was 250px) */
    gap: 1.5rem;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    /* Optional: make it sticky if the list is long, but grid handles height well usually */
}

.nav-link {
    display: flex;
    /* Changed from block to flex for alignment */
    align-items: center;
    padding: 0.5rem 0.75rem;
    /* COMPACT (Was 0.75rem 1rem) */
    color: var(--text-secondary);
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    font-size: 0.9rem;
    /* Fixed consistent size */
    font-weight: 500;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.main-content {
    padding: 1.5rem;
}


/* Page Header - Consistent across all Admin Pages */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 1.25rem;
    /* Smaller as requested */
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.page-header .subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    /* Prevent overflow */
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    /* COMPACT (Was 1rem) */
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

td {
    color: var(--text-primary);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(234, 179, 8, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Buttons */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Landing Page Specifics */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    /* Standard property */
    -webkit-text-fill-color: transparent;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    transition: transform 0.2s;
}

.pricing-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.price {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    color: var(--text-primary);
}

.features-list {
    list-style: none;
    margin: 2rem 0;
    text-align: left;
}

.features-list li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.features-list li::before {
    content: "✓";
    color: var(--success);
    margin-right: 0.5rem;
    font-weight: bold;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 2rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    animation: modalSlideIn 0.3s ease;
    max-height: 90vh;
    /* Login scroll */
    overflow-y: auto;
    /* Login scroll */
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

tr.clickable-row:hover {
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

/* Card Grid System */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.router-card,
.olt-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: transform 0.2s;
    position: relative;
}

.router-card:hover,
.olt-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-online {
    background: #22c55e;
}

.status-offline {
    background: var(--warning);
}

/* Search Box in Header */
.search-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 250px;
}

/* Mobile Responsiveness */
/* Mobile Responsiveness */
@media (max-width: 768px) {
    .dashboard-grid {
        display: flex;
        flex-direction: column;
        min-height: auto;
        padding-bottom: 70px;
        /* Space for bottom bar */
    }

    .sidebar {
        display: none !important;
        /* Hide default sidebar on mobile */
    }

    /* Mobile Bottom Bar - FIXED POSITION */
    .mobile-bottom-bar {
        display: flex !important;
        /* Force show */
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        padding: 0.5rem;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        height: 60px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 0.7rem;
        flex: 1;
        padding: 0.25rem;
    }

    .mobile-nav-item.active {
        color: var(--primary);
    }

    .mobile-nav-item svg {
        width: 24px;
        height: 24px;
        margin-bottom: 2px;
    }

    .main-content {
        padding: 0.5rem;
        width: 100%;
        overflow-x: hidden;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    /* Customer Stats (Requested: 4 columns, smaller sizing) */
    .customer-stats-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.5rem !important;
    }

    .customer-stats-grid .stat-card {
        padding: 0.5rem !important;
        min-height: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .customer-stats-grid .stat-title {
        font-size: 0.6rem !important;
        margin-bottom: 0.1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    .customer-stats-grid .stat-value {
        font-size: 0.9rem !important;
    }

    /* General Stats Grid (Default) */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Adjust specific components for mobile */
    .table-container,
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 1rem;
    }

    table {
        min-width: 600px;
        font-size: 0.8rem;
    }

    th,
    td {
        padding: 0.4rem !important;
        /* Tighter mobile cells */
    }

    /* Pending Payments Specific adjustments */
    .proof-thumb {
        width: 50px !important;
        height: 50px !important;
    }

    /* Hide desktop-only columns on mobile */
    .desktop-only {
        display: none !important;
    }

    /* Tighter Mobile Layout */
    .cust-info-cell {
        display: flex;
        flex-direction: column;
        gap: 0;
        /* No gap */
        line-height: 1.2;
        /* Tighter lines */
    }

    .cust-name {
        font-weight: 600;
        margin-bottom: 2px;
    }

    /* Ensure Details (Package + Status) are consistent */
    .cust-details-mobile {
        display: block;
        /* Show on mobile */
        font-size: 0.7rem;
        /* Smaller font */
        color: var(--text-secondary);
        margin-top: 0;
        margin-left: 15px;
        /* Indent to match name text */
        line-height: 1.2;
    }

    .mobile-status-badge {
        margin-top: 2px;
        display: block;
        /* Force new line */
    }

    /* Modern Action Icons helper for mobile (and desktop) */
    .cust-action-cell .btn-wa {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        /* Circle */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        transition: transform 0.2s, box-shadow 0.2s;
        padding: 0;
    }

    .cust-action-cell .btn-wa:active {
        transform: scale(0.95);
    }

    /* Adjust icon size inside */
    .cust-action-cell .btn-wa svg {
        width: 16px;
        height: 16px;
    }

    /* Toolbar Mobile Optimization */
    .toolbar {
        display: flex !important;
        /* Force flex */
        flex-direction: row !important;
        /* Force row */
        flex-wrap: nowrap !important;
        /* No wrapping */
        gap: 0.5rem;
        align-items: center;
        width: 100%;
        /* Full width */
    }

    .toolbar-search {
        flex: 1;
        /* Search takes available space */
        min-width: 0;
        /* Allow shrinking */
    }

    .toolbar-actions {
        display: flex;
        gap: 0.5rem;
        flex-shrink: 0;
        /* Buttons don't shrink */
    }

    .toolbar .btn {
        padding: 0.5rem !important;
        /* Smaller pivot */
        font-size: 0.8rem !important;
        white-space: nowrap;
    }

    .toolbar .btn svg {
        width: 14px;
        height: 14px;
    }
}

/* GLOBAL Table Scroll Container (Desktop & Mobile) */
.table-container {
    width: 100%;
    overflow-x: auto;
    /* Horizontal scroll */
    max-height: 75vh;
    /* Vertical scroll limit for Desktop too */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* For smooth scrolling on iOS */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* Global Action Button Style (if not mobile) */
.btn-wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: var(--radius);
    color: white;
    text-decoration: none;
    border: none;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-wa:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Ensure Mobile Details are HIDDEN on Desktop */
@media (min-width: 769px) {
    .cust-details-mobile {
        display: none !important;
    }
}