:root {
    --primary: #0284c7;
    --primary-dark: #075985;
    --primary-light: #e0f2fe;
    --secondary: #64748b;
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #94a3b8;
    --border: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --radius-3xl: 3rem;
}

.dark {
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #64748b;
    --border: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
    --primary-light: rgba(2, 132, 199, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body.pos-body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.pos-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Sidebar */
.pos-sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 50;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    text-decoration: none;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(2, 132, 199, 0.3);
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.logo-text span {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    border-radius: 1.25rem;
    transition: all 0.2s ease;
}

.nav-link svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--bg-main);
    color: var(--text-main);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Main Content */
.pos-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-main);
}

.pos-header {
    background: var(--bg-sidebar);
    padding: 1rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 4px 6px -4px rgba(0,0,0,0.05);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title h2 { 
    font-size: 1.5rem;
    font-weight: 800; 
    color: var(--text-main);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.header-title p { 
    color: var(--text-muted); 
    font-size: 0.875rem; 
    font-weight: 500;
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--bg-main);
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.user-profile-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
}

.status-indicator {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border: 2px solid #fff;
    border-radius: 50%;
}

.search-form-header {
    display: flex;
    gap: 0.5rem;
    width: 350px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-icon-header {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-field {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-main);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.search-input-field:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Content Area */
.pos-content {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
}

.search-container {
    position: relative;
    margin-bottom: 2rem;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination nav div:first-child {
    display: none;
}

.pagination nav div:last-child {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.pagination nav div:first-child {
    display: none !important;
}

.pagination nav {
    display: block !important;
    width: 100%;
}

.pagination span[aria-current="page"] span {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.pagination a, .pagination span span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.pagination svg {
    width: 20px;
    height: 20px;
}
.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 10;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
    transition: all 0.3s;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.categories {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.category-btn {
    padding: 0.75rem 1.75rem;
    border-radius: 1.25rem;
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 700;
    border: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.category-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(2, 132, 199, 0.2);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 1.5rem;
    object-fit: cover;
    margin-bottom: 1rem;
}

.product-category-tag {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(2, 132, 199, 0.8);
    backdrop-filter: blur(4px);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.6rem;
    font-weight: 800;
}

.product-info { padding: 0 0.5rem; }
.product-name { font-weight: 800; color: var(--text-main); margin-bottom: 0.25rem; }
.product-sku { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; display: block; margin-bottom: 1rem; }

.product-footer { display: flex; justify-content: space-between; align-items: flex-end; }
.product-price { font-size: 1.2rem; font-weight: 900; color: var(--primary); }
.product-stock { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); }

.add-btn {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Cart Sidebar */
.pos-cart {
    width: 400px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.75rem;
    flex-shrink: 0;
    transition: all 0.4s ease;
}

.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.cart-header h3 { font-weight: 900; }
.item-count { background: var(--primary-light); color: var(--primary); padding: 0.25rem 0.75rem; border-radius: 0.75rem; font-size: 0.7rem; font-weight: 800; }

.cart-items { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; padding-bottom: 0.5rem; }
.cart-item { background: var(--bg-main); padding: 1.25rem; border-radius: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }

.item-main { display: flex; justify-content: space-between; align-items: flex-start; }
.item-info h5 { font-size: 0.95rem; font-weight: 800; color: var(--text-main); }
.item-info .price-qty { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.item-controls { display: flex; align-items: center; gap: 0.75rem; background: var(--bg-card); padding: 0.25rem; border-radius: 1rem; }
.qty-btn { width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-btn.minus { background: var(--bg-main); color: var(--secondary); }
.qty-btn.plus { background: var(--primary); color: white; }
.item-qty { font-weight: 800; font-size: 0.85rem; }
.item-total { font-weight: 900; color: var(--primary); }

.cart-summary { border-top: 2px dashed var(--border); padding-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; flex-shrink: 0; }
.summary-row { display: flex; justify-content: space-between; align-items: center; }
.summary-label { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.summary-value { font-weight: 800; color: var(--text-main); }

.payment-total { background: var(--bg-main); padding: 1.5rem; border-radius: 2rem; text-align: center; border: 2px dashed var(--border); margin-top: 0.5rem; }
.total-amount { font-size: 2.2rem; font-weight: 900; color: var(--primary); }

.pay-btn { width: 100%; padding: 1.25rem; border-radius: 1.5rem; border: none; background: var(--text-main); color: white; font-weight: 900; font-size: 1.2rem; cursor: pointer; transition: all 0.3s; }
.pay-btn:hover { background: #000; transform: translateY(-2px); }
.pay-btn:disabled { background: var(--border); color: var(--text-muted); transform: none; cursor: not-allowed; }

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: 1.25rem;
    cursor: pointer;
    border: none;
    color: var(--text-main);
    font-weight: 700;
}

.theme-toggle .icon-box {
    width: 32px;
    height: 32px;
    background: var(--bg-sidebar);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal-content { background: var(--bg-sidebar); width: 100%; max-width: 550px; border-radius: 2.5rem; padding: 2.5rem; box-shadow: var(--shadow-lg); position: relative; }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; position: relative; }
.modal-header h3 { font-size: 1.25rem; font-weight: 900; }

.remove-item { 
    width: 36px; height: 36px; border-radius: 10px; border: none; 
    background: transparent; color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.remove-item:hover { background: #fee2e2; color: #ef4444; }

.close-modal { 
    position: absolute !important; 
    top: 2.5rem !important; 
    right: 2.5rem !important; 
    width: 32px !important; 
    height: 32px !important; 
    border-radius: 8px !important; 
    border: none !important; 
    background: var(--bg-main) !important; 
    color: var(--text-muted) !important; 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
    cursor: pointer !important;
    transition: all 0.2s !important;
    padding: 0 !important;
    outline: none !important;
    z-index: 100;
}
.close-modal:hover { background: #ef4444 !important; color: white !important; transform: rotate(90deg); }

.payment-banner { background: var(--primary); padding: 1.5rem; border-radius: 1.5rem; color: white; margin-bottom: 2rem; text-align: center; }
.banner-amount { font-size: 2.5rem; font-weight: 900; }

.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.method-btn { padding: 1rem; border-radius: 1rem; border: 2px solid var(--border); background: var(--bg-card); color: var(--text-muted); font-weight: 800; cursor: pointer; }
.method-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.amount-input { width: 100%; padding: 1rem; border-radius: 1rem; border: none; background: var(--bg-main); font-size: 2rem; font-weight: 900; text-align: center; color: var(--text-main); margin-bottom: 1rem; }
.quick-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.quick-btn { padding: 0.75rem; border-radius: 0.75rem; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-main); font-weight: 700; cursor: pointer; }

.modal-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.btn-primary { padding: 1rem; border-radius: 1rem; border: none; background: var(--primary); color: white; font-weight: 800; cursor: pointer; }
.btn-secondary { padding: 1rem; border-radius: 1rem; border: 2px solid var(--primary); background: transparent; color: var(--primary); font-weight: 800; cursor: pointer; }

/* Utility & Responsiveness */
.lg-hidden { display: none; }
.mobile-hidden { display: flex; }

@media (max-width: 1024px) {
    .pos-sidebar { width: 85px; padding: 2rem 0.75rem; }
    .sidebar-logo .logo-text, .nav-link span, .sidebar-footer span { display: none; }
    .nav-link { justify-content: center; }
    .lg-hidden { display: flex; }
    .mobile-hidden { display: none !important; }
}

@media (max-width: 768px) {
    .pos-container { flex-direction: column; }
    .pos-sidebar { width: 100%; height: auto; flex-direction: row; padding: 1rem 1.5rem; border-right: none; border-bottom: 1px solid var(--border); overflow-x: auto; }
    .sidebar-logo { margin-bottom: 0; margin-right: 2rem; }
    .nav-menu { flex-direction: row; }
    .sidebar-footer { flex-direction: row; border-top: none; padding-top: 0; align-items: center; margin-left: auto; }
    
    .pos-cart {
        position: fixed;
        right: -100%;
        top: 0;
        bottom: 0;
        z-index: 1000;
        width: 85%;
        box-shadow: -10px 0 30px rgba(0,0,0,0.1);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .pos-cart.mobile-show { right: 0; }
    
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
}

[x-cloak] { display: none !important; }
