/* =========================
   إعدادات عامة
========================= */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:"Cairo",sans-serif;
}

:root{
    --primary:#ff6500;
    --primary-dark:#db5700;
    --success:#1fae58;
    --danger:#dc3545;

    --background:#f3f4f6;
    --surface:#ffffff;
    --soft:#fafafa;

    --text:#222222;
    --muted:#777777;
    --border:#e4e6ea;

    --shadow:0 8px 25px rgba(0,0,0,.08);
}

html{
    scroll-behavior:smooth;
}

body{
    min-height:100vh;
    background:var(--background);
    color:var(--text);
}

/* =========================
   الهيدر
========================= */

.header{
    position:sticky;
    top:0;
    z-index:1000;

    display:flex;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;

    gap:14px;

    min-height:92px;
    padding:14px 3%;

    background:#fff;
    border-bottom:1px solid var(--border);

    box-shadow:0 4px 18px rgba(0,0,0,.06);
}

.brand{
    display:flex;
    align-items:center;
    gap:14px;
}

.brand img{
    width:62px;
    height:62px;

    object-fit:cover;
    border-radius:50%;

    border:3px solid #fff;
    box-shadow:0 4px 15px rgba(0,0,0,.15);
}

.brand h1{
    color:var(--primary);
    font-size:27px;
    line-height:1.2;
}

.brand p{
    color:var(--muted);
    font-size:13px;
    margin-top:4px;
}

.header-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    flex-wrap:wrap;

    gap:9px;
}

.current-time{
    min-width:86px;
    padding:10px 13px;

    background:#f3f3f3;
    border-radius:10px;

    text-align:center;
    font-weight:800;
}

.header-actions button{
    border:none;

    padding:11px 15px;

    border-radius:10px;

    color:white;

    cursor:pointer;

    font-size:13px;
    font-weight:800;

    white-space:nowrap;

    transition:.2s;
}

.report-btn{
    background:#222;
}

.report-btn:hover{
    background:#000;
}

.close-day-btn{
    background:var(--danger);
}

.close-day-btn:hover{
    background:#b92936;
}

.new-order-btn{
    background:var(--primary);
}

.new-order-btn:hover{
    background:var(--primary-dark);
}

/* =========================
   التخطيط
========================= */

.cashier-layout{
    width:min(1500px,96%);
    margin:22px auto;

    display:grid;

    grid-template-columns:
        minmax(0,1.55fr)
        minmax(350px,.72fr);

    gap:22px;

    align-items:start;
}

/* =========================
   لوحة المنيو
========================= */

.menu-panel{
    min-width:0;

    padding:22px;

    background:var(--surface);
    border-radius:20px;

    box-shadow:var(--shadow);
}

.panel-heading{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:20px;
    margin-bottom:18px;
}

.panel-heading h2{
    font-size:27px;
}

.panel-heading p{
    margin-top:4px;
    color:var(--muted);
    font-size:13px;
}

#search-input{
    width:min(330px,100%);

    padding:13px 16px;

    border:1px solid var(--border);
    border-radius:12px;

    background:var(--soft);

    outline:none;

    font-size:15px;

    transition:.2s;
}

#search-input:focus{
    background:white;
    border-color:var(--primary);

    box-shadow:0 0 0 3px rgba(255,101,0,.12);
}

/* =========================
   الفئات
========================= */

.categories{
    display:flex;
    gap:10px;

    overflow-x:auto;

    padding:4px 0 15px;
}

.category-btn{
    flex:0 0 auto;

    border:1px solid var(--border);

    padding:10px 18px;

    border-radius:999px;

    background:white;
    color:var(--text);

    cursor:pointer;

    font-weight:700;

    transition:.2s;
}

.category-btn:hover,
.category-btn.active{
    background:var(--primary);
    border-color:var(--primary);
    color:white;
}

/* =========================
   المنتجات
========================= */

.products-grid{
    display:grid;

    grid-template-columns:
        repeat(auto-fill,minmax(175px,1fr));

    gap:14px;
}

