/* ISP Billing Dashboard - Dark Theme */
:root {
    --primary: #00c2d1;
    --primary-dark: #00a8b5;
    --secondary: #6c757d;
    --success: #28c76f;
    --danger: #ea5455;
    --warning: #ff9f43;
    --info: #00cfe8;
    --dark: #1e1e2d;
    --darker: #161622;
    --card: #27273a;
    --card-hover: #2f2f45;
    --text: #d0d0e0;
    --text-muted: #8c8ca1;
    --border: #3a3a52;
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--darker);
    color: var(--text);
    overflow-x: hidden;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 45px; height: 45px;
    border-radius: var(--radius);
    object-fit: cover;
}

.sidebar-brand h3 {
    font-size: 16px;
    color: #fff;
    font-weight: 700;
}

.sidebar-brand span {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.nav-section { padding: 15px 0; }
.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 20px 10px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(0,194,209,0.08);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: 16px;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--dark);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px; height: 40px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 16px;
    transition: all 0.2s;
}

.notification-btn:hover { background: var(--card-hover); color: var(--primary); }

.notification-count {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.2s;
}

.user-menu:hover { background: var(--card); }

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* Notification Panel */
.notification-panel {
    position: absolute;
    top: calc(var(--topbar-height) + 10px);
    right: 25px;
    width: 360px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1001;
    display: none;
    overflow: hidden;
}

.notification-panel.active { display: block; }

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.notification-header h3 { font-size: 16px; color: #fff; }

.notification-list { max-height: 400px; overflow-y: auto; padding: 10px; }

.notification-item {
    padding: 12px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background 0.2s;
    cursor: pointer;
    margin-bottom: 6px;
}

.notification-item:hover { background: var(--dark); }

.notification-item i {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.notification-item.info i { background: rgba(0,207,232,0.15); color: var(--info); }
.notification-item.success i { background: rgba(40,199,111,0.15); color: var(--success); }
.notification-item.warning i { background: rgba(255,159,67,0.15); color: var(--warning); }
.notification-item.danger i { background: rgba(234,84,85,0.15); color: var(--danger); }

.notification-content { flex: 1; }
.notification-content p { font-size: 13px; color: var(--text); line-height: 1.4; }
.notification-content span { font-size: 11px; color: var(--text-muted); }

/* Content */
.content {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.cyan { background: rgba(0,194,209,0.15); color: var(--primary); }
.stat-icon.green { background: rgba(40,199,111,0.15); color: var(--success); }
.stat-icon.red { background: rgba(234,84,85,0.15); color: var(--danger); }
.stat-icon.orange { background: rgba(255,159,67,0.15); color: var(--warning); }
.stat-icon.purple { background: rgba(115,103,240,0.15); color: #7367f0; }
.stat-icon.blue { background: rgba(0,207,232,0.15); color: var(--info); }

.stat-info { flex: 1; }
.stat-info h4 {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

/* Data Card */
.data-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 25px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.card-tools {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-secondary {
    background: var(--dark);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--card-hover); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Tables */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: var(--darker);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.data-table tbody tr:last-child td { border-bottom: none; }

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-active { background: rgba(40,199,111,0.15); color: var(--success); }
.status-inactive { background: rgba(234,84,85,0.15); color: var(--danger); }
.status-danger { background: rgba(234,84,85,0.15); color: var(--danger); }
.status-warning { background: rgba(255,159,67,0.15); color: var(--warning); }
.status-pending { background: rgba(0,207,232,0.15); color: var(--info); }

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s;
    color: #fff;
}

.action-btn.edit { background: rgba(0,194,209,0.2); color: var(--primary); }
.action-btn.edit:hover { background: var(--primary); color: #fff; }

.action-btn.pay { background: rgba(40,199,111,0.2); color: var(--success); }
.action-btn.pay:hover { background: var(--success); color: #fff; }

.action-btn.view { background: rgba(115,103,240,0.2); color: #7367f0; }
.action-btn.view:hover { background: #7367f0; color: #fff; }

.action-btn.delete { background: rgba(234,84,85,0.2); color: var(--danger); }
.action-btn.delete:hover { background: var(--danger); color: #fff; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 18px; color: #fff; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover { background: var(--dark); color: var(--danger); }

.modal-body { padding: 20px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

select.form-control { cursor: pointer; }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30,30,45,0.9);
    z-index: 3000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.loading-overlay.active { display: flex; }

.spinner {
    width: 48px; height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 300px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    font-size: 13px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p { font-size: 14px; }

/* Progress Bar (for CPU) */
.progress-bar {
    width: 100px;
    height: 8px;
    background: var(--dark);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar span {
    position: absolute;
    top: -18px;
    right: 0;
    font-size: 11px;
    color: var(--text-muted);
}



/* Invoice Modal Styling */
.invoice-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.invoice-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--dark);
    border-bottom: 2px solid var(--primary);
}

.invoice-header-bar h2 {
    color: var(--primary);
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-close-x {
    background: rgba(234, 84, 85, 0.2);
    border: none;
    color: var(--danger);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.invoice-close-x:hover {
    background: var(--danger);
    color: #fff;
}

.invoice-toolbar {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: var(--darker);
    border-bottom: 1px solid var(--border);
}

.invoice-content {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.invoice-content .invoice-container {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
}

@media print {
    .invoice-header-bar,
    .invoice-toolbar,
    .modal-header,
    .modal-footer,
    .modal-close {
        display: none !important;
    }
    .modal-overlay {
        background: #fff !important;
        position: static !important;
        padding: 0 !important;
    }
    .modal {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        max-height: none !important;
    }
    .invoice-content {
        max-height: none !important;
        padding: 0 !important;
    }
    .invoice-content .invoice-container {
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
    }
    .invoice-content .invoice-container * {
        color: #000 !important;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

@media (max-width: 768px) {
    .topbar { padding: 0 15px; }
    .stats-grid { grid-template-columns: 1fr; }
    .content { padding: 15px; }
    .notification-panel { width: calc(100% - 30px); right: 15px; }
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    margin-right: 10px;
}

@media (max-width: 1024px) {
    .sidebar-toggle { display: block; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--darker); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }

/* Search box for pelanggan */
.search-box {
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 15px;
    gap: 10px;
    max-width: 400px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    width: 100%;
    font-family: inherit;
}

.search-box i { color: var(--text-muted); font-size: 14px; }

/* Pie chart card */
.pie-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.pie-legend span:first-child {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}