﻿/* === التصميم العام لنقطة البيع === */
.pos-container {
    display: flex;
    height: 100vh;
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* === الجانب الأيسر: الفئات === */
.pos-categories {
    flex: 0 0 180px;
    background: #343a40;
    color: white;
    padding: 15px 0;
    overflow-y: auto;
}

.category-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 5px;
    background: transparent;
    border: none;
    color: #ddd;
    text-align: right;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .category-btn:hover, .category-btn.active {
        background: #495057;
        color: white;
    }

    .category-btn i {
        margin-left: 10px;
        width: 20px;
        text-align: center;
    }

/* === الجانب الأوسط: المنتجات === */
.pos-products {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
}

.products-header {
    display: flex;
    margin-bottom: 15px;
}

#product-search {
    flex: 1;
    padding: 12px 15px;
    font-size: 1.1em;
    border-radius: 8px;
}

.products-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 5px;
    align-content: flex-start;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 180px;
    width: 120px;
    margin: 0 auto;
}

    .product-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    }

.product-image {
    height: 100px;
    width: 100px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    margin: 5px auto;
    border-radius: 5px;
}

.product-card-body {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.product-card-name {
    font-size: 0.85em;
    font-weight: 500;
    margin-bottom: 5px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card-price {
    font-weight: bold;
    color: #28a745;
    font-size: 1em;
}

/* === الجانب الأيمن: سلة الفاتورة === */
.pos-bill {
    flex: 0 0 400px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
}

.bill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.bill-customer {
    margin-bottom: 15px;
}

.bill-items-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    background: white;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bill-items {
    min-height: 200px;
}

.empty-cart-message {
    text-align: center;
    padding: 30px 0;
    color: #6c757d;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
    margin-bottom: 3px;
    font-size: 0.95em;
}

.cart-item-price {
    font-size: 0.9em;
    color: #6c757d;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    margin: 0 15px;
}

    .cart-item-actions .btn-circle {
        width: 30px;
        height: 30px;
        padding: 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cart-item-actions input {
        width: 50px;
        margin: 0 5px;
    }

.cart-item-total {
    font-weight: bold;
    min-width: 70px;
    text-align: left;
}

.bill-summary {
    background: white;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
}

    .summary-row.total {
        font-weight: bold;
        font-size: 1.1em;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
        margin-bottom: 0;
    }

#summary-discount-input {
    width: 100px;
    text-align: center;
}

.bill-actions {
    margin-top: auto;
}

    .bill-actions .btn {
        padding: 12px;
        font-size: 1.1em;
        font-weight: 500;
    }

    .bill-actions .d-flex {
        gap: 10px;
    }

/* === التصميم المتجاوب للأجهزة اللوحية === */
@media (max-width: 1024px) {
    .pos-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .pos-categories {
        flex: 0 0 auto;
        order: 1;
        height: auto;
        padding: 10px 0;
    }

    .pos-products {
        flex: 1;
        order: 2;
        min-height: 400px;
    }

    .pos-bill {
        flex: 0 0 auto;
        order: 3;
        height: auto;
        min-height: 400px;
        width: 100%;
    }

    .category-btn span {
        display: none;
    }

    .category-btn i {
        margin: 0;
        font-size: 1.2em;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .product-card {
        height: 160px;
        width: 100px;
    }

    .product-image {
        height: 80px;
        width: 80px;
    }

    .bill-actions .btn {
        padding: 15px;
        font-size: 1.2em;
    }

    .bill-actions .d-flex {
        flex-direction: row;
    }

    .bill-actions .mt-2 {
        margin-top: 10px !important;
    }
}

/* === تصميم خاص للشاشات الصغيرة === */
@media (max-width: 768px) {
    .pos-bill {
        min-height: 350px;
    }

    .pos-products {
        min-height: 300px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }

    .product-card {
        height: 150px;
        width: 90px;
    }

    .product-image {
        height: 70px;
        width: 70px;
    }

    .product-card-name {
        font-size: 0.8em;
    }

    .product-card-price {
        font-size: 0.9em;
    }

    .bill-actions .btn {
        padding: 12px;
        font-size: 1.1em;
    }
}

/* === تصميم خاص للشاشات الكبيرة === */
@media (min-width: 1400px) {
    .pos-bill {
        flex: 0 0 450px;
    }

    .pos-categories {
        flex: 0 0 200px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .product-card {
        height: 200px;
        width: 140px;
    }

    .product-image {
        height: 120px;
        width: 120px;
    }
}
