/* ═══════════════════════════════════════════════════════════════════════
   PPPoE Remote — Billing Module
   Design: Dark Industrial Command Center
   Typography: Outfit (display) + Plus Jakarta Sans (body) + Geist Mono (data)

   Design principles:
   — All interactive elements ≥ 44px height
   — Generous whitespace, nothing cramped
   — Bold color-coded status indicators
   — Distinctive, non-generic aesthetics
   ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────────── */
.billing-page {
    /* Colors */
    --bill-bg: #0b0f17;
    --bill-surface: #111620;
    --bill-card: #161b26;
    --bill-elevated: #1c2230;
    --bill-border: #1f2735;
    --bill-border-light: #293040;
    --bill-accent: #00d4aa;
    --bill-accent-glow: rgba(0, 212, 170, 0.15);
    --bill-accent-hover: #00e8bb;
    --bill-success: #10b981;
    --bill-success-bg: rgba(16, 185, 129, 0.12);
    --bill-warning: #f59e0b;
    --bill-warning-bg: rgba(245, 158, 11, 0.12);
    --bill-danger: #ef4444;
    --bill-danger-bg: rgba(239, 68, 68, 0.12);
    --bill-info: #3b82f6;
    --bill-info-bg: rgba(59, 130, 246, 0.12);
    --bill-violet: #8b5cf6;
    --bill-violet-bg: rgba(139, 92, 246, 0.12);
    --bill-slate: #64748b;
    --bill-slate-bg: rgba(100, 116, 139, 0.1);
    --bill-text: #e8edf5;
    --bill-text-dim: #94a3b8;
    --bill-text-muted: #64748b;

    /* Typography */
    --bill-font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    --bill-font-display: 'Outfit', 'Segoe UI', system-ui, sans-serif;
    --bill-font-mono: 'Geist Mono', 'JetBrains Mono', 'Consolas', monospace;

    /* Spacing */
    --bill-unit: 0.5rem;
    --bill-radius: 10px;
    --bill-radius-sm: 6px;
    --bill-radius-lg: 14px;

    /* Apply */
    font-family: var(--bill-font);
    background: var(--bill-bg);
    color: var(--bill-text);
    letter-spacing: 0.01em;
    line-height: 1.5;
}

/* ── Page Header ──────────────────────────────────────────────────── */
.billing-page .page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--bill-card), var(--bill-elevated));
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius-lg);
    margin-bottom: 1.25rem;
}
.billing-page .page-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.billing-page .page-heading .page-icon {
    width: 52px; height: 52px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--bill-accent), #0099cc);
    color: #0b0f17; border-radius: var(--bill-radius);
    font-size: 1.4rem; flex-shrink: 0;
}
.billing-page .page-heading .eyebrow {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--bill-accent); margin: 0;
    font-family: var(--bill-font-mono); font-weight: 600;
}
.billing-page .page-heading .page-title {
    font-family: var(--bill-font-display); font-size: 1.75rem; font-weight: 800;
    margin: 0; letter-spacing: -0.02em;
    color: var(--bill-text);
}
.billing-page .page-heading .muted {
    font-size: 0.85rem; color: var(--bill-text-dim); margin: 3px 0 0;
}

/* ── Panel / Card ─────────────────────────────────────────────────── */
.billing-page .panel {
    background: var(--bill-card);
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}
.billing-page .panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--bill-surface);
    border-bottom: 1px solid var(--bill-border);
}
.billing-page .panel-head .panel-title {
    font-family: var(--bill-font-display); font-size: 0.8rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--bill-text-dim); margin: 0;
}
.billing-page .toolbar-card {
    padding: 1.25rem;
}
.billing-page .toolbar-card .toolbar-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.75rem 1rem;
    align-items: end;
}

/* ── Form Grid ────────────────────────────────────────────────────── */
.field-span-1 { grid-column: span 1; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.field-span-4 { grid-column: span 4; }
.field-span-5 { grid-column: span 5; }
.field-span-6 { grid-column: span 6; }
.field-span-7 { grid-column: span 7; }
.field-span-8 { grid-column: span 8; }
.field-span-9 { grid-column: span 9; }
.field-span-10 { grid-column: span 10; }
.field-span-11 { grid-column: span 11; }
.field-span-12 { grid-column: span 12; }
.form-actions {
    display: flex; align-items: flex-end; gap: 0.625rem;
    flex-wrap: wrap;
}

/* ── Labels ────────────────────────────────────────────────────────── */
.billing-page .label {
    display: block;
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--bill-text-dim);
    margin-bottom: 0.35rem;
    font-family: var(--bill-font-mono);
}

