/*
 * File name : billing.css
 * Author    : mayuri@rtac.in
 * DOC       : 17-Sep-2026
 * Use       : Styles for §8 Billing & Payments.
 *             Prefix every class with "dcB" so nothing collides with
 *             main.css / contacts.css / dashboard.css.
 */

/* ============================================================
   Colour tokens, scoped to the billing page so they never leak.
   ============================================================ */
#sectionBilling {
    --dcb-orange       : #F4623A;
    --dcb-orange-soft  : #FDEFEA;
    --dcb-orange-dark  : #E04E28;
    --dcb-indigo       : #5B4FE9;
    --dcb-indigo-soft  : #EEECFE;
    --dcb-green        : #16A34A;
    --dcb-green-soft   : #E7F6EC;
    --dcb-bg           : #F7F8FB;
    --dcb-card         : #FFFFFF;
    --dcb-border       : #EAEDF3;
    --dcb-text         : #1F2937;
    --dcb-text-muted   : #6B7280;
    --dcb-text-soft    : #9CA3AF;
    --dcb-danger-soft  : #FEE2E2;
    --dcb-danger       : #DC2626;
    --dcb-warn-soft    : #FEF3C7;
    --dcb-warn         : #B45309;

    background: var(--dcb-bg);
    min-height: calc(100vh - 60px);
    padding: 28px 32px 40px;
}

/* ============================================================
   Header row.
   ============================================================ */
.dcBHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.dcBTitleWrap { display: flex; align-items: center; gap: 14px; }

.dcBTitleBadge {
    width: 46px; height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, #F4623A 0%, #FF8A65 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 6px 18px rgba(244, 98, 58, 0.30);
}

.dcBTitle {
    font-size: 22px;
    font-weight: 700;
    color: var(--dcb-text);
    margin: 0;
    line-height: 1.1;
}
.dcBSubtitle {
    font-size: 13px;
    color: var(--dcb-text-muted);
    margin: 3px 0 0;
}

/* ============================================================
   Wallet Balance card.
   ============================================================ */
