/* ===========================
   BASE
=========================== */

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    height: 100%;
}

a {
    text-decoration: none;
}

.btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* ===========================
   LAYOUT
=========================== */

.layout {
    display: flex;
    height: 100vh;
}

/* ===========================
   SIDEBAR
=========================== */

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1f2937, #111827);
    color: #fff;
    display: flex;
    flex-direction: column;
}

/* Brand */
.sidebar-brand {
    font-size: 20px;
    font-weight: 600;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* Menu */
.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

    .sidebar-menu li {
        margin: 4px 8px;
    }

    .sidebar-menu a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        color: #d1d5db;
        border-radius: 8px;
        font-size: 15px;
    }

        .sidebar-menu a:hover {
            background: rgba(255,255,255,0.08);
            color: #fff;
        }

    .sidebar-menu li.active a {
        background: #2563eb;
        color: #fff;
        font-weight: 600;
    }

/* ===========================
   MAIN AREA
=========================== */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f6fa;
}

/* Top bar */
.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

/* Content */
.content {
    padding: 1.1rem;
    overflow-y: auto;
}

/* ===========================
   MOBILE SIDEBAR
=========================== */

@media (max-width: 768px) {

    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,0.35);
    }

        .sidebar.open {
            left: 0;
        }

    .main {
        margin-left: 0 !important;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 1500;
    }
}

/* ===========================
   DESKTOP
=========================== */

@media (min-width: 769px) {
    .sidebar {
        position: relative;
        left: 0;
    }
}

/* ===========================
   DARK MODE
=========================== */

body.dark {
    background: #0f172a;
    color: #e5e7eb;
}

    body.dark .main {
        background: #0f172a;
    }

    body.dark .topbar {
        background: #020617;
        color: #e5e7eb;
        border-bottom: 1px solid #1e293b;
    }

    body.dark .sidebar {
        background: linear-gradient(180deg, #020617, #000000);
    }

    body.dark .sidebar-menu a {
        color: #cbd5f5;
    }

        body.dark .sidebar-menu a:hover {
            background: rgba(255,255,255,0.08);
        }

    body.dark .sidebar-menu li.active a {
        background: #1d4ed8;
    }

    body.dark .card {
        background: #020617;
        color: #e5e7eb;
        border-color: #1e293b;
    }

    body.dark .table {
        color: #e5e7eb;
    }

    body.dark input,
    body.dark select,
    body.dark textarea {
        background: #020617;
        color: #e5e7eb;
        border-color: #1e293b;
    }

        body.dark input::placeholder {
            color: #94a3b8;
        }
/* ===============================
   INVOICE PRINT
=============================== */

.invoice-container {
    max-width: 800px;
    margin: auto;
    background: #fff;
    padding: 20px;
    font-size: 14px;
}

.invoice-header h3 {
    margin: 0;
    font-weight: bold;
}

.invoice-table th,
.invoice-table td {
    padding: 6px;
}

/* ===========================
   FIX EXTRA BLANK PAGE ON PRINT
=========================== */

@media print {

    /* Remove default browser margins */
    @page {
        size: A4;
        margin: 10mm;
    }

    html, body {
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    /* Hide non-print UI */
    .no-print {
        display: none !important;
    }

    /* Print container */
    .print-area {
        position: relative !important;
        page-break-after: avoid !important;
        page-break-before: avoid !important;
        page-break-inside: avoid !important;
        break-after: avoid !important;
        break-before: avoid !important;
        break-inside: avoid !important;
    }

    /* Table rules */
    table {
        width: 100%;
        border-collapse: collapse;
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    thead {
        display: table-header-group;
    }

    tfoot {
        display: table-footer-group;
    }

    /* Prevent phantom space */
    .print-area::after {
        content: none !important;
    }
}

/* =========================
   SALES TABLE MOBILE FIX
========================= */

.sales-table {
    table-layout: fixed;
    width: 100%;
}

.col-product {
    width: auto;
}

.col-qty {
    width: 70px;
}

.col-rate {
    width: 80px;
}

.col-amount {
    width: 90px;
}

.col-action {
    width: 44px;
}

/* Inputs must not shrink */
.qty-input,
.rate-input {
    min-width: 100%;
    padding: 4px 6px;
    font-size: 14px;
}

/* Product input wrap nicely */
.product-input {
    white-space: normal;
}

/* MOBILE EXTRA SAFETY */
/*@media (max-width: 576px) {

    .col-qty {
        width: 65px;
    }

    .col-rate {
        width: 75px;
    }

    .col-amount {
        width: 85px;
    }

    .qty-input,
    .rate-input {
        font-size: 13px;
    }
}*/


/* ===============================
   INVOICE ITEMS (MOBILE SAFE)
================================ */

.invoice-items {
    margin-top: 10px;
}

.invoice-item-row {
    border-bottom: 1px dashed #ccc;
    padding: 8px 4px;
}

    .invoice-item-row:last-child {
        border-bottom: none;
    }

/* Desktop ? keep table style if needed */
@media (min-width: 768px) {
    .invoice-items {
        display: none;
    }
}

/* ===============================
   INVOICE PRINT BASE
================================ */

.print-area {
    max-width: 800px;
    margin: auto;
    background: #fff;
    padding: 16px;
    font-size: 14px;
}

/* Desktop table */
.invoice-table th,
.invoice-table td {
    padding: 6px;
}

/* ===============================
   MOBILE STACKED ITEMS
================================ */

.invoice-items {
    margin-top: 10px;
}

.invoice-item-row {
    border-bottom: 1px dashed #ccc;
    padding: 8px 4px;
}

    .invoice-item-row:last-child {
        border-bottom: none;
    }

/* ===============================
   PRINT SETTINGS
================================ */

@media print {

    body * {
        visibility: hidden;
    }

    .print-area,
    .print-area * {
        visibility: visible;
    }

    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .no-print {
        display: none !important;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    th, td {
        border: 1px solid #000;
        font-size: 12px;
    }

    #upiQr canvas {
        width: 140px !important;
        height: 140px !important;
    }

}


.dashboard-card {
    border-radius: 14px;
    padding: 18px;
    color: #fff;
    box-shadow: 0 8px 18px rgba(0,0,0,.15);
    transition: transform .2s ease;
}

    .dashboard-card:hover {
        transform: translateY(-4px);
    }

.dashboard-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.bg-invoice {
    background: linear-gradient(135deg,#667eea,#764ba2);
}

.bg-sales {
    background: linear-gradient(135deg,#43cea2,#185a9d);
}

.bg-orders {
    background: linear-gradient(135deg,#f7971e,#ffd200);
    color: #333;
}

.bg-order-value {
    background: linear-gradient(135deg,#ff512f,#dd2476);
}

.bg-customers {
    background: linear-gradient(135deg,#36d1dc,#5b86e5);
}

.bg-products {
    background: linear-gradient(135deg,#11998e,#38ef7d);
}

.mobile-sale-card {
    border-radius: 12px;
    transition: all .2s ease;
}

    .mobile-sale-card:active {
        transform: scale(0.98);
        background: #f8f9fa;
    }

mark {
    border-radius: 4px;
}

.search-highlight {
    background-color: #fff3cd;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 600;
}