/* ── Inputs & Selects ─────────────────────────────────────────────── */
.billing-page .input,
.billing-page .select {
    width: 100%; height: 2.75rem;
    padding: 0 0.875rem;
    font-size: 0.875rem; font-family: var(--bill-font);
    background: var(--bill-surface);
    border: 1.5px solid var(--bill-border-light);
    border-radius: var(--bill-radius-sm);
    color: var(--bill-text);
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.billing-page .input:hover,
.billing-page .select:hover { border-color: var(--bill-text-muted); }
.billing-page .input:focus,
.billing-page .select:focus {
    border-color: var(--bill-accent);
    box-shadow: 0 0 0 4px var(--bill-accent-glow), 0 1px 2px rgba(0,0,0,0.2);
}
.billing-page .input::placeholder { color: var(--bill-text-muted); }
.billing-page .input[readonly] {
    background: var(--bill-bg); color: var(--bill-accent);
    border-style: dashed; cursor: default; font-family: var(--bill-font-mono);
    font-weight: 600;
}
.billing-page .select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center;
    padding-right: 2.5rem;
}
.billing-page textarea.input {
    height: auto; min-height: 6rem; padding: 0.75rem 0.875rem; resize: vertical;
}

/* ── Checkbox ─────────────────────────────────────────────────────── */
.billing-page input[type="checkbox"] {
    width: 1.25rem; height: 1.25rem;
    accent-color: var(--bill-accent); cursor: pointer;
    border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════
   BUTTONS
   All buttons ≥ 44px height, generous padding, clear icon+text
   ═══════════════════════════════════════════════════════════════════════ */
.billing-page .button {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    height: 2.75rem; min-width: 2.75rem;
    padding: 0 1rem;
    font-family: var(--bill-font); font-size: 0.85rem; font-weight: 600;
    border-radius: var(--bill-radius-sm); border: 1.5px solid var(--bill-border-light);
    background: var(--bill-elevated); color: var(--bill-text);
    cursor: pointer; white-space: nowrap; user-select: none;
    transition: all 0.15s ease;
    text-decoration: none; line-height: 1;
    letter-spacing: 0.01em;
}
.billing-page .button:hover {
    background: var(--bill-border);
    border-color: var(--bill-text-muted);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.billing-page .button:active { transform: translateY(0); box-shadow: none; }
.billing-page .button:disabled {
    opacity: 0.35; cursor: not-allowed; pointer-events: none;
    filter: grayscale(0.4); transform: none; box-shadow: none;
}

/* Primary — teal accent */
.billing-page .button-primary {
    background: var(--bill-accent); color: #0b0f17;
    border-color: var(--bill-accent); font-weight: 700;
}
.billing-page .button-primary:hover {
    background: var(--bill-accent-hover);
    box-shadow: 0 4px 20px var(--bill-accent-glow);
}

/* Danger — rose */
.billing-page .button-danger {
    background: var(--bill-danger); color: #fff;
    border-color: var(--bill-danger); font-weight: 700;
}
.billing-page .button-danger:hover {
    background: #f87171;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.25);
}

/* Ghost */
.billing-page .button-ghost {
    background: transparent; border-color: transparent;
    color: var(--bill-text-dim);
}
.billing-page .button-ghost:hover {
    background: var(--bill-surface); border-color: var(--bill-border-light);
    color: var(--bill-text); box-shadow: none;
}

/* Sizes */
.billing-page .button-sm {
    height: 2.25rem; min-width: 2.25rem;
    padding: 0 0.75rem; font-size: 0.78rem;
}
.billing-page .button-lg {
    height: 3.25rem; min-width: 3.25rem;
    padding: 0 1.5rem; font-size: 0.95rem; border-radius: var(--bill-radius);
}

/* Icon within button */
.billing-page .button .icon {
    width: 18px; height: 18px; flex-shrink: 0;
}
.billing-page .button-lg .icon { width: 22px; height: 22px; }
.billing-page .button-sm .icon { width: 15px; height: 15px; }

/* ═══════════════════════════════════════════════════════════════════════
   TOOLBAR ROW
   ═══════════════════════════════════════════════════════════════════════ */
.toolbar-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   STATUS PILLS — Large, clear, with dot indicator
   ═══════════════════════════════════════════════════════════════════════ */
.status-pill {
    display: inline-flex; align-items: center; gap: 0.4em;
    padding: 0.25em 0.7em;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; border-radius: 999px;
    font-family: var(--bill-font-mono); line-height: 1.5;
    white-space: nowrap;
}
.status-pill::before {
    content: ''; width: 7px; height: 7px;
    border-radius: 50%; flex-shrink: 0;
    background: currentColor;
}

/* Color variants */
.status-pill-draft, .status-pill[class*="draft"] {
    background: var(--bill-slate-bg); color: var(--bill-slate);
}
.status-pill-sent, .status-pill[class*="sent"] {
    background: var(--bill-info-bg); color: var(--bill-info);
}
.status-pill-paid, .status-pill[class*="paid"], .status-pill-lunas {
    background: var(--bill-success-bg); color: var(--bill-success);
}
.status-pill-overdue, .status-pill[class*="overdue"], .status-pill[class*="tempo"] {
    background: var(--bill-warning-bg); color: var(--bill-warning);
}
.status-pill-cancelled, .status-pill[class*="cancelled"], .status-pill[class*="batal"] {
    background: var(--bill-danger-bg); color: var(--bill-danger);
}
.status-pill-isolated, .status-pill[class*="isolat"] {
    background: var(--bill-violet-bg); color: var(--bill-violet);
}
.status-pill-active, .status-pill[class*="active"] {
    background: var(--bill-success-bg); color: var(--bill-success);
}
.status-pill-inactive, .status-pill[class*="inactive"] {
    background: var(--bill-slate-bg); color: var(--bill-slate);
}
.status-pill-connected {
    background: var(--bill-success-bg); color: var(--bill-success);
}
.status-pill-disconnected {
    background: var(--bill-slate-bg); color: var(--bill-slate);
}

/* ═══════════════════════════════════════════════════════════════════════
   TABLES
   Row ≥ 48px, zebra stripes, clear hover
   ═══════════════════════════════════════════════════════════════════════ */
.billing-page .table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.billing-page table {
    width: 100%; border-collapse: collapse;
    font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
.billing-page thead th {
    padding: 0.65rem 1rem; text-align: left;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--bill-text-muted);
    background: var(--bill-surface);
    border-bottom: 2px solid var(--bill-border-light);
    font-family: var(--bill-font-mono); white-space: nowrap;
    position: sticky; top: 0; z-index: 2;
}
.billing-page tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--bill-border);
    color: var(--bill-text); vertical-align: middle;
    min-height: 2.75rem;
}
.billing-page tbody tr { transition: background 0.1s; }
.billing-page tbody tr:hover td { background: var(--bill-elevated); }
.billing-page tbody tr:nth-child(even) td { background: rgba(255,255,255,0.012); }
.billing-page tbody tr:nth-child(even):hover td { background: var(--bill-elevated); }
.billing-page tbody td code {
    font-family: var(--bill-font-mono); font-size: 0.78rem;
    background: var(--bill-surface); padding: 0.2em 0.5em;
    border-radius: 4px; font-weight: 600; color: var(--bill-accent);
}
.billing-page tbody td strong {
    font-weight: 700; color: var(--bill-text);
}
.billing-page .empty-state {
    text-align: center; padding: 4rem 1.5rem;
    color: var(--bill-text-muted); font-size: 0.9rem;
}
.billing-page .empty-state code {
    background: var(--bill-surface); padding: 0.2em 0.5em;
    border-radius: 4px; font-family: var(--bill-font-mono);
    color: var(--bill-accent);
}

