/* =====================================================
   SWEATER SHOP POS - PWA MOBILE-FIRST
   ===================================================== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #F2994A 0%, #F2C94C 100%);
    --gradient-danger: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --gradient-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    
    --sidebar-width: 240px;
    --header-height: 56px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
    
    /* Safe area for notch phones */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f2f5;
    color: var(--gray-800);
    font-size: 14px;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    width: 100%;
}

.layout { 
    display: flex; 
    height: 100%;
    overflow: hidden;
}

/* SIDEBAR - Hidden by default on mobile */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-dark);
    position: fixed;
    top: 0; 
    left: 0;
    height: 100%;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: var(--safe-top);
    transform: translateX(-100%);
}

.sidebar.open { transform: translateX(0); }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
}

.sidebar-logo i {
    width: 36px; height: 36px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-nav { padding: 12px 8px; }

.nav-label {
    color: var(--gray-400);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: var(--gray-300);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.nav-item:hover, .nav-item:active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: var(--white);
}

.nav-item i { width: 20px; text-align: center; }

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    width: 100%;
}

/* HEADER */
.header {
    background: var(--white);
    padding: 10px 16px;
    padding-top: calc(10px + var(--safe-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    min-height: var(--header-height);
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.menu-toggle {
    width: 40px; height: 40px;
    border: none;
    background: var(--gradient-primary);
    color: var(--white);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--gray-50);
    border-radius: 50px;
    flex-shrink: 0;
}

.user-avatar {
    width: 32px; height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 0.85rem;
}

.user-details { display: none; }
.user-name { font-weight: 600; font-size: 0.8rem; }
.user-role { font-size: 0.7rem; color: var(--gray-500); }

/* CONTENT */
.content { 
    flex: 1; 
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(12px + var(--safe-bottom));
}

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-800);
}

/* CARDS */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-50);
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--primary); }

.card-body { padding: 16px; }

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card:nth-child(2) { border-left-color: var(--success); }
.stat-card:nth-child(3) { border-left-color: var(--warning); }
.stat-card:nth-child(4) { border-left-color: var(--danger); }
.stat-card:nth-child(5) { border-left-color: var(--info); }

.stat-icon {
    width: 40px; height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--white);
    flex-shrink: 0;
}

.stat-card:nth-child(2) .stat-icon { background: var(--gradient-success); }
.stat-card:nth-child(3) .stat-icon { background: var(--gradient-warning); }
.stat-card:nth-child(4) .stat-icon { background: var(--gradient-danger); }
.stat-card:nth-child(5) .stat-icon { background: var(--gradient-info); }

.stat-info h3 { font-size: 1.1rem; font-weight: 700; }
.stat-info p { color: var(--gray-500); font-size: 0.75rem; }

/* BUTTONS - Touch friendly */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
    min-height: 44px; /* Touch target */
}

.btn:active { transform: scale(0.96); opacity: 0.9; }

.btn-primary { background: var(--gradient-primary); color: var(--white); }
.btn-success { background: var(--gradient-success); color: var(--white); }
.btn-warning { background: var(--gradient-warning); color: var(--white); }
.btn-danger { background: var(--gradient-danger); color: var(--white); }
.btn-info { background: var(--gradient-info); color: var(--white); }
.btn-secondary { background: var(--gray-500); color: var(--white); }

.btn-light {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-sm { padding: 8px 12px; font-size: 0.8rem; min-height: 36px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; }

/* FORMS */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 16px; /* Prevent zoom on iOS */
    font-family: inherit;
    transition: var(--transition);
    min-height: 44px;
}

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

