/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #667eea;
    font-size: 24px;
    margin-bottom: 10px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #666;
}

/* Main Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
    text-align: center;
}

.sidebar-header h2 {
    color: white;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav a {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #34495e;
    border-left: 4px solid #3498db;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-nav {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    font-size: 14px;
}

.content {
    padding: 30px;
    flex: 1;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-info {
    background: #3498db;
    color: white;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-light {
    background: #ecf0f1;
    color: #333;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

.table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.table thead {
    background: #34495e;
    color: white;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Forms */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group small {
    color: #666;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

.readonly-field {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Dashboard */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    margin-bottom: 5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 14px;
}

.quick-actions {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.dashboard-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.dashboard-section h3 {
    margin-bottom: 15px;
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form input,
.filter-form select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.filter-form input[type="text"] {
    flex: 1;
    min-width: 200px;
}

/* POS Styles */
.pos-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    height: calc(100vh - 150px);
}

.pos-products {
    background: white;
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
}

.pos-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.pos-search input,
.pos-search select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.pos-search input {
    flex: 1;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.product-card {
    background: white;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f8f9fa;
}

.product-image-placeholder {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 48px;
    color: white;
}

.product-info {
    padding: 12px;
    flex: 1;
}

.product-info h4 {
    font-size: 15px;
    margin-bottom: 5px;
    color: #333;
    font-weight: 600;
}

.product-category {
    color: #888;
    font-size: 11px;
    margin-bottom: 5px;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #2ecc71;
    margin: 8px 0;
}

.product-stock {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.product-card .btn {
    margin: 0 12px 12px 12px;
    width: calc(100% - 24px);
}

.pos-cart {
    background: white;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.empty-cart {
    text-align: center;
    color: #999;
    padding: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-qty {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
}

.btn-remove {
    width: 30px;
    height: 30px;
    border: none;
    background: #e74c3c;
    color: white;
    cursor: pointer;
    border-radius: 3px;
}

.cart-summary {
    border-top: 2px solid #ddd;
    padding-top: 15px;
    margin-bottom: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.summary-row input {
    width: 80px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.summary-row.total {
    font-size: 18px;
    border-top: 2px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

.customer-info,
.payment-section {
    margin-bottom: 15px;
}

.customer-info label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.customer-info select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 14px;
}

.customer-balance-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.customer-balance-info strong {
    color: #555;
}

.customer-balance-info span {
    color: #e74c3c;
    font-weight: bold;
}

.customer-info input,
.payment-section input,
.payment-section select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
}

.financial-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    color: white;
}

.financial-summary .summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
}

.financial-summary .summary-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.financial-summary .summary-row.highlight {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 16px;
}

.financial-summary .summary-row span:last-child {
    font-weight: bold;
}

/* Pending Bills Section */
#pendingBillsSection h4 {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

#pendingBillsList {
    scrollbar-width: thin;
    scrollbar-color: #d9534f #f1f1f1;
}

#pendingBillsList::-webkit-scrollbar {
    width: 6px;
}

#pendingBillsList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#pendingBillsList::-webkit-scrollbar-thumb {
    background: #d9534f;
    border-radius: 3px;
}

#pendingBillsList::-webkit-scrollbar-thumb:hover {
    background: #c9302c;
}

.change-display {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: bold;
    color: #2ecc71;
    margin-top: 10px;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Product Row for Purchases */
.product-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.product-row select,
.product-row input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.product-total {
    font-weight: bold;
    color: #2ecc71;
}

/* Invoice */
.invoice-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    margin: 0 auto;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.invoice-section {
    margin-bottom: 20px;
}

.invoice-section h4 {
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .sidebar,
    .top-nav,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
}
