:root {
    --primary-color: #DA041B;
    --primary-hover: #b80316;
    --bg-light: #f8f9fa;
}

/* PWA Install Button - Floating at bottom */
.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    padding: 0;
}

.pwa-install-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.pwa-install-btn:active {
    transform: scale(0.95);
}

.pwa-install-btn i {
    margin: 0;
}

/* PWA specific styles */
body.pwa-installed {
    /* Add any PWA-specific styles here */
}

body.pwa-installed .pwa-install-btn {
    display: none !important;
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    
    .pwa-install-btn {
        bottom: max(20px, env(safe-area-inset-bottom) + 10px);
        right: max(20px, env(safe-area-inset-right) + 10px);
    }
}

body {
    background-color: var(--bg-light);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
}

/* Sidebar Styles */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

.sidebar {
    min-width: 250px;
    max-width: 250px;
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #fff;
    transition: all 0.3s;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    left: -250px;
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 20px;
    background: var(--primary-color);
    text-align: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.sidebar ul.components {
    padding: 20px 0;
}

.sidebar ul li a {
    padding: 15px 20px;
    font-size: 1rem;
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
}

.sidebar ul li a.active {
    color: #fff;
    background: rgba(218, 4, 27, 0.2);
    border-left-color: var(--primary-color);
}

.sidebar ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Content Area */
.content {
    width: 100%;
    padding: 0;
    min-height: 100vh;
    transition: all 0.3s;
    margin-left: 0;
}

.content.active {
    margin-left: 250px;
}

/* Top Navbar */
.navbar {
    padding: 0.75rem 1rem;
}

#sidebarCollapse {
    border: none;
    padding: 0.5rem 1rem;
}

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: 10px;
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.3;
}

/* Advanced Table Styles */
.table-container {
    padding: 1rem;
}

.table-controls {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
}

.table-pagination {
    padding: 0.75rem 0;
}

.sortable {
    user-select: none;
}

.sortable:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.table-row-clickable {
    cursor: pointer;
}

.table-row-clickable:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.dropdown-item-text {
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.dropdown-item-text:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        left: -250px;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .content.active {
        margin-left: 0;
    }
    
    .sidebar.active ~ .content::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

.app-header {
    text-align: center;
}

.app-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.app-title i {
    margin-right: 0.5rem;
}

.card {
    border: none;
    border-radius: 12px;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    border: none;
}

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

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

.input-group-text.bg-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color);
}

.search-result-item {
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.search-result-item:hover {
    background-color: #f0f0f0;
    border-left-color: var(--primary-color);
    transform: translateX(2px);
}

.search-result-item.active {
    background-color: #e8f4f8;
    border-left-color: var(--primary-color);
}

.product-info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 1rem;
}

.product-name {
    font-weight: 600;
    color: #212529;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.product-details {
    font-size: 0.9rem;
    color: #6c757d;
}

.product-details strong {
    color: #495057;
}

.price-editable {
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
    min-width: 80px;
}

.price-editable:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
}

.price-editable:active {
    background-color: #dee2e6;
}

/* Barcode Scanner */
#barcodeScannerContainer {
    min-height: 400px;
}

#barcodeScannerContainer #interactive {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

#barcodeScannerContainer video {
    width: 100%;
    height: auto;
}

#barcodeScannerContainer canvas {
    display: none;
}

/* Mobile camera button */
@media (max-width: 768px) {
    #scanBarcodeBtn,
    #scanNewBarcodeBtn {
        display: block !important;
    }
}

@media (min-width: 769px) {
    #scanBarcodeBtn,
    #scanNewBarcodeBtn {
        display: none !important;
    }
}

.badge-custom {
    font-size: 0.85rem;
    padding: 0.4rem 0.7rem;
}

.alert {
    border-radius: 8px;
    border: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(218, 4, 27, 0.25);
}

/* Mobile optimizations */
@media (max-width: 576px) {
    .app-title {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.empty-state .btn {
    min-width: 200px;
}

/* Recent products - same style as search results */
#recentProducts {
    /* Uses same styling as search results via .search-result-item class */
}

/* Sale Receipt Styles */
.sale-receipt {
    max-width: 100%;
}

@media print {
    .sale-receipt {
        max-width: 100%;
    }
    .modal-footer,
    .btn {
        display: none !important;
    }
}

/* Quick Alert Styles for POS */
#quickAlert {
    animation: slideInRight 0.3s ease-out;
}

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

/* Cart item highlight animation */
.cart-item-added {
    animation: highlightRow 0.5s ease-out;
}

@keyframes highlightRow {
    0% {
        background-color: rgba(40, 167, 69, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