.product-card{
    overflow:hidden;

    display:flex;
    flex-direction:column;

    min-height:235px;

    background:#fff;

    border:1px solid var(--border);
    border-radius:16px;

    box-shadow:0 5px 15px rgba(0,0,0,.05);

    transition:.2s;
}

.product-card:hover{
    transform:translateY(-4px);

    box-shadow:0 10px 22px rgba(0,0,0,.1);

    border-color:rgba(255,101,0,.35);
}

.product-logo{
    height:74px;

    display:flex;
    align-items:center;
    justify-content:center;

    background:#fff5ed;
}

.product-logo img{
    width:58px;
    height:58px;

    object-fit:cover;
    border-radius:50%;
}

.product-content{
    flex:1;

    display:flex;
    flex-direction:column;

    padding:13px;
}

.product-content h3{
    font-size:15px;
    margin-bottom:5px;
}

.product-content p{
    min-height:38px;
    margin-bottom:9px;

    color:var(--muted);

    font-size:11px;
    line-height:1.65;
}

.product-price{
    margin-top:auto;
    margin-bottom:10px;

    color:var(--primary);

    font-size:17px;
    font-weight:800;
}

.add-btn{
    width:100%;

    border:none;

    padding:10px;

    border-radius:10px;

    background:var(--primary);
    color:white;

    cursor:pointer;

    font-size:13px;
    font-weight:800;

    transition:.2s;
}

.add-btn:hover{
    background:var(--primary-dark);
}

.no-products{
    grid-column:1/-1;

    padding:50px 20px;

    text-align:center;

    color:var(--muted);

    background:var(--soft);

    border:1px dashed var(--border);
    border-radius:14px;
}

/* =========================
   لوحة الطلب
========================= */

.order-panel{
    position:sticky;
    top:112px;

    overflow:hidden;

    background:#fff;
    border-radius:20px;

    box-shadow:var(--shadow);
}

.order-header{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:15px;

    min-height:85px;
    padding:18px;

    background:var(--primary);
    color:#fff;
}

.order-header h2{
    font-size:21px;
}

.order-header p{
    margin-top:5px;
    font-size:12px;
    opacity:.9;
}

#order-count{
    min-width:43px;
    height:43px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:50%;

    background:#fff;
    color:var(--primary);

    font-size:17px;
    font-weight:800;
}

/* =========================
   بيانات العميل
========================= */

.customer-details{
    padding:18px;
    border-bottom:1px solid var(--border);
}

.customer-details h3{
    font-size:17px;
    margin-bottom:13px;
}

.form-row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
}

.form-group{
    margin-bottom:11px;
}

.form-group label{
    display:block;

    margin-bottom:6px;

    font-size:12px;
    font-weight:700;
}

.required{
    color:var(--danger);
}

.optional{
    margin-right:4px;

    color:var(--muted);

    font-size:10px;
    font-weight:400;
}

.form-group input,
.form-group textarea{
    width:100%;

    padding:11px 12px;

    border:1px solid var(--border);
    border-radius:10px;

    background:var(--soft);

    outline:none;

    font-size:13px;

    transition:.2s;
}

.form-group input:focus,
.form-group textarea:focus{
    background:#fff;
    border-color:var(--primary);

    box-shadow:0 0 0 3px rgba(255,101,0,.1);
}

.form-group textarea{
    min-height:70px;
    resize:vertical;
}

/* =========================
   عناصر الطلب
========================= */

.order-items{
    max-height:310px;

    overflow-y:auto;

    padding:7px 18px;
}

.empty-order{
    padding:34px 10px;

    text-align:center;
    color:var(--muted);
}

.order-item{
    display:grid;

    grid-template-columns:minmax(0,1fr) auto;

    align-items:center;

    gap:10px;

    padding:13px 0;

    border-bottom:1px solid var(--border);
}

.order-item:last-child{
    border-bottom:none;
}

.order-item-info h4{
    font-size:14px;
}

.order-item-info p{
    margin-top:4px;

    color:var(--primary);

    font-size:13px;
    font-weight:800;
}

.item-controls{
    display:flex;
    align-items:center;
    gap:6px;
}

