* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
}

.container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 20px;
}

.sidebar h2 {
    margin-bottom: 30px;
    font-size: 24px;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 10px;
}

.nav-link {
    display: block;
    padding: 12px 15px;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: #34495e;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

h1 {
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.8;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 120px);
}

.pos-left,
.pos-right {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.scan-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#barcode-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.product-list {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.product-item {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.3s;
}

.product-item:hover {
    background: #f8f9fa;
}

.product-item h4 {
    margin-bottom: 5px;
    color: #2c3e50;
}

.product-item p {
    color: #7f8c8d;
    font-size: 14px;
}

/* Cart */
.cart-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin: 15px 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.cart-item-info p {
    font-size: 12px;
    color: #7f8c8d;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.qty-btn {
    width: 25px;
    height: 25px;
    border: none;
    background: #3498db;
    color: white;
    border-radius: 3px;
    cursor: pointer;
}

.qty-input {
    width: 40px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 3px;
}

.remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.cart-summary {
    border-top: 2px solid #ddd;
    padding-top: 15px;
    margin-bottom: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 16px;
}

.summary-row.total {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
}

#discount-input {
    width: 100px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.checkout-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#customer-name,
#payment-method {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Products List */
.products-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.product-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 5px solid #3498db;
}

.product-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.product-card-info {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 20px;
    align-items: center;
}

.product-name-section h3 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 18px;
}

.product-name-section .barcode-text {
    font-size: 12px;
    color: #95a5a6;
    font-family: 'Courier New', monospace;
}

.product-detail {
    text-align: center;
}

.product-detail-label {
    font-size: 11px;
    color: #95a5a6;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.product-detail-value {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
}

.product-detail-value.price {
    color: #27ae60;
    font-size: 20px;
}

.product-detail-value.stock {
    color: #e74c3c;
}

.product-detail-value.stock.high {
    color: #27ae60;
}

.product-detail-value.category {
    color: #3498db;
    font-size: 14px;
}

.product-card .actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.product-card .actions button {
    padding: 10px 15px;
    font-size: 13px;
    white-space: nowrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #7f8c8d;
}

.close:hover {
    color: #2c3e50;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* History Table */
.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.history-filters input,
.history-filters select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.history-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.history-table thead {
    background: #2c3e50;
    color: white;
}

.history-table th,
.history-table td {
    padding: 15px;
    text-align: left;
}

.history-table tbody tr {
    border-bottom: 1px solid #eee;
}

.history-table tbody tr:hover {
    background: #f8f9fa;
}

/* Reports */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.report-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.report-card h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.report-card p {
    margin-bottom: 10px;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
}

.report-value {
    font-weight: bold;
    color: #3498db;
}

.report-item {
    padding: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.report-item:last-child {
    border-bottom: none;
}

#low-stock-list {
    max-height: 300px;
    overflow-y: auto;
}

.low-stock-item {
    padding: 10px;
    border-left: 3px solid #e74c3c;
    background: #fff5f5;
    margin-bottom: 10px;
    border-radius: 3px;
}

.date-range-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.date-range-section h2 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.date-range-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.date-range-inputs input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    flex: 1;
}

/* Sale Details */
#sale-details {
    margin-bottom: 20px;
}

.sale-info {
    margin-bottom: 20px;
}

.sale-info p {
    margin-bottom: 8px;
}

.sale-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.sale-items-table th,
.sale-items-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.sale-items-table th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 15px;
    font-size: 16px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

.toast.warning {
    background: #f39c12;
}

.toast.info {
    background: #3498db;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Input Validation */
input.error,
select.error {
    border-color: #e74c3c !important;
    background-color: #fff5f5 !important;
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        bottom: 10px;
    }
}

/* Sync Status Indicator */
.sync-status {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    margin: 15px 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    font-size: 13px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}
.sync-status.online .status-dot { background-color: #2ecc71; }
.sync-status.offline .status-dot { background-color: #e67e22; }
.sync-status.online .status-text { color: #2ecc71; font-weight: bold; }
.sync-status.offline .status-text { color: #e67e22; font-weight: bold; }
