/* Super Store POS - Modern Clean Stylesheet */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #0ea5e9;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-width: 260px;
    --header-height: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.2s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid #1e293b;
    gap: 0.75rem;
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.925rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: #ffffff;
    background-color: #1e293b;
}

.nav-link.active {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.nav-link .badge {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: var(--danger);
    color: white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-badge {
    display: flex;
    flex-direction: column;
}
.user-badge .name { font-size: 0.85rem; font-weight: 600; color: #f1f5f9; }
.user-badge .role { font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; }

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

.top-header {
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

.content-container {
    padding: 1.5rem 1.75rem;
    flex: 1;
}

/* Flash alerts */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.925rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Cards & Grid */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.icon-indigo { background: #e0e7ff; color: #4338ca; }
.icon-emerald { background: #d1fae5; color: #065f46; }
.icon-rose { background: #ffe4e6; color: #9f1239; }
.icon-amber { background: #fef3c7; color: #92400e; }
.icon-sky { background: #e0f2fe; color: #0369a1; }

.stat-title { font-size: 0.825rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-top: 0.2rem; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.15s ease;
}

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

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

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

.btn-secondary { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover { background: #e2e8f0; }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1.05rem; font-weight: 600; }
.btn-block { width: 100%; }

/* Forms */
.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 0.925rem;
    color: var(--text-main);
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.table th {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* POS Terminal Layout */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 1.25rem;
    height: calc(100vh - var(--header-height) - 3rem);
}

.pos-products {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.pos-search-bar {
    padding: 1rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.pos-categories {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.category-tab {
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-size: 0.825rem;
    font-weight: 500;
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}
.category-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.product-grid {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
    align-content: start;
}

.product-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
}

.product-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}

.product-card.out-of-stock {
    opacity: 0.55;
    cursor: not-allowed;
}

.product-card .p-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.35rem;
    line-height: 1.25;
    min-height: 2.5rem;
}

.product-card .p-sku {
    font-size: 0.725rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.product-card .p-bottom {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-card .p-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.product-card .p-stock {
    font-size: 0.725rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

/* POS Cart / Register Panel */
.pos-register {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.register-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.cart-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 0.6rem;
}

.cart-item-info {
    flex: 1;
}
.cart-item-title { font-size: 0.85rem; font-weight: 600; }
.cart-item-price { font-size: 0.775rem; color: var(--text-muted); }

.cart-qty-ctrl {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cart-qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #f8fafc;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-qty-btn:hover { background: #e2e8f0; }

.cart-qty-input {
    width: 36px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem;
    font-size: 0.85rem;
}

.cart-item-total {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

.cart-item-del {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
}

.register-summary {
    background: #f8fafc;
    border-top: 1px solid var(--border);
    padding: 0.85rem 1.15rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}
.summary-row.total-row {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    border-top: 2px dashed var(--border);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.85rem;
}

.register-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.modal-backdrop.show {
    display: flex;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalIn 0.2s ease-out;
}

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

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); }

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 0.85rem 1.25rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Payment Quick Buttons */
.quick-cash-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.quick-cash-btn {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.quick-cash-btn:hover {
    background: #e2e8f0;
}

/* Professional Thermal Printer Stylesheet (80mm and 58mm) */
.thermal-receipt-container {
    margin: 1.5rem auto;
    background: #ffffff;
    padding: 1.25rem 1rem 2.5rem 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    font-family: 'Courier New', Courier, 'Lucida Console', Monaco, monospace;
    color: #000000;
    line-height: 1.35;
    transition: max-width 0.2s ease;
    border: 1px dashed #cbd5e1;
}

.thermal-receipt-container.paper-80mm {
    width: 300px;
    max-width: 300px;
    font-size: 13px;
}

.thermal-receipt-container.paper-58mm {
    width: 215px;
    max-width: 215px;
    font-size: 11px;
    padding: 0.8rem 0.5rem 2rem 0.5rem;
}

.thermal-divider-double {
    border-top: 2px dashed #000000;
    margin: 6px 0;
}

.thermal-divider-single {
    border-top: 1px dashed #000000;
    margin: 5px 0;
}

.thermal-header {
    text-align: center;
    margin-bottom: 6px;
}

.thermal-header .store-title {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.thermal-receipt-container.paper-58mm .thermal-header .store-title {
    font-size: 14px;
}

.thermal-header .store-sub {
    font-size: 11px;
    line-height: 1.3;
}
.thermal-receipt-container.paper-58mm .thermal-header .store-sub {
    font-size: 10px;
}

.thermal-meta-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}
.thermal-receipt-container.paper-58mm .thermal-meta-table {
    font-size: 10px;
}
.thermal-meta-table td {
    padding: 2px 0;
}

.thermal-items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0;
}
.thermal-items-table th {
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    padding: 3px 0;
}
.thermal-receipt-container.paper-58mm .thermal-items-table th {
    font-size: 10px;
}
.thermal-item-row .item-name {
    font-weight: 700;
    font-size: 12px;
    padding-top: 3px;
}
.thermal-receipt-container.paper-58mm .thermal-item-row .item-name {
    font-size: 11px;
}
.thermal-item-row .item-calc {
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    padding-bottom: 3px;
}
.thermal-receipt-container.paper-58mm .thermal-item-row .item-calc {
    font-size: 10px;
}

.thermal-totals-table {
    width: 100%;
    border-collapse: collapse;
}
.thermal-totals-table td {
    padding: 2px 0;
    font-size: 12px;
}
.thermal-receipt-container.paper-58mm .thermal-totals-table td {
    font-size: 10px;
}
.thermal-grand-total {
    font-size: 17px !important;
    font-weight: 900 !important;
}
.thermal-receipt-container.paper-58mm .thermal-grand-total {
    font-size: 14px !important;
}

.thermal-codes-block {
    text-align: center;
    margin: 8px 0;
}

.thermal-footer {
    text-align: center;
    font-size: 11px;
    margin-top: 6px;
    line-height: 1.35;
}
.thermal-receipt-container.paper-58mm .thermal-footer {
    font-size: 10px;
}

.thermal-cut-feed {
    height: 35px;
}

@media print {
    @page {
        margin: 0;
        size: auto;
    }
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
    .sidebar, .top-header, .no-print, .btn, .alert {
        display: none !important;
    }
    .main-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }
    .content-container {
        padding: 0 !important;
        margin: 0 !important;
    }
    .thermal-receipt-container {
        margin: 0 auto !important;
        padding: 0 4px !important;
        box-shadow: none !important;
        border: none !important;
    }
    .thermal-receipt-container.paper-80mm {
        width: 76mm !important;
        max-width: 76mm !important;
    }
    .thermal-receipt-container.paper-58mm {
        width: 52mm !important;
        max-width: 52mm !important;
    }
}

/* Printable Barcode Label Stickers */
.label-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.product-label-sticker {
    border: 1px dashed #94a3b8;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    background: #fff;
    page-break-inside: avoid;
}
.product-label-sticker .sticker-store { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.product-label-sticker .sticker-name { font-size: 11px; font-weight: 600; margin: 3px 0; }
.product-label-sticker .sticker-price { font-size: 14px; font-weight: 700; color: #000; margin: 4px 0; }
.product-label-sticker svg, .product-label-sticker img { max-width: 100%; height: auto; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
}
