﻿/* =====================================================
   GLOBAL
===================================================== */

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    background-color: #f8f9fa;
}

a, .btn-link {
    color: #006bb7;
}

.page-title {
    font-weight: 600;
    margin-bottom: 20px;
}

.content-area {
    padding: 20px;
}

/* =====================================================
   LAYOUT
===================================================== */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #ffffff;
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
}

/* =====================================================
   SIDEBAR
===================================================== */

.sidebar-container {
    position: sticky;
    top: 0;
    width: 240px;
    height: 100vh;
    padding: 15px 10px;
    background: #0f172a;
    overflow-y: auto;
    overflow-x: hidden;
}

    /* Scrollbar (sidebar only) */
    .sidebar-container::-webkit-scrollbar {
        width: 5px;
    }

    .sidebar-container::-webkit-scrollbar-thumb {
        background: #2c3e50;
        border-radius: 10px;
    }

/* Section title */
.nav-section {
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    margin: 18px 0 8px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Links */
.sidebar-link {
    color: #ffffff !important;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.25s ease;
}

    .sidebar-link:hover {
        background-color: #1f1f1f;
        transform: translateX(5px);
    }

    .sidebar-link.active {
        background-color: #0d6efd !important;
        color: #ffffff !important;
    }

.menu-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* =====================================================
   BUTTONS
===================================================== */

.btn {
    border-radius: 10px;
    transition: 0.2s ease;
}

    .btn:hover {
        transform: translateY(-1px);
    }

.btn-primary {
    background-color: #1b6ec2;
    border-color: #1861ac;
    box-shadow: 0 3px 8px rgba(13,110,253,0.3);
}

    .btn-primary:hover {
        box-shadow: 0 5px 14px rgba(13,110,253,0.4);
    }

.btn-equal {
    height: 45px;
    font-weight: 500;
}

/* =====================================================
   CARDS
===================================================== */

.card {
    border: none;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    transition: 0.2s ease;
}

    .card:hover {
        transform: translateY(-3px);
    }

.card-body {
    overflow-x: hidden;
}

.mobile-card {
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* Dashboard card */

.dashboard-card {
    position: relative;
    overflow: hidden;
}

    .dashboard-card::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        width: 6px;
        height: 100%;
    }

.card-info::before {
    background: #0dcaf0;
}

.card-success::before {
    background: #198754;
}

.card-warning::before {
    background: #ffc107;
}

.card-danger::before {
    background: #dc3545;
}

/* =====================================================
   TABLE
===================================================== */

.table th {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.table td {
    vertical-align: middle;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* =====================================================
   STATUS
===================================================== */

.status-paid {
    background-color: #d1e7dd;
}

.status-partial {
    background-color: #fff3cd;
}

.status-pending {
    background-color: #f8d7da;
}

.status-payout {
    background-color: #cff4fc;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

    .status-badge .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }

    .status-badge.due .dot {
        background: #dc3545;
    }

    .status-badge.advance .dot {
        background: #0d6efd;
    }

    .status-badge.settled .dot {
        background: #198754;
    }

/* =====================================================
   TOAST
===================================================== */

.toast-box {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 18px;
    border-radius: 12px;
    color: white;
    z-index: 9999;
}

.toast-success {
    background: #16a34a;
}

.toast-error {
    background: #dc2626;
}

.toast-warning {
    background: #f59e0b;
}

/* =====================================================
   UTILITIES
===================================================== */

.text-nowrap {
    white-space: nowrap;
}

.chit-amount {
    font-size: 16px;
    font-weight: 600;
    color: #0d6efd;
}

.used-row {
    background-color: #f5f5f5;
    opacity: 0.75;
}

/* =====================================================
   PAGINATION
===================================================== */

.page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
    font-weight: 600;
}

/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 768px) {

    .layout-wrapper {
        flex-direction: column;
    }

    .sidebar-container {
        width: 100%;
        height: auto;
        position: relative;
    }

    .content-area {
        padding: 12px;
    }

    h3 {
        font-size: 1.2rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    table {
        min-width: 600px;
    }

    .status-badge {
        font-size: 0.8rem;
    }
}

.a5-wrapper {
    display: flex;
    justify-content: center;
}

.receipt-container {
    width: 148mm; /* Exact A5 width */
    min-height: 210mm; /* Exact A5 height */
    border: 2px solid #000;
    padding: 18px;
    background: white;
}

.keyboard-active {
    background-color: #0d6efd !important;
    color: white !important;
    border-color: #0d6efd !important;
}

    .keyboard-active:hover {
        background-color: #0b5ed7 !important;
        color: white !important;
    }


.table-success {
    --bs-table-bg: #d1e7dd !important;
}

/* ================= ENTERPRISE PRINT MODE ================= */

@page {
    size: A4;
    margin: 20mm 15mm 25mm 15mm;
}

@media print {

    body {
        background: white !important;
    }

    .sidebar-container,
    .topbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .layout-wrapper {
        display: block !important;
    }

    .content-area {
        padding: 0 !important;
    }

    /* HEADER (repeating) */
    .print-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-weight: 600;
        border-bottom: 1px solid #ccc;
        padding-bottom: 5px;
    }

    .company-name {
        font-size: 16px;
        font-weight: 700;
    }

    /* FOOTER (repeating) */
    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        font-size: 12px;
        border-top: 1px solid #ccc;
        display: flex;
        justify-content: space-between;
        padding-top: 5px;
    }

    /* Page numbers */
    .page-number:after {
        content: "Page " counter(page) " of " counter(pages);
    }

    /* Push content below header */
    #printArea {
        margin-top: 80px;
        margin-bottom: 60px;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        border-radius: 0 !important;
    }

    .page-break {
        page-break-before: always;
    }
}

/* ================= HISTORY PAGE MOBILE OPTIMIZATION ================= */

.history-card {
    border-radius: 16px;
}

.small-label {
    font-size: 0.9rem;
}

@media (max-width: 768px) {

    .history-card {
        padding: 10px;
    }

    .form-select-lg-mobile,
    .form-control-lg-mobile {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .btn-lg-mobile {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }

    h4 {
        font-size: 1.1rem;
    }
}