/* ═══════════════════════════════════════════════════════════════════════
   BATCH ACTION BAR — Always visible, pulses when active
   ═══════════════════════════════════════════════════════════════════════ */
#batch-bar {
    position: sticky; top: 0; z-index: 5;
    background: var(--bill-surface) !important;
    border: 1px solid var(--bill-border-light) !important;
    border-radius: var(--bill-radius-lg) !important;
    transition: all 0.25s ease;
}
#batch-bar[style*="opacity: 1"] {
    border-color: var(--bill-accent) !important;
    background: linear-gradient(135deg, var(--bill-card), var(--bill-elevated)) !important;
    box-shadow: 0 0 24px var(--bill-accent-glow);
}

/* ═══════════════════════════════════════════════════════════════════════
   INVOICE DETAIL META
   ═══════════════════════════════════════════════════════════════════════ */
.invoice-meta {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem; padding: 1rem 1.25rem;
}
.invoice-meta-item strong {
    display: block; font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--bill-text-muted);
    font-family: var(--bill-font-mono); margin-bottom: 0.2rem;
}
.invoice-meta-item span {
    font-size: 0.95rem; font-weight: 700; color: var(--bill-text);
}

/* ═══════════════════════════════════════════════════════════════════════
   QR CODE PANEL
   ═══════════════════════════════════════════════════════════════════════ */
#qr-panel { transition: all 0.3s ease; }
#qr-container { border-radius: var(--bill-radius) !important; }
#qr-container img { border-radius: var(--bill-radius-sm); }
#qr-timer { font-family: var(--bill-font-mono); }

/* ═══════════════════════════════════════════════════════════════════════
   TOAST / FLASH MESSAGES
   ═══════════════════════════════════════════════════════════════════════ */
.billing-page .toast-item {
    background: var(--bill-elevated); border: 1px solid var(--bill-border-light);
    border-radius: var(--bill-radius); padding: 0.75rem 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1000px) {
    .billing-page .toolbar-card .toolbar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .field-span-1, .field-span-2, .field-span-3, .field-span-4,
    .field-span-5, .field-span-6, .field-span-7, .field-span-8,
    .field-span-9, .field-span-10, .field-span-11, .field-span-12 {
        grid-column: span 4;
    }
    .invoice-meta { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .billing-page .toolbar-card .toolbar-grid {
        grid-template-columns: 1fr;
    }
    .field-span-1, .field-span-2, .field-span-3, .field-span-4,
    .field-span-5, .field-span-6, .field-span-7, .field-span-8,
    .field-span-9, .field-span-10, .field-span-11, .field-span-12 {
        grid-column: span 1;
    }
    .billing-page .page-header { padding: 1rem; }
    .billing-page .page-heading .page-title { font-size: 1.25rem; }
    .invoice-meta { grid-template-columns: 1fr; }
    .billing-page .button { height: 2.5rem; padding: 0 0.875rem; font-size: 0.8rem; }
}
