/* ═══════════════════════════════════════════════════════════
   Standalone Store Page Styles (store.html)
   ═══════════════════════════════════════════════════════════ */

:root {
    --primary: #2D2D2D;
    --accent: #4F6F52;
    --accent-dark: #3A523E;
    --gold: #C0A062;
    --gold-dark: #A3864D;
    --bg: #F2F4F1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--primary);
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════
   Preloader
   ═══════════════════════════════════════════════════════════ */

.store-page-preloader {
    position: fixed; inset: 0; z-index: 99999;
    background: linear-gradient(145deg, #2D2D2D 0%, #1a1a1a 50%, #2D2D2D 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.7s ease;
}
.store-page-preloader.hide { opacity: 0; pointer-events: none; }

@keyframes sp-logo {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.08); opacity: 1; }
}
@keyframes sp-bar {
    0% { width: 0%; }
    100% { width: 100%; }
}
@keyframes sp-shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
.sp-logo { animation: sp-logo 2.4s ease-in-out infinite; filter: drop-shadow(0 0 30px rgba(79,111,82,0.4)); }
.sp-bar-fill {
    animation: sp-bar 2.2s ease-in-out forwards;
    background: linear-gradient(90deg, #4F6F52, #C0A062, #4F6F52);
    background-size: 200% 100%;
}
.sp-text {
    animation: sp-shimmer 3s linear infinite;
    background: linear-gradient(90deg, #999, #fff, #999);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Cairo', sans-serif;
}

/* ═══════════════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════════════ */

.store-page-header {
    background: linear-gradient(135deg, #2D2D2D 0%, #1F1F1F 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.store-page-header a { text-decoration: none; }

/* ═══════════════════════════════════════════════════════════
   Hero
   ═══════════════════════════════════════════════════════════ */

.store-hero {
    background: linear-gradient(135deg, #2D2D2D 0%, #1a1a1a 100%);
    position: relative; overflow: hidden;
}
.store-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(79,111,82,0.15) 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, rgba(192,160,98,0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   Product Cards
   ═══════════════════════════════════════════════════════════ */

.product-card {
    background: white;
    border-radius: 20px; overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
    border-color: rgba(79,111,82,0.2);
}
.product-card .img-wrap {
    height: 260px; overflow: hidden; position: relative;
    background: #F8F9FA;
}
.product-card .img-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.6s ease;
}
.product-card:hover .img-wrap img { transform: scale(1.1); }
.product-card .badge-new,
.product-card .badge-soldout {
    position: absolute; top: 12px; right: 12px; z-index: 5;
    color: white; font-size: 0.7rem; font-weight: 800;
    padding: 0.35rem 0.85rem; border-radius: 50px;
}
.product-card .badge-new {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    box-shadow: 0 4px 12px rgba(192,160,98,0.4);
}
.product-card .badge-soldout {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}
.product-card .img-wrap.sold-out {
    filter: grayscale(0.7);
}
.product-card .img-wrap.sold-out::after {
    content: '🚫 نفدت الكمية';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.45);
    color: white; font-size: 1.1rem; font-weight: 800;
    z-index: 3;
    backdrop-filter: blur(2px);
}
.product-card .card-body { padding: 1.5rem; }
.product-card .card-cat {
    font-size: 0.7rem; color: var(--accent); font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.4rem;
}
.product-card .card-title {
    font-size: 1.15rem; font-weight: 800; color: var(--primary);
    margin-bottom: 0.5rem; line-height: 1.3;
}
.product-card .card-desc {
    font-size: 0.85rem; color: #6B7280; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 1rem;
}
.product-card .card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 1rem; border-top: 1px solid rgba(0,0,0,0.06);
}
.product-card .card-price {
    font-size: 1.4rem; font-weight: 800; color: var(--gold);
}
.product-card .card-price-old {
    font-size: 0.85rem; color: #9CA3AF; text-decoration: line-through;
    font-weight: 400; margin-right: 0.5rem;
}
.product-card .card-actions {
    display: flex; gap: 0.5rem;
}
.product-card .card-actions button {
    width: 40px; height: 40px; border-radius: 12px; border: none;
    cursor: pointer; transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center;
}
.btn-view-detail {
    background: var(--accent); color: white;
}
.btn-view-detail:hover { background: var(--accent-dark); transform: scale(1.1); }
.btn-order-wa {
    background: #25D366; color: white;
}
.btn-order-wa:hover { background: #128C7E; transform: scale(1.1); }

/* ═══════════════════════════════════════════════════════════
   Filter Buttons
   ═══════════════════════════════════════════════════════════ */

.filter-btn {
    padding: 0.6rem 1.5rem; border-radius: 50px; border: 2px solid rgba(0,0,0,0.1);
    background: white; color: var(--primary); font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: all 0.3s ease;
}
.filter-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.filter-btn.active {
    background: var(--accent); border-color: var(--accent); color: white;
    box-shadow: 0 4px 15px rgba(79,111,82,0.3);
}

/* ═══════════════════════════════════════════════════════════
   Modal
   ═══════════════════════════════════════════════════════════ */

.store-modal-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0); backdrop-filter: blur(0px);
    display: none; align-items: center; justify-content: center;
    padding: 1rem; transition: all 0.4s ease;
}
.store-modal-overlay.show {
    display: flex; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px);
}
.store-modal-content {
    background: white; border-radius: 24px; max-width: 900px; width: 100%;
    overflow: hidden; box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    transform: scale(0.9) translateY(30px); opacity: 0;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.store-modal-overlay.show .store-modal-content {
    transform: scale(1) translateY(0); opacity: 1;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
}

.modal-close-btn {
    position: absolute; top: 1rem; left: 1rem; z-index: 20;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(10px);
    border: none; color: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease;
}
.modal-close-btn:hover { background: rgba(0,0,0,0.7); transform: rotate(90deg); }

.modal-img-wrap { height: 100%; min-height: 300px; overflow: hidden; position: relative; background: #E5E7EB; flex-shrink: 0; }
.modal-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.modal-img-overlay {
    position: absolute; bottom: 0; left: 0; right: 0; height: 40%;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

.modal-data-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 90vh;
}

.modal-body { padding: 2rem; overflow-y: auto; flex-grow: 1; }

.sticky-footer {
    padding: 1.5rem 2rem;
    background: white;
    border-top: 1px solid #E5E7EB;
    position: sticky;
    bottom: 0;
    z-index: 10;
}
.modal-cat {
    display: inline-block; padding: 0.35rem 1rem;
    background: rgba(79,111,82,0.1); color: var(--accent);
    font-size: 0.7rem; font-weight: 700; border-radius: 50px;
    margin-bottom: 0.75rem;
}
.modal-features { background: #F9FAFB; padding: 1.25rem; border-radius: 12px; }
.modal-features h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.modal-features .feat-item { display: flex; align-items: start; gap: 0.6rem; font-size: 0.85rem; color: #6B7280; margin-bottom: 0.5rem; }
.modal-features .feat-check {
    width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
    color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════ */

.store-footer {
    background: var(--primary); color: white;
    border-top: 3px solid var(--accent);
}
.store-footer a { color: #D1D5DB; text-decoration: none; transition: color 0.3s; }
.store-footer a:hover { color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   Back Home Button
   ═══════════════════════════════════════════════════════════ */

.back-home-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    color: #9CA3AF; font-weight: 600; font-size: 0.9rem;
    transition: color 0.3s ease;
}
.back-home-btn:hover { color: white; }

/* ═══════════════════════════════════════════════════════════
   WhatsApp Float
   ═══════════════════════════════════════════════════════════ */

.whatsapp-float {
    position: fixed; bottom: 24px; left: 24px; z-index: 9998;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 25px rgba(37,211,102,0.4);
    transition: all 0.3s ease;
    font-size: 1.5rem;
}
.whatsapp-float:hover { transform: scale(1.1); box-shadow: 0 12px 35px rgba(37,211,102,0.5); }

/* ═══════════════════════════════════════════════════════════
   Toast Notification
   ═══════════════════════════════════════════════════════════ */

.notification-toast {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-100px);
    z-index: 999999; padding: 0.8rem 2rem; border-radius: 12px;
    color: white; font-weight: 600; font-size: 0.9rem;
    transition: transform 0.5s ease; box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.notification-toast.show { transform: translateX(-50%) translateY(0); }

/* ═════════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═════════════════════════════════════════════════════════════════════════════ */

/* ── 768px ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .product-card .img-wrap { height: 200px; }
    .modal-img-wrap { height: 220px; }
    .modal-body { padding: 1.5rem; }
    .store-hero { padding: 3rem 0 !important; }
    .store-hero h1 { font-size: 2rem !important; }
}

/* ── 640px ─────────────────────────────────────────────── */
@media (max-width: 640px) {
    /* Preloader */
    .sp-logo { width: 70px !important; }
    .sp-text { font-size: 11px !important; }
    .store-page-preloader div[style*="width:160px"] { width: 120px !important; }

    /* Header */
    .store-header .back-home-btn span { display: none; }

    /* Hero */
    .store-hero { padding: 2.5rem 0 !important; }
    .store-hero h1 { font-size: 1.6rem !important; }
    .store-hero p { font-size: 0.85rem !important; }
    .store-hero .inline-flex.w-16 { width: 48px !important; height: 48px !important; }

    /* Filter bar — horizontal scroll */
    #filtersContainer {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        justify-content: flex-start !important;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    #filtersContainer::-webkit-scrollbar { display: none; }
    .filter-btn {
        font-size: 0.78rem;
        padding: 0.45rem 1.1rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Product grid */
    .product-card .img-wrap { height: 160px; }
    .product-card .card-body { padding: 1rem; }
    .product-card .card-title { font-size: 1rem; }
    .product-card .card-desc { -webkit-line-clamp: 1; margin-bottom: 0.5rem; }
    .product-card .card-price { font-size: 1.15rem; }
    .product-card .card-actions button { width: 36px; height: 36px; }
    .product-card .badge-new { font-size: 0.6rem; padding: 0.25rem 0.65rem; top: 8px; right: 8px; }
    .product-card .card-footer { padding-top: 0.6rem; }

    /* Modal — bottom sheet */
    .store-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .store-modal-content {
        position: relative;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        transform: translateY(100%);
        margin-top: auto;
    }
    .store-modal-overlay.show .store-modal-content {
        transform: translateY(0);
    }
    .modal-img-wrap { height: 200px; }
    .modal-body { padding: 1.25rem; }
    #modalTitle { font-size: 1.4rem; }
    #modalPrice { font-size: 1.5rem; }
    #modalDesc { font-size: 0.85rem; margin-bottom: 1rem; }
    .modal-features { padding: 1rem; }
    .modal-features h4 { font-size: 0.85rem; }
    .modal-features .feat-item { font-size: 0.78rem; }
    .modal-close-btn { width: 34px; height: 34px; top: 0.75rem; left: 0.75rem; }
    .modal-close-btn svg { width: 16px; height: 16px; }
    #modalOrderBtn { font-size: 0.85rem; padding: 0.8rem !important; }

    /* Footer */
    .store-footer { padding: 2rem 0 !important; }

    /* WhatsApp float */
    .whatsapp-float { width: 48px; height: 48px; font-size: 1.25rem; bottom: 16px; left: 16px; }

    /* Notification toast */
    .notification-toast { font-size: 0.8rem; padding: 0.6rem 1.2rem; }
}

/* ── 480px ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    /* Preloader */
    .sp-logo { width: 55px !important; }
    .sp-text { font-size: 10px !important; letter-spacing: 1px !important; }
    .store-page-preloader div[style*="width:160px"] { width: 100px !important; }

    /* Header */
    .store-page-header .back-home-btn span { display: none; }

    /* Hero */
    .store-hero { padding: 2rem 0 !important; }
    .store-hero h1 { font-size: 1.3rem !important; }
    .store-hero p { font-size: 0.78rem !important; }
    .store-hero .inline-flex.w-16 { width: 40px !important; height: 40px !important; border-radius: 12px !important; }
    .store-hero .inline-flex.w-16 svg { width: 20px !important; height: 20px !important; }
    .store-hero .flex.items-center.justify-center.gap-3 { display: none; }

    /* Product grid */
    .product-card { border-radius: 14px; }
    .product-card .img-wrap { height: 130px; }
    .product-card .card-body { padding: 0.75rem; }
    .product-card .card-cat { font-size: 0.6rem; margin-bottom: 0.2rem; }
    .product-card .card-title { font-size: 0.9rem; margin-bottom: 0.3rem; }
    .product-card .card-desc { display: none; }
    .product-card .card-price { font-size: 1rem; }
    .product-card .card-price-old { font-size: 0.7rem; margin-right: 0.3rem; }
    .product-card .card-actions button { width: 32px; height: 32px; border-radius: 8px; }
    .product-card .card-actions button svg { width: 14px; height: 14px; }
    .product-card .card-actions button i { font-size: 0.85rem; }
    .product-card .badge-new { font-size: 0.5rem; padding: 0.2rem 0.5rem; top: 6px; right: 6px; }

    /* Filters */
    .filter-btn { font-size: 0.7rem; padding: 0.35rem 0.85rem; }
    #filtersContainer { gap: 0.35rem; }

    /* Modal */
    .store-modal-content { border-radius: 20px 20px 0 0; }
    .modal-img-wrap { height: 160px; }
    .modal-body { padding: 1rem; }
    #modalTitle { font-size: 1.15rem; }
    #modalPrice { font-size: 1.25rem; }
    #modalDesc { font-size: 0.78rem; }
    .modal-features { padding: 0.75rem; }
    .modal-features h4 { font-size: 0.8rem; }
    .modal-features .feat-item { font-size: 0.72rem; gap: 0.4rem; }
    .modal-features .feat-check { width: 16px; height: 16px; }
    .modal-features .feat-check svg { width: 10px; height: 10px; }
    .modal-cat { font-size: 0.6rem; padding: 0.25rem 0.75rem; }

    /* Footer */
    .store-footer { padding: 1.5rem 0 !important; }
    .store-footer .grid { gap: 1.5rem !important; }
    .store-footer .text-sm { font-size: 0.75rem !important; }

    /* WhatsApp float */
    .whatsapp-float { width: 42px; height: 42px; font-size: 1.1rem; bottom: 12px; left: 12px; box-shadow: 0 4px 15px rgba(37,211,102,0.4); }
}

/* Touch device hover fix */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover { transform: none !important; box-shadow: 0 4px 20px rgba(0,0,0,0.06) !important; }
    .product-card:hover .img-wrap img { transform: none !important; }
    .product-card:hover { border-color: rgba(0,0,0,0.06) !important; }
    .btn-view-detail:hover { transform: none !important; background: var(--accent) !important; }
    .btn-order-wa:hover { transform: none !important; background: #25D366 !important; }
    .filter-btn:hover { transform: none !important; }
    .whatsapp-float:hover { transform: none !important; }
    .back-home-btn:hover { color: #9CA3AF !important; }
}
