@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&family=Cairo:wght@400;600;700&display=swap');

:root {
    --primary: #00e676;
    --primary-hover: #00c853;
    --primary-dim: rgba(0, 230, 118, 0.1);
    --bg-dark: #050505;
    --surface: #121212;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --border-light: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(20, 20, 20, 0.6);
    --radius-lg: 16px;
    --radius-md: 10px;
    --danger: #ff4757;
    --max-width: 1200px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }

body {
    margin: 0;
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    direction: rtl;
    padding-top: 80px;
    min-height: 100vh;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* === إخفاء أزرار الأرقام (Spinners) === */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}
/* =================================== */

.hidden { display: none !important; }
.mt-20 { margin-top: 20px; }

/* === App Bar === */
.app-bar {
    position: fixed; top: 0; left: 0; width: 100%; height: 70px;
    background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; z-index: 1000; border-bottom: 1px solid var(--border-light);
}

.logo { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.8rem; color: var(--primary); letter-spacing: 1px; }
.page-title { font-size: 1.1rem; font-weight: 600; color: var(--text-main); }

.cart-btn-wrapper { position: relative; font-size: 1.6rem; cursor: pointer; transition: transform 0.2s; padding: 5px; }
.cart-btn-wrapper:active { transform: scale(0.9); }
.cart-bounce { animation: bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes bounce { 0% { transform: scale(1); } 50% { transform: scale(1.3); color: var(--primary); } 100% { transform: scale(1); } }

#cart-badge {
    position: absolute; top: 0; right: -5px; background: var(--primary); color: #000;
    font-size: 0.75rem; font-weight: bold; width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 0 10px var(--primary-dim);
}

/* === Layout & Grid === */
#main-container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 20px 40px; }