select.form-control {
    cursor: pointer;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") right 12px center / 18px no-repeat;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* TABLE */
.table-responsive { 
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table { width: 100%; border-collapse: collapse; }

.table th {
    background: var(--gradient-primary);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.85rem;
}

.table tbody tr:active { background: var(--gray-100); }

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

.badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-lg { max-width: 600px; }

.modal-header {
    padding: 14px 18px;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 1rem; }

.modal-close {
    width: 36px; height: 36px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
}

.modal-body {
    padding: 18px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    padding: 14px 18px;
    padding-bottom: calc(14px + var(--safe-bottom));
    background: var(--gray-50);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* FILTER */
.filter-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-row .form-group { margin-bottom: 0; }

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; }

/* ACTION BUTTONS */
.action-btns { display: flex; gap: 6px; }

/* ==========================================
   POS PAGE - MOBILE OPTIMIZED
   ========================================== */
.pos-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.pos-products {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.pos-search {
    padding: 10px;
    border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
}

/* POS Clock */
.pos-clock {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 12px 16px;
    text-align: center;
    flex-shrink: 0;
}

.clock-time {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

.clock-date {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
}

.pos-search input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 16px;
    background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") 14px center / 20px no-repeat;
}

.pos-categories {
    display: flex;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    font-family: inherit;
    transition: var(--transition);
    min-height: 36px;
}

.category-btn:active { transform: scale(0.95); }
.category-btn.active {
    background: var(--gradient-primary);
    color: var(--white);
    border-color: transparent;
}

/* PRODUCT GRID */
.pos-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

.product-card {
    background: var(--white);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--gray-100);
    text-align: center;
}

.product-card:active {
    transform: scale(0.95);
    border-color: var(--primary);
}

.product-card.disabled { opacity: 0.5; pointer-events: none; }

.product-image {
    width: 50px; height: 50px;
    margin: 0 auto 6px;
    border-radius: 8px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image i { font-size: 1.3rem; color: var(--gray-400); }

.product-name {
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--gray-800);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.product-stock {
    font-size: 0.6rem;
    color: var(--gray-500);
}
.product-stock.low { color: var(--warning); }
.product-stock.out { color: var(--danger); }

/* CART - BOTTOM SHEET STYLE */
.pos-cart {
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    padding-bottom: var(--safe-bottom);
}

.pos-cart.minimized {
    transform: translateY(calc(100% - 70px));
}

.cart-header {
    padding: 12px 16px;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.cart-header h3 { 
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-badge {
    background: var(--white);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.cart-toggle {
    width: 32px; height: 32px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    max-height: 30vh;
    -webkit-overflow-scrolling: touch;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 10px;
    margin-bottom: 8px;
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { 
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-price { font-size: 0.75rem; color: var(--gray-500); }

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

.qty-btn {
    width: 32px; height: 32px;
    border: none;
    background: var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qty-btn:active { background: var(--primary); color: var(--white); }

.qty-input {
    width: 40px;
    text-align: center;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

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

.remove-btn {
    width: 32px; height: 32px;
    border: none;
    background: var(--danger);
    color: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
}

.cart-empty {
    text-align: center;
    padding: 20px;
    color: var(--gray-400);
}
.cart-empty i { font-size: 2rem; margin-bottom: 8px; display: block; }

.cart-summary {
    padding: 12px 16px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.summary-row.total {
    font-size: 1.2rem;
    font-weight: 700;
    padding-top: 10px;
    border-top: 2px dashed var(--gray-300);
    margin-top: 8px;
    margin-bottom: 0;
}

.summary-row.total span:last-child { color: var(--primary); }

.discount-input {
    width: 90px;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    text-align: right;
    font-size: 0.9rem;
}

.change-display {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--success);
}

.receive-section, .change-section {
    background: var(--gray-100);
    margin: 0 -16px;
    padding: 8px 16px !important;
}

.quick-cash {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
    justify-content: center;
}

.quick-cash button {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.quick-cash button:active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.cart-actions {
    padding: 12px 16px;
    flex-shrink: 0;
}

.payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.payment-btn {
    padding: 12px;
    border: 2px solid var(--gray-200);
    background: var(--white);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.payment-btn:active { transform: scale(0.97); }
.payment-btn.active {
    background: var(--gradient-primary);
    color: var(--white);
    border-color: transparent;
}

/* CHECKOUT BUTTON - BIG & PROMINENT */
.checkout-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--gradient-success);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.checkout-btn:active { transform: scale(0.98); }

.checkout-btn:disabled {
    background: var(--gray-300);
    box-shadow: none;
    cursor: not-allowed;
}

/* LOGIN PAGE */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 20px;
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo i { font-size: 2.5rem; color: var(--primary); }
.login-logo h1 { font-size: 1.3rem; margin-top: 10px; }

/* CHART */
.chart-container {
    position: relative;
    height: 200px !important;
    width: 100%;
}

/* UTILITIES */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-500); }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }

/* ==========================================
   DESKTOP STYLES
   ========================================== */
@media (min-width: 768px) {
    .sidebar { transform: translateX(0); }
    .sidebar-overlay { display: none !important; }
    .main-content { margin-left: var(--sidebar-width); }
    .menu-toggle { display: none; }
    .user-details { display: block; }
    
    .content { padding: 20px; }
    
    .filter-row { flex-direction: row; align-items: flex-end; }
    .filter-row .form-group { flex: 1; min-width: 140px; }
    
    .modal { align-items: center; padding: 20px; }
    .modal-content { border-radius: var(--radius-lg); }
    
    .pos-layout {
        display: grid;
        grid-template-columns: 1fr 380px;
        gap: 16px;
        height: calc(100vh - var(--header-height) - 40px);
    }
    
    .pos-cart {
        position: relative;
        border-radius: var(--radius);
        max-height: none;
        box-shadow: var(--shadow);
    }
    
    .pos-cart.minimized { transform: none; }
    
    .cart-header { cursor: default; }
    .cart-toggle { display: none; }
    
    .cart-items { max-height: none; flex: 1; }
    
    .pos-items { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (min-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(5, 1fr); }
    .pos-items { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* LANDSCAPE MODE - Hide sidebar on tablets/phones */
@media (orientation: landscape) and (max-height: 900px) {
    .sidebar {
        display: none !important;
        transform: translateX(-100%) !important;
    }
    .sidebar.open {
        display: flex !important;
        flex-direction: column !important;
        transform: translateX(0) !important;
        z-index: 1001 !important;
        left: 0 !important;
        /* Add safe area padding to the entire sidebar */
        padding-left: env(safe-area-inset-left, 0px) !important;
    }
    /* Fix logo position - normal padding, safe area already applied to parent */
    .sidebar.open .sidebar-header {
        padding: 16px !important;
        padding-top: 20px !important;
    }
    .sidebar.open .sidebar-logo {
        justify-content: flex-start !important;
        gap: 10px !important;
    }
    .sidebar.open .sidebar-nav {
        padding: 12px 8px !important;
    }
    .sidebar.open .nav-item {
        padding: 12px 14px !important;
    }
    .sidebar-overlay.show {
        display: block !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .header {
        padding-left: calc(16px + env(safe-area-inset-left, 0px)) !important;
        padding-right: calc(16px + env(safe-area-inset-right, 0px)) !important;
    }
    /* Keep hamburger visible */
    .menu-toggle {
        display: flex !important;
    }
    /* More space for content */
    .content {
        padding: 10px !important;
        padding-left: calc(10px + env(safe-area-inset-left, 0px)) !important;
        padding-right: calc(10px + env(safe-area-inset-right, 0px)) !important;
    }
    .page-header {
        margin-bottom: 10px !important;
    }
    .page-header h1 {
        font-size: 1.2rem !important;
    }
    /* POS adjustments */
    .pos-top-bar {
        padding: 8px 10px !important;
    }
    .pos-items {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
        gap: 8px !important;
    }
    .pos-item {
        padding: 10px 8px !important;
    }
    .pos-item-name {
        font-size: 0.85rem !important;
    }
    
    /* Cart fix for landscape - SCROLLABLE */
    .pos-cart {
        max-height: 100vh !important;
        height: 100% !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        padding-right: env(safe-area-inset-right, 0px) !important;
    }
    .cart-items {
        flex: 1 !important;
        max-height: none !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
    }
    .cart-footer {
        flex-shrink: 0 !important;
        padding: 10px !important;
        background: var(--white) !important;
        border-top: 1px solid var(--gray-200) !important;
    }
    .cart-summary {
        padding: 8px !important;
    }
    .quick-checkout {
        gap: 8px !important;
    }
    .quick-checkout .btn {
        padding: 10px !important;
        font-size: 0.9rem !important;
    }
}

/* PRINT */
@media print {
    .sidebar, .header, .filter-section, .action-btns, .pos-cart { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content { padding: 0 !important; }
}

/* SWEETALERT */
.swal2-popup { 
    border-radius: var(--radius) !important; 
    font-family: 'Sarabun', sans-serif !important; 
}
.swal2-confirm { background: var(--gradient-primary) !important; }

/* ==================== */
/* QUICK CHECKOUT BUTTONS */
/* ==================== */
.quick-checkout-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.quick-pay-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
}
.quick-pay-btn i {
    font-size: 1.8rem;
}
.quick-pay-btn.cash-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.quick-pay-btn.cash-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
    transform: scale(1.02);
}
.quick-pay-btn.transfer-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}
.quick-pay-btn.transfer-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: scale(1.02);
}
.quick-pay-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.quick-pay-btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* Calculate Change Button */
.calc-change-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--gray-300);
    border-radius: 8px;
    color: var(--gray-500);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}
.calc-change-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Change Calculator Panel */
.change-calc-panel {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
}
.change-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.change-calc-row span {
    font-weight: 500;
}
.change-calc-panel .quick-cash {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.change-calc-panel .quick-cash button {
    flex: 1;
    min-width: 50px;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.change-calc-panel .quick-cash button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.change-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 12px;
}
.change-result .change-display {
    font-size: 1.3rem;
    font-weight: 700;
}
.change-calc-panel .checkout-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.change-calc-panel .checkout-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

/* ==================== */
/* POS TOP BAR & TODAY SALES */
/* ==================== */
.pos-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.pos-today-sales {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    text-align: center;
    min-width: 140px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.today-label {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 2px;
}
.today-amount {
    font-size: 1.4rem;
    font-weight: 700;
}
.today-count {
    font-size: 0.8rem;
    opacity: 0.9;
}

@media (max-width: 480px) {
    .pos-top-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .pos-today-sales {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
    }
    .today-label {
        display: none;
    }
    .today-amount {
        font-size: 1.2rem;
    }
    .today-count {
        font-size: 0.75rem;
    }
}

/* ==================== */
/* EDITABLE PRICE IN CART */
/* ==================== */
.cart-item-price-row {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.9rem;
    color: var(--gray-500);
}
.cart-item-price-row .price-input {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--gray-50);
    text-align: right;
}
.cart-item-price-row .price-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}
.cart-item-price-row .price-multiply {
    color: var(--gray-400);
    font-size: 0.85rem;
}

/* Hide number input arrows */
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.price-input[type=number] {
    -moz-appearance: textfield;
}
