/* ===== CSS Reset & Variables ===== */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #6c757d;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 8px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    overflow: hidden;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Skip Link ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 100;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* ===== Layout ===== */
#app {
    height: 100vh;
    display: flex;
}

.page {
    width: 100%;
    height: 100%;
}

#login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

#main-app {
    display: flex;
    width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-role {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
    font-weight: 500;
    font-size: 0.95rem;
    text-align: left;
}

.nav-item i {
    color: var(--gray-600);
    width: 24px;
    text-align: left;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-item span:not(.nav-shortcut) {
    text-align: left;
    flex: 1;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-item:hover i {
    color: var(--primary);
}

.nav-item.active {
    background: #e8eeff;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item.active i {
    color: var(--primary);
}

.nav-shortcut {
    font-size: 0.7rem;
    background: var(--gray-300);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    color: var(--gray-700);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--gray-100);
}

.top-header {
    background: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

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

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-600);
}

.back-btn {
    color: var(--gray-600);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: var(--radius);
}

.back-btn:hover {
    background: var(--gray-100);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-600);
    padding: 0.25rem;
    border-radius: 50%;
}

.btn-icon:hover {
    background: var(--gray-100);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.content-page {
    height: 100%;
    overflow-y: auto;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-card .change {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.stat-card .icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.1;
}

.stat-card.blue .icon { color: var(--primary); }
.stat-card.green .icon { color: var(--success); }
.stat-card.red .icon { color: var(--danger); }
.stat-card.orange .icon { color: var(--warning); }

/* ===== Tables ===== */
.data-table {
    width: 100%;
    background: white;
    border-radius: var(--radius);
    border-collapse: collapse;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th {
    background: var(--gray-100);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.col-image {
    width: 60px;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-badge.completed,
.status-badge.paid,
.status-badge.active,
.status-badge.in_stock { background: #d4edda; color: #155724; }
.status-badge.pending,
.status-badge.holding,
.status-badge.low_stock { background: #fff3cd; color: #856404; }
.status-badge.expiring_soon { background: #ffe8a1; color: #7a5902; }
.status-badge.expired { background: #f8d7da; color: #721c24; }
.status-badge.cancelled,
.status-badge.out_of_stock { background: #f8d7da; color: #721c24; }

.selected-row {
    background-color: #e3f2fd !important;
    border-left: 4px solid #2196f3 !important;
}

/* ===== POS Layout ===== */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    height: 100%;
}

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

.pos-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.category-select {
    width: 200px;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
}

.products-grid {
    flex: 1;
    overflow-y: auto;
    display: block !important; /* Override grid to allow inline-block */
    padding: 0.5rem;
    background: #f8f9fa; /* Light background to see the container */
    min-height: 300px;
}

.products-grid .product-card {
    /* Ensure product cards are visible */
    z-index: 1;
    position: relative;
}

.product-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    /* Use block mode to avoid flexbox height collapse issues */
    display: block; 
    /* Debug: ensure visibility */
    z-index: 1;
}

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

.product-card.focused {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.product-card.product-added {
    animation: productAdded 0.2s;
}

@keyframes productAdded {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.product-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: var(--light);
    border-bottom: 1px solid var(--gray-100);
    display: block;
}

.no-image {
    height: 120px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 2rem;
    border-bottom: 1px solid var(--gray-100);
}

.product-info {
    padding: 0.75rem;
    display: block;
}

.product-info .name {
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.product-info .price {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    display: block;
}

.product-info .stock {
    font-size: 0.75rem;
    color: var(--gray-500);
    display: block;
}

.product-card.out-of-stock {
    opacity: 0.6;
    filter: grayscale(0.8);
    cursor: not-allowed;
}

.product-card.out-of-stock::after {
    content: 'Out of Stock';
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    backdrop-filter: blur(2px);
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.pos-cart {
    background: white;
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#cart-count {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empty-cart {
    text-align: center;
    color: var(--gray-500);
    padding: 2rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.cart-item.expired-item {
    background: #fff5f5;
    border-color: #fc8181;
}

.expired-badge {
    background: #e53e3e;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 4px;
}

.cart-item-expired {
    display: flex;
    align-items: center;
}

.cart-item-expired label {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #e53e3e;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.cart-item-price {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

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

.cart-item-total {
    font-weight: 600;
    min-width: 70px;
    text-align: right;
}

.cart-item-remove {
    color: var(--danger);
    cursor: pointer;
    padding: 0.25rem;
}

.cart-summary {
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-200);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.discount-row input {
    width: 100px;
    padding: 0.25rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
}

.total-row {
    font-weight: 600;
    font-size: 1.125rem;
    border-top: 2px solid var(--gray-200);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

/* ===== Forms & Modals ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    display: flex !important;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.2s;
    display: none;
}

.modal.active {
    display: block;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-form {
    padding: 1.5rem;
}

/* Quantity Modal Styles */
#quantity-modal .modal-form .form-group {
    margin-bottom: 1rem;
}

#quantity-modal input:disabled {
    background-color: #f5f5f5;
    color: #666;
    border-color: #ddd;
    cursor: not-allowed;
}

#quantity-modal #quantity-input {
    font-size: 1.25rem;
    padding: 0.75rem;
    text-align: center;
}

#quantity-modal .quantity-input-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
}

#quantity-modal .quantity-input-wrap #quantity-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#quantity-modal .quantity-unit {
    min-width: 4rem;
    padding: 0 0.9rem;
    border: 1px solid var(--gray-300);
    border-left: 0;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.modal-content {
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.receipt-modal-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    border-radius: var(--radius);
    margin: 1rem 0;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-remove-image {
    margin-top: 5px;
    padding: 4px 8px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-remove-image:hover {
    background: #c82333;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: toastSlide 0.2s;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Keyboard Hints ===== */
.hints-toggle {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.keyboard-hints-panel {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    min-width: 250px;
    z-index: 950;
}

.keyboard-hints-panel h4 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.hint-section {
    margin-bottom: 1rem;
}

.hint-section-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.hint-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.875rem;
}

.hint-key {
    background: var(--gray-200);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* ===== Page Headers ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.page-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ===== Sales Tabs ===== */
.sales-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary);
    background: var(--gray-100);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--gray-100);
}

.tab-content.hidden {
    display: none;
}

.page-actions {
    display: flex;
    gap: 1rem;
}

.page-filters {
    margin-bottom: 1rem;
}

/* ===== Filters ===== */
.inventory-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* ===== Action Buttons ===== */
.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    background: var(--gray-200);
    color: var(--dark);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover {
    background: var(--gray-300);
}

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.action-btn-table {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    background: var(--gray-200);
    color: var(--dark);
}

.action-btn-table:hover {
    background: var(--gray-300);
}

.action-btn-table.view {
    background: var(--info);
    color: white;
}

.action-btn-table.edit {
    background: var(--warning);
    color: white;
}

.action-btn-table.delete {
    background: var(--danger);
    color: white;
}

/* ===== Loading States ===== */
.loading {
    text-align: center;
    color: var(--gray-500);
    padding: 2rem;
}

.loading-spinner {
    text-align: center;
    color: var(--gray-500);
    padding: 1rem;
}

/* ===== Alert Items ===== */
.alert-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.alert-item:last-child {
    border-bottom: none;
}

/* ===== Image Preview ===== */
.image-preview {
    margin-top: 0.5rem;
}

.image-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
}

/* ===== Upload Progress Bar ===== */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.upload-progress.hidden {
    display: none;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background-color: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 40px;
    text-align: right;
}

/* ===== Order Details ===== */
.order-info {
    margin-bottom: 1rem;
}

.order-info p {
    margin-bottom: 0.5rem;
}

.order-totals {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.order-totals p {
    margin-bottom: 0.5rem;
}

/* ===== Credit Summary ===== */
.credit-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.credit-customers {
    background: white;
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.credit-customers h3 {
    margin-bottom: 1rem;
}

/* ===== Sales Page ===== */
.sales-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.sales-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.summary-info {
    flex: 1;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
}

.summary-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* ===== Category List ===== */
.category-list {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.category-list h4 {
    margin-bottom: 1rem;
}

/* ===== Login Page ===== */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-500);
}

.login-form {
    margin-bottom: 1rem;
}

.login-footer {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ===== Error Messages ===== */
.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ===== Checkbox Label ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* ===== Quick Actions ===== */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.dashboard-card h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Recent Sales ===== */
.recent-sales {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.recent-sales h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== POS Shortcuts Hint ===== */
.pos-shortcuts-hint {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.hint {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.hint kbd {
    background: var(--gray-200);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    margin-right: 0.25rem;
}

/* ===== Cart Customer ===== */
.cart-customer {
    margin-bottom: 1rem;
}

.customer-select-wrapper {
    position: relative;
}

.customer-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.customer-select-arrow {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    pointer-events: none;
}

/* ===== Cart Payment ===== */
.cart-payment {
    margin-bottom: 1rem;
}

.payment-methods {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.payment-methods label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.payment-methods input[type="radio"] {
    width: auto;
}

.cash-received {
    margin-bottom: 1rem;
}

.cash-received label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.cash-received input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.change-display {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1.125rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr 300px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 1000;
        height: 100%;
        transition: left 0.3s;
    }
    .sidebar.open {
        left: 0;
    }
    .menu-toggle {
        display: block !important;
        cursor: pointer;
    }
    .pos-layout {
        grid-template-columns: 1fr;
    }
    .pos-cart {
        max-height: 500px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .page-actions {
        width: 100%;
    }
    .inventory-filters {
        flex-direction: column;
    }
    .filter-select {
        width: 100%;
    }
    .pos-shortcuts-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: 1rem;
    }
    .modal {
        width: 95%;
        max-height: 95vh;
    }
    .toast {
        min-width: auto;
        width: calc(100% - 2rem);
    }
    .keyboard-hints-panel {
        right: 0.5rem;
        left: 0.5rem;
        min-width: auto;
    }
}

/* ===== Mobile Responsive for Viewer Role ===== */
@media (max-width: 768px) {
    /* Make tables horizontally scrollable */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Touch-friendly inputs */
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="email"],
    input[type="date"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Mobile-friendly navigation */
    .nav-item {
        padding: 1rem;
        min-height: 44px;
    }
    
    /* Responsive page headers */
    .page-header h3 {
        font-size: 1.25rem;
    }
    
    /* Mobile-friendly filters */
    .inventory-filters,
    .page-filters,
    .sales-filters {
        gap: 0.75rem;
    }
    
    .search-input,
    .filter-input,
    .filter-select {
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Mobile-friendly action buttons */
    .action-btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Responsive dashboard */
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile-friendly cards */
    .dashboard-card {
        padding: 1rem;
    }
    
    /* Responsive tables */
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Mobile-friendly modals */
    .modal {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Touch-friendly form groups */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    /* Mobile-friendly quick actions */
    .quick-actions {
        gap: 0.75rem;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Responsive recent sales table */
    .recent-sales {
        overflow-x: auto;
    }
    
    /* Mobile-friendly inventory alerts */
    #inventory-alerts {
        font-size: 0.9rem;
    }
    
    .selected-row {
        background-color: #e3f2fd !important;
        border-left: 4px solid #2196f3 !important;
    }
    
    /* Touch-friendly navigation items */
    .sidebar-nav .nav-item {
        padding: 0.875rem 1rem;
    }
    
    /* Mobile header adjustments */
    .top-header {
        padding: 0.75rem 1rem;
    }
    
    .header-left h1 {
        font-size: 1.1rem;
    }
    
    /* Mobile user info */
    .user-info span {
        display: none;
    }
    
    /* Mobile notification badge */
    .notification-badge {
        font-size: 0.7rem;
        min-width: 18px;
        height: 18px;
    }
}

@media (max-width: 360px) {
    /* Extra small screens */
    .content-area {
        padding: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .page-header h3 {
        font-size: 1.1rem;
    }
}

/* ===== Print Styles ===== */
@media print {
    .sidebar,
    .top-header,
    .menu-toggle,
    .hints-toggle,
    .keyboard-hints-panel,
    .toast-container,
    .modal-overlay,
    .btn,
    .action-btns,
    .action-btn-table {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .content-area {
        padding: 0;
    }
    
    .data-table {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .data-table th,
    .data-table td {
        border: 1px solid #ddd;
    }
}

/* ===== Focus Styles ===== */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Date & Time Display ===== */
.datetime-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 20px;
    background: transparent;
    border-radius: 0;
    color: #333;
    box-shadow: none;
}

.datetime-display .current-date {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.datetime-display .current-time {
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* ===== Notification System ===== */
.notification-wrapper {
    position: relative;
    margin-right: 15px;
}

.notification-btn {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.notification-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 450px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(10px);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.notification-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.mark-all-read:hover {
    background: rgba(52, 152, 219, 0.1);
}

.notification-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--hover);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.notification-info .notification-icon {
    background: var(--primary);
    color: white;
}

.notification-warning .notification-icon {
    background: #f39c12;
    color: white;
}

.notification-critical .notification-icon {
    background: var(--danger);
    color: white;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 2px;
}

.notification-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.notification-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}

.notification-item:hover .notification-dismiss {
    opacity: 1;
}

.notification-dismiss:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text);
}

.notification-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notification-actions .btn {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.notification-empty p {
    margin: 0;
    font-size: 0.9rem;
}

.notification-footer {
    padding: 12px 15px;
    border-top: 1px solid var(--border);
    text-align: center;
    background: var(--surface);
}

.view-all-notifications {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background 0.2s;
}

.view-all-notifications:hover {
    background: rgba(52, 152, 219, 0.1);
}

/* Notification severity colors */
.notification-critical {
    border-left: 3px solid var(--danger);
}

.notification-warning {
    border-left: 3px solid #f39c12;
}

.notification-info {
    border-left: 3px solid var(--primary);
}

/* Responsive */
@media (max-width: 900px) {
    .header-center {
        display: none;
    }
    
    .notification-dropdown {
        width: 300px;
        right: -50px;
    }
}

/* ===== Export Dropdown ===== */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-options {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--light);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 10000;
    min-width: 120px;
    display: none;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.export-options.active {
    display: block;
    transform: translateY(5px);
}

.export-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: var(--dark);
    transition: background-color 0.2s ease;
}

.export-option:hover {
    background: var(--gray-100);
}

.export-option i {
    width: 16px;
    color: var(--primary);
}

@media (max-width: 768px) {
    .datetime-display {
        display: none;
    }

    .notification-dropdown {
        width: 300px;
        right: -50px;
    }
}

/* ===== Return Modal Enhancements ===== */
.order-summary {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}

.order-summary h4 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.order-items {
    max-height: 150px;
    overflow-y: auto;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.order-item:last-child {
    border-bottom: none;
}

#return-amount {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--success);
    background: var(--light);
}

#return-customer {
    background: var(--gray-100);
    cursor: not-allowed;
}

.help-text {
    font-size: 0.875em;
    color: var(--gray-600);
    margin-top: 0.25rem;
}