.dcBBalanceCard {
    background: var(--dcb-card);
    border: 1px solid var(--dcb-border);
    border-left: 4px solid var(--dcb-orange);
    border-radius: 14px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.dcBBalanceMain { display: flex; align-items: center; gap: 16px; min-width: 0; }

.dcBBalanceIcon {
    width: 54px; height: 54px;
    border-radius: 14px;
    background: var(--dcb-orange-soft);
    color: var(--dcb-orange);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.dcBBalanceText { min-width: 0; }

.dcBBalanceLabel {
    font-size: 13px;
    font-weight: 600;
    color: var(--dcb-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dcBBalanceValue {
    font-size: 32px;
    font-weight: 700;
    color: var(--dcb-text);
    line-height: 1.2;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
}

.dcBBalanceMeta {
    font-size: 12px;
    color: var(--dcb-text-soft);
    margin-top: 2px;
    min-height: 16px;
}

/* Loading skeleton */
.dcBBalanceSkeleton {
    width: 180px; height: 34px;
    margin-top: 6px;
    border-radius: 8px;
    background: linear-gradient(90deg, #F1F3F7 25%, #E6E9EF 50%, #F1F3F7 75%);
    background-size: 200% 100%;
    animation: dcBShimmer 1.2s linear infinite;
}
@keyframes dcBShimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* Error state */
.dcBBalanceState {
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--dcb-warn-soft);
    color: var(--dcb-warn);
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    max-width: 520px;
}
.dcBBalanceState i { font-size: 15px; margin-top: 1px; }

.dcBBalanceActions { display: flex; align-items: center; gap: 8px; }

/* "To add funds, contact your account manager." - in place of the
   Add Funds button until customer recharge is built. */
.dcBFundsNote {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--dcb-orange-soft);
    color: var(--dcb-orange-dark);
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
}
.dcBFundsNote i { font-size: 14px; }

/* ============================================================
   Buttons.
   ============================================================ */
.dcBBtn {
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .1s;
    border: 1px solid transparent;
}
.dcBBtn:active { transform: translateY(1px); }
.dcBBtn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

.dcBBtnPrimary {
    background: var(--dcb-orange);
    color: #fff;
    box-shadow: 0 4px 12px rgba(244, 98, 58, 0.28);
}
.dcBBtnPrimary:hover:not(:disabled) { background: var(--dcb-orange-dark); color: #fff; }

.dcBBtnOutline {
    background: var(--dcb-card);
    color: var(--dcb-text);
    border-color: var(--dcb-border);
}
.dcBBtnOutline:hover { background: var(--dcb-bg); color: var(--dcb-text); }

.dcBIconBtn {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border: 1px solid var(--dcb-border);
    background: var(--dcb-card);
    color: var(--dcb-text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
    font-size: 16px;
}
.dcBIconBtn:hover { background: var(--dcb-bg); color: var(--dcb-text); }

.dcBBtn:focus-visible,
.dcBIconBtn:focus-visible {
    outline: 2px solid var(--dcb-orange);
    outline-offset: 2px;
}

.dcBSpinning i { animation: dcBSpin .8s linear infinite; }
@keyframes dcBSpin { to { transform: rotate(360deg); } }

/* ============================================================
   Panels (Top-up History / Ledger).
   ============================================================ */
.dcBPanel {
    background: var(--dcb-card);
    border: 1px solid var(--dcb-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
}

.dcBPanelHeader {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--dcb-border);
}

.dcBPanelTitle {
    font-size: 15px;
    font-weight: 700;
    color: var(--dcb-text);
}

.dcBPanelBody:empty { min-height: 80px; }

/* ============================================================
   Top-up History table.
   ============================================================ */
#billingTopupTable { margin: 0 !important; }

#billingTopupTable thead th {
    background: #FAFBFC;
    border-bottom: 1px solid var(--dcb-border);
    border-top: none;
    font-size: 12px;
    font-weight: 700;
    color: var(--dcb-text-muted);
    padding: 12px 20px;
}

#billingTopupTable tbody td {
    padding: 14px 20px;
    border-top: 1px solid var(--dcb-border);
    vertical-align: middle;
    font-size: 14px;
    color: var(--dcb-text);
    background: transparent;
}
#billingTopupTable tbody tr:first-child td { border-top: none; }
#billingTopupTable tbody tr:hover { background: #FAFBFC; }

.dcBDate  { color: var(--dcb-text-muted); font-size: 13px; }
.dcBTxnID { font-size: 13px; word-break: break-all; }
.dcBAmount { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Ledger "Message Reference" - the 32-character Request GUID. */
.dcBGuid {
    font-family: monospace;
    font-size: 12px;
    color: var(--dcb-text-muted);
    word-break: break-all;
}

.dcBStatus {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.dcBStatus.success { background: var(--dcb-green-soft);  color: var(--dcb-green); }
.dcBStatus.failed  { background: var(--dcb-danger-soft); color: var(--dcb-danger); }
.dcBStatus.neutral { background: #F1F3F7;               color: var(--dcb-text-muted); }

#billingTopupTableWrap .dataTables_wrapper .dataTables_info,
#billingTopupTableWrap .dataTables_wrapper .dataTables_paginate {
    padding: 14px 20px !important;
    color: var(--dcb-text-muted);
    font-size: 13px;
}
#billingTopupTableWrap .dataTables_wrapper .paginate_button.current,
#billingTopupTableWrap .dataTables_wrapper .paginate_button.current:hover {
    background: var(--dcb-orange) !important;
    border-color: var(--dcb-orange) !important;
    color: #fff !important;
    border-radius: 8px !important;
}

/* Table loading skeleton */
.dcBTableSkeleton { padding: 16px 20px; }
.dcBTableSkeleton div {
    height: 18px;
    border-radius: 6px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #F1F3F7 25%, #E6E9EF 50%, #F1F3F7 75%);
    background-size: 200% 100%;
    animation: dcBShimmer 1.2s linear infinite;
}

/* Empty state */
.dcBEmpty { padding: 48px 20px; text-align: center; }
.dcBEmptyIcon {
    width: 64px; height: 64px;
    background: var(--dcb-orange-soft);
    color: var(--dcb-orange);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 14px;
}
.dcBEmptyTitle { font-size: 16px; font-weight: 700; color: var(--dcb-text); margin-bottom: 4px; }
.dcBEmptySub   { color: var(--dcb-text-muted); font-size: 14px; }
/* ============================================================
   Ledger Report.
   ============================================================ */
/* "· Last 24 hours" next to the Ledger title */
.dcBPanelSub {
    font-size: 13px;
    font-weight: 500;
    color: var(--dcb-text-muted);
}

/* Ledger CSV strip below the table */
.dcBLedgerDownload {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 18px 20px;
    background: #FAFBFC;
    border-top: 1px solid var(--dcb-border);
}

.dcBLedgerDlInfo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dcBLedgerDlIcon {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: var(--dcb-orange-soft);
    color: var(--dcb-orange);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.dcBLedgerDlTitle { font-size: 14px; font-weight: 700; color: var(--dcb-text); }
.dcBLedgerDlSub   { font-size: 12px; color: var(--dcb-text-muted); margin-top: 2px; }

.dcBLedgerDlFields { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.dcBLedgerField    { display: flex; flex-direction: column; gap: 5px; }
.dcBLedgerLabel {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--dcb-text-soft);
    margin: 0;
}

/* Calendar icon inside the input */
.dcBLedgerDateWrap { position: relative; }
.dcBLedgerDateWrap i {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--dcb-text-muted);
    font-size: 14px;
    pointer-events: none;
}
.dcBLedgerDate {
    width: 150px;
    height: 40px;
    padding-left: 36px;
    font-size: 13px;
    border: 1px solid var(--dcb-border);
    border-radius: 10px;
    background: var(--dcb-card) !important;
    color: var(--dcb-text);
    cursor: pointer;
}
.dcBLedgerDate:focus {
    border-color: var(--dcb-orange);
    box-shadow: 0 0 0 3px var(--dcb-orange-soft);
}
.dcBLedgerDlBtn { height: 40px; }

/* Small screens: text on top, dates side by side, full-width button */
@media (max-width: 768px) {
    .dcBLedgerDlFields { width: 100%; }
    .dcBLedgerField    { flex: 1 1 0; }
    .dcBLedgerDate     { width: 100%; }
    .dcBLedgerDlBtn    { width: 100%; justify-content: center; }
}

#billingLedgerTable { margin: 0 !important; }

#billingLedgerTable thead th {
    background: #FAFBFC;
    border-bottom: 1px solid var(--dcb-border);
    border-top: none;
    font-size: 12px;
    font-weight: 700;
    color: var(--dcb-text-muted);
    padding: 12px 20px;
}

#billingLedgerTable tbody td {
    padding: 14px 20px;
    border-top: 1px solid var(--dcb-border);
    vertical-align: middle;
    font-size: 14px;
    color: var(--dcb-text);
    background: transparent;
}
#billingLedgerTable tbody tr:first-child td { border-top: none; }
#billingLedgerTable tbody tr:hover { background: #FAFBFC; }

.dcBType {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.dcBType.credit { background: var(--dcb-green-soft);  color: var(--dcb-green); }
.dcBType.debit  { background: var(--dcb-danger-soft); color: var(--dcb-danger); }

.dcBDescription { font-size: 13px; }
.dcBAmount.credit { color: var(--dcb-green); }
.dcBAmount.debit  { color: var(--dcb-danger); }

#billingLedgerWrap .dataTables_wrapper .dataTables_info,
#billingLedgerWrap .dataTables_wrapper .dataTables_paginate {
    padding: 14px 20px !important;
    color: var(--dcb-text-muted);
    font-size: 13px;
}
#billingLedgerWrap .dataTables_wrapper .paginate_button.current,
#billingLedgerWrap .dataTables_wrapper .paginate_button.current:hover {
    background: var(--dcb-orange) !important;
    border-color: var(--dcb-orange) !important;
    color: #fff !important;
    border-radius: 8px !important;
}
/* ============================================================
   Reduced motion + responsive.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .dcBBalanceSkeleton,
    .dcBTableSkeleton div,
    .dcBSpinning i { animation: none; }
}

@media (max-width: 640px) {
    #sectionBilling { padding: 20px 16px 32px; }
    .dcBBalanceCard { flex-direction: column; align-items: stretch; }
    .dcBBalanceActions { justify-content: stretch; }
    .dcBBalanceActions .dcBBtn { flex: 1; justify-content: center; }
    .dcBBalanceValue { font-size: 28px; }
}

