/* ========================================= */
/* استایل‌های مینیمال POS اصلی */
/* طراحی: تمیز، ساده و کاربردی */
/* ========================================= */

/* تنظیمات کلی و بازنویسی body */
#pos-app-container {
    display: flex;
    font-family: 'MyPOSCustomFont', 'iranyekanwebmedium_FaNum', 'Vazir', Tahoma, sans-serif !important;
    direction: rtl;
    gap: 25px;
    width: 98vw;
    max-width: 98vw;
    margin: 20px auto;
}

body:has(#pos-app-container) #primary,
body:has(#pos-app-container) #content,
body:has(#pos-app-container) .entry-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ========================================= */
/* پنل محصولات */
/* ========================================= */
.pos-products-panel {
    flex: 3;
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 12px;
    background: #fafafa;
}

/* فیلتر دسته‌بندی */
#pos-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

#pos-category-filter button {
    padding: 10px 20px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    color: #444;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s;
}

#pos-category-filter button:hover {
    background: #f5f5f5;
    border-color: #999;
}

#pos-category-filter button.active {
    background: #2c3e50;
    color: #ffffff;
    border-color: #2c3e50;
}

/* لیست محصولات */
#pos-product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.loading-text {
    text-align: center;
    padding: 40px;
    color: #777;
    font-size: 1.1em;
}

.product-item {
    border: 1px solid #e0e0e0;
    padding: 18px 15px;
    border-radius: 10px;
    cursor: pointer;
    background: #ffffff;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    transition: all 0.2s;
    position: relative;
}

.product-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #2c3e50;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 10px 10px 0 0;
}

.product-item:hover {
    border-color: #2c3e50;
    transform: translateY(-2px);
}

.product-item:hover::before {
    opacity: 1;
}

.product-item:active {
    transform: translateY(0);
}

.product-name {
    font-weight: 700;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 1em;
    line-height: 1.4;
}

.product-price {
    color: #27ae60;
    font-weight: 700;
    font-size: 1.05em;
}

.product-price-regular {
    color: #999;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.product-price-sale {
    font-weight: 700;
    color: #e74c3c;
    font-size: 1.1em;
}

/* ========================================= */
/* پنل سفارش */
/* ========================================= */
.pos-order-panel {
    flex: 1;
    border: 1px solid #e0e0e0;
    padding: 25px 20px;
    border-radius: 12px;
    background: #ffffff;
    min-width: 340px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
}

.pos-order-panel h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 700;
    color: #2c3e50;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

/* انتخابگر نوع سفارش */
#pos-order-types-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#pos-order-types-selector button {
    flex: 1;
    min-width: fit-content;
    padding: 10px 18px;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    color: #444;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95em;
}

#pos-order-types-selector button:hover {
    background: #ebebeb;
    border-color: #999;
}

#pos-order-types-selector button.active {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
}

/* آیتم‌های سفارش */
#pos-order-items {
    min-height: 200px;
    max-height: calc(100vh - 450px);
    overflow-y: auto;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    flex: 1;
}

#pos-order-items::-webkit-scrollbar {
    width: 6px;
}

#pos-order-items::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
}

#pos-order-items::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

#pos-order-items::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

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

.order-item-name {
    flex-grow: 1;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
}

.order-item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f8f8;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
}

.order-item-qty {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1em;
    min-width: 20px;
    text-align: center;
}

.quantity-btn {
    background: #2c3e50;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding: 0;
    transition: all 0.2s;
}

.quantity-btn:hover {
    background: #34495e;
    transform: scale(1.1);
}

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

.quantity-minus {
    background: #e74c3c;
}

.quantity-minus:hover {
    background: #c0392b;
}

.order-item-price {
    direction: ltr;
    text-align: right;
    white-space: nowrap;
    font-weight: 700;
    color: #27ae60;
    font-size: 0.95em;
}

/* خلاصه سفارش */
.pos-order-summary {
    padding-top: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 1.3em;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.summary-row span:first-child {
    color: #555;
}

#pos-total-price {
    color: #27ae60;
}

/* دکمه‌های پرداخت */
.pos-payment-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 15px;
}

.pos-payment-buttons button {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

#pos-submit-order-default {
    background: #27ae60;
    color: #ffffff;
}

#pos-submit-order-default:hover {
    background: #229954;
    transform: translateY(-2px);
}

#pos-submit-order-default:active {
    transform: translateY(0);
}

#pos-submit-order-cash {
    background: #ffffff;
    color: #f39c12;
    border: 2px solid #f39c12;
}

#pos-submit-order-cash:hover {
    background: #f39c12;
    color: #ffffff;
    transform: translateY(-2px);
}

#pos-submit-order-cash:active {
    transform: translateY(0);
}

.pos-payment-buttons button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================= */
/* گزارشات فروش */
/* ========================================= */
.wrap .category-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.wrap .category-summary-card {
    border: 1px solid #e0e0e0;
    border-right: 4px solid #2c3e50;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
}

.wrap .category-summary-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3e50;
}

.wrap .category-summary-stat {
    margin-bottom: 10px;
    font-size: 1em;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
}

.wrap .category-summary-card.total-card {
    background: #f8f9fa;
    border-right-color: #3498db;
}

.wrap #top-products-container > h2 {
    font-size: 1.8em;
    margin-bottom: 30px;
    color: #2c3e50;
}

.wrap .top-products-category-section {
    margin-bottom: 40px;
}

.wrap .top-products-category-title {
    font-size: 1.5em;
    font-weight: 700;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 12px;
    margin-bottom: 20px;
    color: #2c3e50;
}

.wrap .top-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.wrap .product-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    background: #ffffff;
    text-align: right;
    display: flex;
    flex-direction: column;
}

.wrap .product-card-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 700;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 12px;
    flex-grow: 1;
    color: #2c3e50;
}

.wrap .product-card-stat {
    margin-bottom: 8px;
    font-size: 0.95em;
    color: #555;
}

/* ========================================= */
/* رسپانسیو */
/* ========================================= */
@media (max-width: 1200px) {
    #pos-app-container {
        gap: 20px;
    }
    
    .pos-order-panel {
        min-width: 320px;
        max-width: 380px;
    }
}

@media (max-width: 960px) {
    #pos-app-container {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        padding: 10px;
        box-sizing: border-box;
        gap: 20px;
    }
    
    .pos-order-panel {
        margin-top: 0;
        min-width: unset;
        max-width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }
    
    #pos-product-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    #pos-order-items {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .pos-products-panel,
    .pos-order-panel {
        padding: 15px;
    }
    
    #pos-product-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .wrap .top-products-grid,
    .wrap .category-summary-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .pos-payment-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #pos-app-container {
        margin: 10px auto;
        padding: 5px;
    }
    
    .pos-products-panel {
        padding: 12px;
    }
    
    #pos-product-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .product-item {
        padding: 12px 10px;
    }
    
    .product-name {
        font-size: 0.9em;
    }
}

/* بهبود دسترسی */
*:focus-visible {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

button:focus-visible {
    outline-offset: 3px;
}