/* Modern Luxury Fashion Store UI CSS */
@import url('https://fonts.googleapis.com/css2?family=Kantumruy+Pro:wght@300;400;500;600;700&family=Noto+Sans+Khmer:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --font-main: 'Kantumruy Pro', 'Noto Sans Khmer', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --bg-main: #0b0f19;
    --bg-surface: #111827;
    --bg-card: #1f293d;
    --bg-hover: #2d3748;
    --border-color: rgba(255, 255, 255, 0.15);
    --border-light: rgba(255, 255, 255, 0.25);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);

    --accent-gold: #fbbf24;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-cyan: #06b6d4;

    --text-heading: #ffffff;
    --text-body: #f3f4f6;
    --text-muted: #9ca3af;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

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

/* Layout Wrapper */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.brand-title p {
    font-size: 0.75rem;
    color: var(--accent-gold);
    font-weight: 500;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 12px 12px 6px 12px;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
}

.sidebar-menu li {
    list-style: none;
    margin-bottom: 2px;
}

.sidebar-menu a, .sidebar-menu a:visited {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #f1f5f9 !important;
    text-decoration: none !important;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.sidebar-menu a i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    transform: translateX(4px);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(139, 92, 246, 0.25)) !important;
    color: #ffffff !important;
    border: 1px solid rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: #000;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info h4 {
    font-size: 0.85rem;
    color: #fff;
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-navbar {
    height: 70px;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.nav-search {
    position: relative;
    width: 320px;
}

.nav-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 10px 16px 10px 40px;
    border-radius: var(--radius-full);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: 0.2s;
}

.nav-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.nav-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-pos-shortcut {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
}

.btn-pos-shortcut:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.content-body {
    padding: 28px;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.page-title p {
    font-size: 0.9rem;
    color: var(--text-body);
    margin-top: 4px;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 22px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.stat-icon.indigo { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.stat-icon.rose { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.stat-icon.gold { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); }

.stat-info span {
    font-size: 0.8rem;
    color: var(--text-body);
    font-weight: 500;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-top: 4px;
}

/* Grid & Cards Container */
.card-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Modern Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.custom-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-body);
    padding: 14px 18px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.custom-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-heading);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: background 0.2s ease;
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.prod-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(244, 63, 94, 0.15); color: #f87171; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-info { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }

/* Form Controls & Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.4);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-body);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

select.form-control option {
    background: var(--bg-surface);
    color: #fff;
}

/* POS Layout */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    height: calc(100vh - 120px);
}

.pos-products-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.category-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.cat-tab {
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
}

.cat-tab.active, .cat-tab:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding-right: 6px;
    flex: 1;
}

.product-item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-item-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.product-item-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.product-item-card .prod-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
}

.product-item-card .meta-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.product-item-card .price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.product-item-card .stock-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* POS Cart Panel */
.pos-cart-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: var(--shadow-card);
}

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

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: var(--radius-md);
}

.cart-item-details h5 {
    font-size: 0.85rem;
    color: #fff;
}

.cart-item-details p {
    font-size: 0.75rem;
    color: var(--accent-gold);
    margin-top: 2px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-qty {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-qty:hover {
    background: var(--primary);
}

.cart-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-body);
    margin-bottom: 8px;
}

.summary-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
    margin-top: 10px;
}

/* Modal Popup */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.2rem;
    color: #fff;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
}

/* Receipt Print Styling */
.receipt-box {
    background: #fff;
    color: #000;
    padding: 20px;
    border-radius: var(--radius-md);
    font-family: 'Kantumruuy Pro', monospace;
    font-size: 0.85rem;
}

.receipt-header {
    text-align: center;
    margin-bottom: 14px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 10px;
}

.receipt-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.receipt-table {
    width: 100%;
    margin: 12px 0;
    border-collapse: collapse;
}

.receipt-table th {
    border-bottom: 1px solid #000;
    text-align: left;
    padding: 4px 0;
}

.receipt-table td {
    padding: 6px 0;
    border-bottom: 1px dashed #eee;
}

.receipt-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 0.75rem;
    border-top: 1px dashed #ccc;
    padding-top: 10px;
}

@media print {
    body * {
        visibility: hidden;
    }
    .receipt-box, .receipt-box * {
        visibility: visible;
    }
    .receipt-box {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}