.page-section { 
    animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideInUp { 
    from { opacity: 0; transform: translateY(30px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.grid-responsive {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px;
}
@media (min-width: 600px) { .grid-responsive { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 992px) { .grid-responsive { grid-template-columns: repeat(4, 1fr); gap: 25px; } }

/* === Cards === */
.item-card {
    background: var(--surface); border-radius: var(--radius-lg); overflow: hidden;
    position: relative; border: 1px solid var(--border-light); cursor: pointer;
    aspect-ratio: 3 / 4; display: flex; flex-direction: column; transition: all 0.3s ease;
}
.item-card:hover { border-color: var(--primary); transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.item-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.item-card:hover .item-img { transform: scale(1.05); }

.item-info {
    position: absolute; bottom: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 20%, transparent);
    padding: 40px 15px 15px; text-align: right;
}
.item-title { font-weight: bold; font-size: 1rem; margin-bottom: 5px; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.item-price { color: var(--primary); font-family: 'Cairo'; font-weight: 700; font-size: 1.1rem; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }

/* === Product Details Page === */
.detail-layout { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 900px) {
    .detail-layout { flex-direction: row; align-items: flex-start; gap: 40px; }
    .detail-gallery, .detail-content { flex: 1; }
}

.glass-panel {
    background: var(--surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); padding: 20px;
}

.back-nav {
    background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border-light);
    padding: 10px 20px; border-radius: 30px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.9rem; margin-bottom: 20px; transition: 0.3s;
}
.back-nav:hover { background: var(--primary); color: #000; border-color: var(--primary); }

.detail-gallery { padding: 0; overflow: hidden; background: #000; display: flex; flex-direction: column; }
#detail-main-img { width: 100%; height: auto; aspect-ratio: 1/1; object-fit: contain; display: block; }
.thumbnails-row { display: flex; gap: 10px; overflow-x: auto; padding: 15px; background: rgba(255,255,255,0.03); }
.thumb { width: 60px; height: 60px; border-radius: 8px; border: 2px solid transparent; opacity: 0.6; cursor: pointer; transition: 0.2s; object-fit: cover; }
.thumb.selected { border-color: var(--primary); opacity: 1; transform: scale(1.05); }

.detail-content h2 { font-size: 1.8rem; margin: 0 0 10px 0; }
.price-tag { font-size: 2rem; color: var(--primary); font-family: 'Cairo'; font-weight: 700; }
.divider { height: 1px; background: var(--border-light); margin: 20px 0; }

.selector-area { margin-bottom: 20px; }
.selector-area label { display: block; margin-bottom: 12px; font-weight: bold; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.options-row { display: flex; flex-wrap: wrap; gap: 10px; }
.option-chip {
    padding: 10px 20px; border: 1px solid var(--border-light); border-radius: 8px;
    background: rgba(255,255,255,0.03); cursor: pointer; transition: 0.2s; font-size: 0.95rem;
}
.option-chip:hover { border-color: #fff; background: rgba(255,255,255,0.08); }
.option-chip.selected { background: var(--primary); color: #000; border-color: var(--primary); font-weight: bold; }

.main-btn {
    width: 100%; padding: 15px; background: var(--primary); border: none; border-radius: 12px;
    color: #000; font-weight: 800; font-size: 1.1rem; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px;
    transition: 0.3s; box-shadow: 0 4px 15px rgba(0, 230, 118, 0.2);
}
.main-btn:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 230, 118, 0.3); }
.main-btn:active { transform: scale(0.98); }

/* === Checkout Forms === */
.checkout-container { padding: 0; overflow: hidden; }
.checkout-tabs { display: flex; border-bottom: 1px solid var(--border-light); }
.tab { flex: 1; text-align: center; padding: 15px; cursor: pointer; color: var(--text-muted); background: rgba(0,0,0,0.2); transition: 0.3s; }
.tab.active { color: var(--primary); font-weight: bold; background: transparent; border-bottom: 2px solid var(--primary); }

#checkout-items-view, #checkout-details-view { padding: 20px; animation: fadeIn 0.4s; }
.items-list { margin-bottom: 20px; max-height: 400px; overflow-y: auto; }

.cart-summary-footer { border-top: 1px solid var(--border-light); padding-top: 20px; }
.summary-row { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: bold; margin-bottom: 15px; }

/* Forms Styling */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-muted); margin-right: 5px; }
.form-group input, .select-wrapper select {
    width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--border-light);
    padding: 12px 15px; border-radius: 10px; color: #fff; font-family: inherit; font-size: 1rem; transition: 0.3s;
    height: 48px;
}
.form-group input:focus, .select-wrapper select:focus { border-color: var(--primary); background: rgba(0,0,0,0.3); }
.disabled-input input { color: #777; border-style: dashed; cursor: not-allowed; }

.select-wrapper { position: relative; }
.select-wrapper::after {
    content: '\f107'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
select { appearance: none; -webkit-appearance: none; cursor: pointer; }

.text-error { color: var(--danger); font-size: 0.85rem; margin-top: 5px; }
.text-success { color: var(--primary); font-size: 0.85rem; margin-top: 5px; }

.final-receipt { background: #000; padding: 20px; border-radius: 10px; margin-bottom: 20px; }
.final-receipt .row { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--text-muted); font-size: 0.95rem; }
.final-receipt .total { border-top: 1px solid var(--border-light); padding-top: 10px; margin-top: 10px; font-size: 1.2rem; color: #fff; font-weight: bold; }
.final-receipt .total span:last-child { color: var(--primary); font-family: 'Cairo'; }

/* Invoice */
.invoice-card { text-align: center; max-width: 500px; margin: 0 auto; padding: 40px 20px; }
.success-icon-box {
    width: 80px; height: 80px; border-radius: 50%; background: rgba(0, 230, 118, 0.1); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 2.5rem; margin: 0 auto 20px;
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.2);
}
.invoice-details-box {
    background: rgba(255,255,255,0.03); border-radius: 15px; padding: 20px; margin: 30px 0; border: 1px solid var(--border-light);
}
.invoice-details-box label { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 5px; }
.invoice-code { font-family: 'Cairo'; font-weight: 800; font-size: 2rem; letter-spacing: 3px; color: #fff; }

/* Toast */
#toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 2000; pointer-events: none; width: 100%; display: flex; justify-content: center; }
.toast {
    background: rgba(20, 20, 20, 0.95); border-right: 4px solid var(--primary); color: #fff;
    padding: 12px 30px; border-radius: 5px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex; align-items: center; gap: 10px; font-weight: bold; transition: all 0.3s;
}

/* Background & Welcome */
#welcome-screen { position: fixed; inset: 0; background: #000; z-index: 5000; display: flex; justify-content: center; align-items: center; flex-direction: column; }
.welcome-content h1 { font-size: 3rem; letter-spacing: 5px; color: #fff; margin: 0; font-weight: 300; animation: fadeInUp 1s ease forwards; }
.welcome-content p { color: var(--primary); letter-spacing: 3px; margin-top: 15px; opacity: 0; animation: fadeInUp 1s 0.3s ease forwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-out { opacity: 0; visibility: hidden; transition: 0.8s; }

#dynamic-background { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.shape { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.02); animation: float linear infinite; }
@keyframes float { 0% { transform: translateY(110vh) scale(0.5); } 100% { transform: translateY(-20vh) scale(1.2); } }

/* Shared Invoice */
.customer-info-box { background: rgba(255,255,255,0.03); border: 1px dashed rgba(255,255,255,0.1); border-radius: 12px; padding: 20px; margin-bottom: 25px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.info-item { font-size: 0.9rem; color: #ccc; }
.info-item span:first-child { color: var(--primary); font-weight: bold; margin-left: 5px; }
.invoice-table-wrapper { overflow-x: auto; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1); }
.invoice-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.invoice-table th { background: rgba(0, 230, 118, 0.1); color: var(--primary); padding: 12px; text-align: right; font-size: 0.9rem; }
.invoice-table td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); color: #eee; font-size: 0.9rem; vertical-align: middle; }
.invoice-table tr:last-child td { border-bottom: none; }

/* Invoice Search Box */
.search-invoice-box { margin-bottom: 25px; padding: 15px; border-radius: 12px; border: 1px solid var(--border-light); background: rgba(255, 255, 255, 0.02); }
.search-input-wrapper { display: flex; gap: 10px; position: relative; }
.search-input-wrapper input { flex: 1; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-light); padding: 12px 15px; border-radius: 10px; color: #fff; font-family: 'Cairo', sans-serif; font-size: 1rem; transition: 0.3s; }
.search-input-wrapper input:focus { border-color: var(--primary); box-shadow: 0 0 10px var(--primary-dim); }
.search-input-wrapper button { background: var(--primary); color: #000; border: none; width: 50px; border-radius: 10px; cursor: pointer; font-size: 1.2rem; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.search-input-wrapper button:hover { background: var(--primary-hover); transform: translateY(-2px); }
.search-input-wrapper button:active { transform: scale(0.95); }
.hide-browse-btn .main-btn[href="index.html"] { display: none !important; }
.hide-browse-btn #invoice-back-btn { display: inline-flex !important; }

/* === NEW CART & COUPON STYLES === */
.cart-item {
    display: flex; gap: 15px; background: rgba(255,255,255,0.03); padding: 12px;
    border-radius: 12px; margin-bottom: 12px; align-items: center; border: 1px solid rgba(255,255,255,0.05);
}
.cart-details { flex: 1; }
.cart-thumb { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
.cart-name { font-weight: bold; font-size: 0.95rem; color: #fff; margin-bottom: 2px; }
.cart-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 2px; }
.cart-price { color: var(--primary); font-weight: bold; font-size: 0.9rem; }

/* Qty Controls */
.qty-controls {
    display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.3);
    padding: 5px; border-radius: 8px; border: 1px solid var(--border-light);
}
.qty-btn {
    width: 28px; height: 28px; border-radius: 6px; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-weight: bold;
    transition: 0.2s;
}
.qty-btn.minus { background: rgba(255,255,255,0.1); color: #fff; }
.qty-btn.plus { background: var(--primary); color: #000; }
.qty-btn:hover { transform: scale(1.1); }
.qty-display { font-weight: bold; min-width: 20px; text-align: center; font-size: 0.95rem; }

.cart-remove-btn {
    color: var(--danger); background: none; border: none; 
    padding: 8px; cursor: pointer; font-size: 1rem; opacity: 0.7; transition: 0.3s;
}
.cart-remove-btn:hover { opacity: 1; transform: scale(1.1); }

/* Promo Code Section */
.coupon-section {
    background: linear-gradient(145deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    padding: 20px; border-radius: 16px; border: 1px solid var(--border-light); margin-bottom: 25px;
    position: relative; overflow: hidden;
}
.coupon-section::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: var(--primary);
}
.coupon-section label {
    display: flex; align-items: center; gap: 8px; font-weight: bold; color: #fff; margin-bottom: 12px;
}
.coupon-input-group {
    display: flex; gap: 8px; position: relative;
}
.coupon-input-group input {
    flex: 1; background: rgba(0,0,0,0.4); border: 1px solid var(--border-light);
    border-radius: 10px; padding: 12px 15px 12px 45px; text-transform: uppercase;
    font-weight: bold; letter-spacing: 1px; color: var(--primary); transition: 0.3s;
}
.coupon-input-group input:focus { border-color: var(--primary); box-shadow: 0 0 15px var(--primary-dim); }
.coupon-input-group i.fa-ticket-alt {
    position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted);
}
.coupon-btn {
    background: var(--primary); color: #000; border: none; padding: 0 25px;
    border-radius: 10px; font-weight: bold; cursor: pointer; transition: 0.3s;
}
.coupon-btn:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 5px 15px var(--primary-dim); }

/* === Status Badges (New for Invoice) === */
.status-badge {
    padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: bold;
    display: inline-block; margin-top: 5px;
}
.status-pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-preparing { background: rgba(41, 121, 255, 0.15); color: #2979ff; border: 1px solid rgba(41, 121, 255, 0.3); }
.status-delivering { background: rgba(156, 39, 176, 0.15); color: #e040fb; border: 1px solid rgba(156, 39, 176, 0.3); }
.status-completed { background: rgba(0, 230, 118, 0.15); color: #00e676; border: 1px solid rgba(0, 230, 118, 0.3); }