.item-controls button{
    width:30px;
    height:30px;

    border:none;
    border-radius:8px;

    cursor:pointer;

    font-weight:800;
}

.quantity-btn{
    background:#fff0e5;
    color:var(--primary);
}

.remove-item-btn{
    background:#ffe8ea;
    color:var(--danger);
}

.item-controls span{
    min-width:22px;

    text-align:center;
    font-weight:800;
}

/* =========================
   ملخص الطلب
========================= */

.order-summary{
    padding:15px 18px;

    background:var(--soft);

    border-top:1px solid var(--border);
    border-bottom:1px solid var(--border);
}

.summary-row{
    display:flex;
    align-items:center;
    justify-content:space-between;

    margin-bottom:7px;
}

.total-row{
    padding-top:9px;
    margin-top:8px;

    border-top:1px solid var(--border);
}

.total-row span{
    font-size:18px;
    font-weight:800;
}

.total-row strong{
    color:var(--primary);
    font-size:22px;
}

/* =========================
   أزرار الطلب
========================= */

.order-actions{
    display:grid;
    gap:10px;

    padding:18px;
}

.order-actions button{
    border:none;

    padding:13px;

    border-radius:11px;

    cursor:pointer;

    font-size:14px;
    font-weight:800;

    transition:.2s;
}

.invoice-btn{
    background:var(--success);
    color:white;
}

.clear-btn{
    background:#fff0f1;
    color:var(--danger);
}

/* =========================
   الفاتورة
========================= */

.invoice-overlay{
    position:fixed;
    inset:0;

    z-index:5000;

    display:flex;
    align-items:center;
    justify-content:center;

    padding:20px;

    background:rgba(0,0,0,.65);

    opacity:0;
    visibility:hidden;

    transition:.25s;
}

.invoice-overlay.active{
    opacity:1;
    visibility:visible;
}

.invoice-modal{
    width:min(480px,100%);
    max-height:95vh;

    overflow-y:auto;

    background:white;
    border-radius:17px;

    box-shadow:0 20px 60px rgba(0,0,0,.3);
}

.invoice-toolbar{
    position:sticky;
    top:0;
    z-index:5;

    display:grid;
      grid-template-columns:1fr 1fr;

    gap:8px;

    padding:11px;

    background:#f1f2f4;
}

.invoice-toolbar button{
    border:none;

    padding:10px 5px;

    border-radius:8px;

    cursor:pointer;
    font-weight:700;
}

.close-invoice-btn{
    background:#ddd;
}

.print-invoice-btn{
    background:var(--primary);
    color:white;
}

.finish-order-btn{
    background:var(--success);
    color:white;
}

.invoice-content{
    padding:26px 23px;
}

.receipt{
    color:#111;
}

.receipt-header{
    padding-bottom:15px;

    text-align:center;

    border-bottom:1px dashed #777;
}

.receipt-header img{
    width:65px;
    height:65px;

    object-fit:cover;
    border-radius:50%;

    margin-bottom:7px;
}

.receipt-section{
    padding:13px 0;

    border-bottom:1px dashed #777;

    font-size:12px;
    line-height:1.9;
}

.receipt-item{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;

    gap:10px;
    padding:7px 0;
}

.receipt-total{
    display:flex;
    justify-content:space-between;

    padding:17px 0 8px;

    font-size:19px;
    font-weight:800;
}

.receipt-footer{
    padding-top:15px;

    text-align:center;
    font-size:12px;
}

/* =========================
   الإشعار
========================= */

.toast{
    position:fixed;

    left:50%;
    bottom:25px;

    z-index:9000;

    max-width:90%;

    padding:13px 20px;

    background:#222;
    color:white;

    border-radius:11px;

    text-align:center;

    font-size:13px;
    font-weight:700;

    opacity:0;
    visibility:hidden;

    transform:
        translateX(-50%)
        translateY(80px);

    transition:.3s;
}

.toast.show{
    opacity:1;
    visibility:visible;

    transform:
        translateX(-50%)
        translateY(0);
}

