/* ستايل صفحة index — كان مدمجًا داخل templates/index.html وتم نقله هنا ليتخزّن في المتصفح ويسهل تعديله. */
* {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        html, body {
            width: 100%;
            max-width: 100%;
            overflow-x: hidden;
        }

        body {
            font-family: Arial, Tahoma, sans-serif;
            background: #fffdf8;
            color: #17132f;
            transition: background 0.3s, color 0.3s;
        }

        /* تنسيقات الوضع الداكن (Dark Mode) */
        body.dark-mode {
            background: #121212;
            color: #e0e0e0;
        }

        body.dark-mode header {
            background: #1e1e1e;
            box-shadow: 0 2px 10px rgba(0,0,0,.5);
        }

        body.dark-mode .product-card,
        body.dark-mode .search-box {
            background: #1e1e1e;
            color: #ffffff;
            border-color: #333;
        }

        body.dark-mode .category {
            background: #2a2a2a;
            color: #fff;
        }

        body.dark-mode .category.active {
            background: #ff6b25;
            color: white;
        }

        a {
            text-decoration: none;
            color: inherit;
        }

        /* ================= HEADER ================= */

        header {
            height: 70px;
            background: white;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 4%;
            box-shadow: 0 2px 10px rgba(0,0,0,.08);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .tb-brand-text {
            font-weight: 900;
            font-size: 18px;
            background: linear-gradient(90deg, #ef5da8, #65c9dc, #ffd94a);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .brand-copy small {
            display: block;
            font-size: 9px;
            color: #777;
        }

        .tb-brand-mark {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: linear-gradient(145deg, #ff6baa, #65c9dc 58%, #ffd94a);
            color: #fff;
            display: grid;
            place-items: center;
            font-weight: bold;
            font-size: 14px;
        }

        .header-buttons {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .circle-btn, .icon-btn {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            border: none;
            cursor: pointer;
            position: relative;
            background: #f0f0f0;
        }

        .facebook { background: #1877f2; color: white; }
        .whatsapp { background: #20d366; color: white; }
        .whatsapp svg { width: 23px; height: 23px; display: block; fill: currentColor; }

        .cart-btn {
            background: #d7f5eb;
            color: #073b35;
        }

        .track-btn {
            background: #e3f2fd;
            color: #0d47a1;
            font-size: 12px;
            font-weight: bold;
            padding: 0 10px;
            border-radius: 20px;
            height: 36px;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .admin-btn {
            background: #fff9cf;
            color: #4e3b00;
            font-size: 12px;
            font-weight: bold;
            padding: 0 10px;
            border-radius: 20px;
            height: 36px;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .cart-number {
            position: absolute;
            top: -3px;
            right: -3px;
            background: #ff6b25;
            color: white;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            font-size: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }

        /* ================= HERO ================= */

        .hero {
            padding: 25px 4%;
            background: linear-gradient(120deg, #ffb36b, #f59bc8, #a8b9ee, #2cd9df);
            text-align: center;
        }

        .hero-logo-image {
            max-width: 260px;
            width: 80%;
            height: auto;
            margin: 0 auto 10px;
            display: block;
        }

        .season {
            display: inline-block;
            background: rgba(255,255,255,.85);
            padding: 6px 15px;
            border-radius: 20px;
            font-size: 13px;
            font-weight: bold;
            margin-bottom: 12px;
        }

        .hero h1 {
            font-size: 24px;
            margin-bottom: 8px;
        }

        .hero p {
            font-size: 14px;
            line-height: 1.5;
            margin-bottom: 15px;
        }

        .features {
            display: flex;
            justify-content: center;
            gap: 8px 12px;
            flex-wrap: wrap;
            font-size: 12px;
            font-weight: bold;
        }

        /* ================= CATEGORIES ================= */

        .categories {
            padding: 15px 4%;
            display: flex;
            gap: 10px;
            overflow-x: auto;
            white-space: nowrap;
        }

        .category {
            background: #f7f0e2;
            border-radius: 20px;
            padding: 8px 16px;
            font-weight: bold;
            font-size: 13px;
            color: #17132f;
            flex: 0 0 auto;
        }

        .category.active {
            background: #ff6b25;
            color: white;
        }

        /* ================= PRODUCTS ================= */

        .section {
            padding: 25px 3%;
        }

        .section-title {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .section-title h2 {
            font-size: 22px;
        }

        .products-count {
            color: #687086;
            font-size: 14px;
        }

        /* [v5] مجموعات المنتجات في الصفحة الرئيسية: 28px بين كل مجموعة والتي بعدها، وكروت المجموعة متقاربة كما هي. */
        .tb-product-group + .tb-product-group { margin-top: 28px; }
        .tb-group-head {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 14px;
        }
        .tb-group-head h3 { font-size: 19px; margin: 0; }
        .tb-group-count { color: #687086; font-size: 13px; }

        /* شبكة المنتجات (تلقائياً منتجين جنب بعض للموبايل) */
        .products-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            grid-auto-flow: row;
            grid-auto-rows: max-content;
            align-items: start;
            gap: 10px;
        }

        @media (min-width: 768px) {
            .products-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 20px;
            }
        }

        @media (min-width: 1024px) {
            .products-grid {
                grid-template-columns: repeat(4, 1fr);
                gap: 22px;
            }
        }

        .product-card {
            background: white;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0,0,0,.08);
            border: 1px solid #eee;
            display: flex;
            flex-direction: column;
        }

        .product-image {
            height: auto;
            background: #f8f9fa;
            position: relative;
            display: block;
            overflow: hidden;
            line-height: 0;
        }

        .product-image img {
            width: 100%;
            height: auto;
            display: block;
            object-fit: contain;
            object-position: center;
        }

        .badge {
            position: absolute;
            top: 6px;
            right: 6px;
            background: #ff4747;
            color: white;
            padding: 3px 7px;
            border-radius: 12px;
            font-weight: bold;
            font-size: 10px;
        }

        .sold-out-badge {
            position: absolute;
            bottom: 6px;
            right: 6px;
            background: #555;
            color: white;
            padding: 4px 8px;
            border-radius: 12px;
            font-weight: bold;
            font-size: 10px;
        }

        .category-badge {
            position: absolute;
            top: 6px;
            left: 6px;
            background: #ff80b5;
            color: #17132f;
            padding: 3px 7px;
            border-radius: 12px;
            font-weight: bold;
            font-size: 10px;
        }

        .offer-badge {
            position: absolute;
            top: 32px;
            left: 6px;
            background: #ff6b25;
            color: #fff;
            padding: 3px 7px;
            border-radius: 12px;
            font-weight: bold;
            font-size: 10px;
        }

        .product-info {
            padding: 10px 8px;
            display: flex;
            flex-direction: column;
            flex-grow: 1;
        }

        .product-name {
            font-size: 14px;
            font-weight: bold;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .rating {
            color: #ffae00;
            margin-bottom: 4px;
            font-size: 11px;
        }

        .rating span {
            color: #666;
            font-size: 10px;
        }
        .rating-trigger {
            border: 0;
            background: transparent;
            padding: 0;
            text-align: right;
            cursor: pointer;
            width: fit-content;
        }
        .rating-trigger:hover { transform: scale(1.03); }
        .rating-modal-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9999;
            display: none; align-items: center; justify-content: center; padding: 16px;
        }
        .rating-modal-overlay.show { display: flex; }
        .rating-modal { background: #fff; border-radius: 18px; padding: 18px 16px; width: min(330px, 92vw); text-align: center; box-shadow: 0 15px 40px rgba(0,0,0,.2); }
        .rating-modal h3 { margin: 0 0 6px; }
        .rating-stars { display:flex; justify-content:center; gap:4px; direction:ltr; margin:10px 0 8px; }
        .rating-stars button { border:0; background:transparent; font-size:32px; color:#ddd; cursor:pointer; padding:2px; }
        .rating-stars button.active, .rating-stars button:hover { color:#ffae00; }
        .rating-close { border:0; background:#f1f1f1; border-radius:10px; padding:7px 14px; cursor:pointer; }
        .rating-message { min-height:20px; font-size:12px; font-weight:700; margin-bottom:8px; }


        .price {
            color: #ff6b25;
            font-size: 15px;
            font-weight: bold;
            margin: 4px 0 8px;
        }

        .old-price {
            color: #999;
            text-decoration: line-through;
            font-size: 11px;
            margin-right: 4px;
        }

        /* ================= FOOTER ================= */

        footer {
            background: #17132f;
            color: white;
            text-align: center;
            padding: 30px 15px;
            margin-top: 40px;
        }
    

        /* ================= GIFT POPUP ================= */
@keyframes giftBounce {
            0%,100% { transform: translateY(0) rotate(0); }
            10% { transform: translateY(-7px) rotate(-5deg); }
            20% { transform: translateY(0) rotate(5deg); }
            30% { transform: translateY(-4px) rotate(-3deg); }
            40% { transform: translateY(0) rotate(0); }
        }
        .gift-overlay {
            position: fixed; inset: 0; background: rgba(20,15,30,.58);
            display: none; align-items: center; justify-content: center; padding: 18px; z-index: 9999;
        }
        .gift-overlay.show { display: flex; }
        .gift-modal {
            width: min(430px, 100%); background: white; border-radius: 26px; padding: 28px 22px; text-align: center;
            box-shadow: 0 20px 60px rgba(0,0,0,.25); position: relative;
        }
        .gift-modal h2 { font-size: 25px; margin-bottom: 9px; }
        .gift-modal p { color: #666; line-height: 1.8; margin-bottom: 15px; }
        .gift-phone { width: 100%; padding: 14px; border: 2px solid #eee; border-radius: 15px; font-size: 17px; text-align: center; outline: none; }
        .gift-phone:focus { border-color: #ff6b25; }
        .gift-submit { width: 100%; margin-top: 12px; padding: 14px; border: 0; border-radius: 15px; background: #ff6b25; color: white; font-weight: 900; font-size: 16px; cursor: pointer; }
        .gift-close { position:absolute; top:10px; left:12px; border:0; background:#f4f1ed; width:34px; height:34px; border-radius:50%; cursor:pointer; font-size:20px; }
        .gift-code { margin: 18px 0 10px; padding: 16px; border: 2px dashed #ff6b25; border-radius: 18px; background: #fff7f1; font-size: 27px; font-weight: 900; letter-spacing: 2px; color: #ff6b25; direction:ltr; }
        .gift-note { font-size: 13px; color:#777; }
        .gift-error { color:#c62828; font-weight:bold; min-height:24px; margin-top:10px; }

    
        .notification-prompt-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:none;align-items:center;justify-content:center;padding:20px;z-index:10000;backdrop-filter:blur(4px)}
        .notification-prompt-overlay.show{display:flex}
        .notification-prompt{position:relative;width:min(430px,100%);background:#fff;border-radius:28px;padding:30px 24px;text-align:center;box-shadow:0 18px 55px rgba(0,0,0,.22);border:1px solid #f1eee8}
        .notification-prompt-close{position:absolute;top:10px;left:12px;width:34px;height:34px;border:0;border-radius:50%;background:#f4f1ec;color:#777;font-size:24px;cursor:pointer}
        .notification-bell{width:70px;height:70px;border-radius:22px;background:linear-gradient(135deg,#fff3d7,#ffe3ec);display:grid;place-items:center;font-size:36px;margin:0 auto 14px;animation:tbBell 1.8s ease-in-out infinite}
        .notification-prompt h3{font-size:24px;margin-bottom:10px;color:#17132f}
        .notification-prompt p{color:#666;line-height:1.8;font-size:14px;margin-bottom:20px}
        .notification-prompt-actions{display:grid;gap:10px}
        .notification-allow{border:0;border-radius:17px;padding:14px;background:#17132f;color:#fff;font-weight:900;font-size:15px;cursor:pointer}
        .notification-deny{border:0;background:#f5f3ef;color:#555;border-radius:17px;padding:12px;font-weight:800;cursor:pointer}
        @keyframes tbBell{0%,100%{transform:rotate(0)}20%{transform:rotate(-8deg)}40%{transform:rotate(8deg)}60%{transform:rotate(-5deg)}80%{transform:rotate(0)}}
        body.dark-mode .notification-prompt{background:#1e1e1e;color:#fff;border-color:#333}
        body.dark-mode .notification-prompt h3{color:#fff}
        body.dark-mode .notification-prompt p{color:#bbb}
        body.dark-mode .notification-deny,.dark-mode .notification-prompt-close{background:#2a2a2a;color:#ddd}
