html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.product-page-main {
    padding-top: 1.1rem;
    padding-bottom: 6rem; /* مساحة للفوتر الديسكتوب */
}

/* ====== الهيرو ====== */

.product-hero {
    background: linear-gradient(135deg, #e8f5e9, #ffffff);
    border-radius: 18px;
    padding: 14px 14px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

.product-title {
    font-size: 1.15rem; /* أصغر */
    font-weight: 700;
    color: #1b5e20;
    margin: 0;
}

.rating-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #555;
}

.rating-stars {
    display: inline-flex;
    gap: 1px;
    font-size: 0.85rem;
    color: #f6b500;
}

/* ====== التخطيط العام ====== */

.product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 1.4rem;
    align-items: flex-start;
}

/* ====== كرت الصور ====== */

.product-gallery-card {
    background-color: #ffffff;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    /* لا max-width حتى لا تظهر فراغات يمين ويسار */
}

/* الصورة الرئيسية تظهر كاملة داخل الكرت */
.product-main-image-wrapper {
    border-radius: 16px;
    overflow: hidden;
    background-color: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 420px;      /* ارتفاع معقول */
}

.product-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;     /* الصورة كاملة بدون قص */
    display: block;
}

.thumbs-row {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.thumb-item {
    flex: 0 0 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    background-color: #f5f5f5;
    transition: border-color 0.16s ease, transform 0.16s ease;
}

.thumb-item.active {
    border-color: #2e7d32;
    transform: translateY(-1px);
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ====== كرت معلومات الشراء ====== */

.product-info-card {
    background-color: #ffffff;
    border-radius: 18px;
    padding: 10px 10px 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.price-current {
    font-size: 1.18rem;   /* أصغر من قبل */
    font-weight: 700;
    color: #2e7d32;
}

.price-old {
    font-size: 0.82rem;
    color: #b0b0b0;
    text-decoration: line-through;
}

.size-info-text {
    font-size: 0.76rem;
    color: #555;
}

/* خيارات الأحجام */

.options-block {
    margin-top: 4px;
}

.options-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.option-chip {
    padding: 4px 9px;
    font-size: 0.76rem;
    border-radius: 999px;
    border: 1px solid #cfd8dc;
    background-color: #f7f7f7;
    cursor: pointer;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    transition: all 0.16s ease-in-out;
    max-width: 100%;
}

.option-chip.active {
    background-color: #2e7d32;
    color: #fff;
    border-color: #2e7d32;
    box-shadow: 0 2px 6px rgba(46,125,50,0.25);
}

.option-chip.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.stock-text {
    font-size: 0.74rem;
    color: #555;
}

/* الكمية */

.qty-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.qty-label {
    font-size: 0.78rem;
    color: #444;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #cfd8dc;
    overflow: hidden;
    background-color: #fafafa;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #2e7d32;
}

.qty-input {
    width: 42px;
    height: 28px;
    border: none;
    text-align: center;
    font-size: 0.86rem;
    background: transparent;
}

.qty-input:focus {
    outline: none;
}

/* CTA */

.cta-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.btn-add-main {
    border-radius: 999px;
    padding-block: 6px;
    font-weight: 600;
    font-size: 0.86rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.trust-text {
    font-size: 0.72rem;
    color: #777;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #f0f0f0;
}

.trust-text i {
    color: #2e7d32;
    font-size: 0.8rem;
}

/* ====== تفاصيل المنتج (التبويبات) ====== */

.info-section-card {
    border-radius: 18px;
    padding: 10px 10px 12px;
    margin-top: 1rem;
    background: linear-gradient(135deg, #f1f8e9, #ffffff);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.info-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.info-main-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2e7d32;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.info-main-title i {
    font-size: 1rem;
}

/* ألسنة التفاصيل – بدون شريط تمرير أفقي، والرمز بجانب التسمية */

.tabs-nav {
    display: flex;
    flex-wrap: wrap;      /* يلف على أكثر من سطر */
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 2px;
    width: 100%;
    overflow-x: hidden;   /* يمنع السحب يمين/يسار */
}

.tab-pill {
    flex: 0 1 auto;
    padding: 5px 9px;
    font-size: 0.78rem;
    border-radius: 999px;
    border: 1px solid #cfd8dc;
    background-color: #fafafa;
    cursor: pointer;
    color: #444;
    display: inline-flex;       /* رجّعناها صف أفقي */
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 5px;                   /* مسافة بين الأيقونة والنص */
    transition: all 0.18s ease;
    min-width: 80px;
    white-space: nowrap;        /* ما يتكسّر كل كلمة بس يسمح باللف بالـ flex-wrap */
}

.tab-pill i {
    font-size: 0.9rem;
    opacity: 0.9;
}

.tab-pill.active {
    background-color: #2e7d32;
    color: #fff;
    border-color: #2e7d32;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(46,125,50,0.25);
}

.tab-panels-wrapper {
    margin-top: 4px;
}

.tab-panel {
    display: none;
    font-size: 0.8rem;
    color: #444;
    line-height: 1.7;
    white-space: normal;
    background-color: #ffffff;
    border-radius: 14px;
    padding: 9px 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    border-inline-start: 3px solid #c5e1a5;
    animation: fadeInTab 0.18s ease-out;
}

.tab-panel.active {
    display: block;
}

.tab-panel-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #33691e;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tab-panel-title i {
    font-size: 0.8rem;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====== التقييمات ====== */

.reviews-card {
    background-color: #ffffff;
    border-radius: 18px;
    padding: 10px 10px 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    margin-top: 1rem;
}

.reviews-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.reviews-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
}

.single-review {
    border-bottom: 1px solid #f0f0f0;
    padding-block: 6px;
    font-size: 0.78rem;
}

.single-review:last-child {
    border-bottom: none;
}

.review-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 2px;
}

.review-name {
    font-weight: 600;
    color: #333;
}

.review-date {
    font-size: 0.7rem;
    color: #888;
}

.review-text {
    font-size: 0.78rem;
    color: #444;
    white-space: pre-wrap;
}

/* نجوم التقييم في الفورم */

.rating-input-stars {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 2px;
    cursor: pointer;
}

.rating-input-stars input {
    display: none;
}

.rating-input-stars label {
    font-size: 1rem;
    color: #ccc;
    padding: 0 1px;
}

.rating-input-stars input:checked ~ label,
.rating-input-stars label:hover,
.rating-input-stars label:hover ~ label {
    color: #f6b500;
}

/* ====== التوست + الفلاينغ ====== */

.cart-toast {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background-color: #2e7d32;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22);
    opacity: 0;
    z-index: 2100;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cart-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.flying-item {
    position: fixed;
    width: 48px;
    height: 48px;
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
    transition: transform 0.6s ease, opacity 0.6s.ease;
}

#cartCount.shake-cart-count {
    animation: cart-bump 0.3s ease;
}

@keyframes cart-bump {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ====== الفوتر ====== */

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10;
}

/* ====== ميديا كويري ====== */

@media (min-width: 577px) {
    .product-page-main {
        padding-bottom: 140px;
    }
}

@media (max-width: 576px) {
    .product-page-main {
        padding-bottom: 2rem;
    }

    .product-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .product-title {
        font-size: 1.08rem;
    }

    .product-gallery-card {
        padding: 8px;
    }

    .product-main-image-wrapper {
        max-height: 360px;
    }

    /* تبويبات على صفين بدون سكرول، لكن الأيقونة تبقى جنب النص */
    .tab-pill {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        white-space: nowrap;
    }

    footer {
        display: none !important;
    }
}