/* =========================
   التابلت
========================= */

@media(max-width:1000px){

    .cashier-layout{
        grid-template-columns:
            minmax(0,1.2fr)
            minmax(320px,.8fr);
    }

    .products-grid{
        grid-template-columns:
            repeat(auto-fill,minmax(155px,1fr));
    }
}

/* =========================
   شاشات متوسطة
========================= */

@media(max-width:800px){

    .header{
        position:static;
    }

    .header-actions{
        width:100%;
        justify-content:center;
    }

    .header-actions button{
        flex:1 1 140px;
    }

    .cashier-layout{
        grid-template-columns:1fr;
    }

    .order-panel{
        position:static;
    }

    .products-grid{
        grid-template-columns:
            repeat(3,minmax(0,1fr));
    }
}

/* =========================
   الجوال
========================= */

@media(max-width:600px){

    .header{
        flex-direction:column;
        align-items:stretch;

        padding:11px;
    }

    .brand{
        justify-content:center;
    }

    .brand img{
        width:50px;
        height:50px;
    }

    .brand h1{
        font-size:20px;
    }

    .brand p{
        display:none;
    }

    .header-actions{
        width:100%;

        display:grid;

        grid-template-columns:
            repeat(2,minmax(0,1fr));
    }

    .current-time{
        grid-column:1/-1;
        width:100%;
    }

    .header-actions button{
        width:100%;
        padding:10px 6px;
        font-size:11px;
    }

    .cashier-layout{
        width:100%;
        margin:10px 0;
        gap:10px;
    }

    .menu-panel,
    .order-panel{
        border-radius:0;
    }

    .menu-panel{
        padding:13px 9px;
    }

    .panel-heading{
        flex-direction:column;
        align-items:stretch;
        gap:11px;
    }

    #search-input{
        width:100%;
    }

    .products-grid{
        grid-template-columns:
            repeat(2,minmax(0,1fr));

        gap:9px;
    }

    .product-card{
        min-height:225px;
    }

    .product-content{
        padding:10px;
    }

    .product-content h3{
        font-size:13px;
    }

    .product-content p{
        min-height:33px;
        font-size:10px;
    }

    .product-price{
        font-size:15px;
    }

    .form-row{
        grid-template-columns:1fr;
        gap:0;
    }

    .invoice-overlay{
        align-items:flex-end;
        padding:0;
    }

    .invoice-modal{
        width:100%;
        max-height:97vh;

        border-radius:18px 18px 0 0;
    }
}

/* =========================
   الطباعة
========================= */

@media print{

    body *{
        visibility:hidden;
    }

    #invoice-content,
    #invoice-content *{
        visibility:visible;
    }

    #invoice-content{
        position:absolute;
        top:0;
        right:0;

        width:80mm;

        padding:6mm;
        margin:0;

        background:white;
    }

    .no-print{
        display:none !important;
    }

    @page{
        size:80mm auto;
        margin:0;
    }
}
.print-finish-btn{
    background:var(--success);
    color:white;
}

.print-finish-btn:hover{
    filter:brightness(.92);
}
/* ========================================
   نافذة تخصيص الحمص
======================================== */

.customize-overlay{
    position:fixed;
    inset:0;

    z-index:6000;

    display:flex;
    align-items:center;
    justify-content:center;

    padding:20px;

    background:rgba(0,0,0,.65);

    opacity:0;
    visibility:hidden;

    transition:.25s;
}

.customize-overlay.active{
    opacity:1;
    visibility:visible;
}

.customize-modal{
    width:min(620px,100%);
    max-height:92vh;

    overflow-y:auto;

    background:#fff;

    border-radius:20px;

    box-shadow:0 24px 70px rgba(0,0,0,.30);
}

/* رأس النافذة */

.customize-header{
    position:sticky;
    top:0;
    z-index:3;

    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:15px;

    padding:18px 20px;

    background:#ff6500;
    color:#fff;

    border-radius:20px 20px 0 0;
}

.customize-header h2{
    font-size:22px;
}

.customize-header p{
    margin-top:3px;

    font-size:13px;

    opacity:.9;
}

#close-customize-btn{
    width:40px;
    height:40px;

    border:none;
    border-radius:50%;

    background:#fff;
    color:#ff6500;

    cursor:pointer;

    font-size:18px;
    font-weight:800;
}

/* أقسام النافذة */

.customize-section{
    padding:20px;

    border-bottom:1px solid #e4e6ea;
}

.customize-section h3{
    margin-bottom:14px;

    font-size:18px;
}

/* خيارات عدد الأشخاص */

.people-options{
    display:grid;

    grid-template-columns:
        repeat(2,minmax(0,1fr));

    gap:10px;
}

.person-option{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:12px;

    width:100%;

    padding:13px 14px;

    border:1px solid #e4e6ea;
    border-radius:12px;

    background:#fafafa;
    color:#222;

    cursor:pointer;

    text-align:right;

    transition:.2s;
}

.person-option span{
    font-size:14px;
    font-weight:700;
}

.person-option strong{
    color:#ff6500;

    font-size:14px;

    white-space:nowrap;
}

.person-option:hover{
    border-color:#ff6500;

    background:#fff7f0;
}

.person-option.active{
    border-color:#ff6500;

    background:#ff6500;
    color:#fff;

    box-shadow:0 6px 16px rgba(255,101,0,.20);
}

.person-option.active strong{
    color:#fff;
}

/* قسم الخبز */

.bread-heading{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:20px;
}

.bread-heading h3{
    margin-bottom:4px;
}

.bread-heading p{
    color:#777;

    font-size:12px;
}

.bread-counter{
    display:flex;
    align-items:center;

    gap:12px;
}

.bread-counter button{
    width:38px;
    height:38px;

    border:none;
    border-radius:10px;

    background:#ff6500;
    color:#fff;

    cursor:pointer;

    font-size:20px;
    font-weight:800;
}

.bread-counter button:hover{
    background:#db5700;
}

#bread-count{
    min-width:32px;

    text-align:center;

    font-size:20px;
}

/* الإجمالي */

.customize-total{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:20px;

    padding:18px 20px;

    background:#fff7f0;

    border-top:1px solid #ffe1ca;
    border-bottom:1px solid #ffe1ca;
}

.customize-total span{
    font-size:18px;
    font-weight:800;
}

.customize-total strong{
    color:#ff6500;

    font-size:23px;
}

/* أزرار النافذة */

.customize-actions{
    display:grid;

    grid-template-columns:1fr 1fr;

    gap:10px;

    padding:18px 20px;
}

.customize-actions button{
    border:none;

    padding:13px;

    border-radius:11px;

    cursor:pointer;

    font-size:15px;
    font-weight:800;

    transition:.2s;
}

.cancel-customize-btn{
    background:#f1f2f4;
    color:#333;
}

.cancel-customize-btn:hover{
    background:#dedfe2;
}

.confirm-customize-btn{
    background:#1fae58;
    color:#fff;
}

.confirm-customize-btn:hover{
    filter:brightness(.92);
}

/* ========================================
   التابلت
======================================== */

@media(max-width:700px){

    .customize-overlay{
        padding:12px;
    }

    .customize-modal{
        max-height:95vh;
    }

    .people-options{
        grid-template-columns:1fr;
    }

}

/* ========================================
   الجوال
======================================== */

@media(max-width:500px){

    .customize-overlay{
        align-items:flex-end;

        padding:0;
    }

    .customize-modal{
        width:100%;
        max-height:96vh;

        border-radius:20px 20px 0 0;
    }

    .customize-header{
        border-radius:20px 20px 0 0;
    }

    .customize-section{
        padding:16px;
    }

    .person-option{
        padding:12px;
    }

    .bread-heading{
        align-items:flex-start;
        flex-direction:column;
    }

    .bread-counter{
        width:100%;

        justify-content:center;
    }

    .customize-total{
        padding:16px;
    }

    .customize-actions{
        padding:16px;
    }

}
.order-item-info small{
    display:block;
    margin-top:3px;
    color:#777;
    font-size:11px;
}
