/* === CSS Variables === */
:root {
    --primary: #1A237E;
    --secondary: #FB6D00;
    --orange: #FB6D00;
    --text-dark: #14213B;
    --text-main: #1B1B21;
    --text-light: #757575;
    --text-muted: #767683;
    --bg-light: #F5F2FB;
    --bg-white: #FBF8FF;
    --border-color: #C6C5D4;
    --border-light: #E4E1EA;
    --success: #4CAF50;
    --price-color: #9E4200;
    --primary-text: #000666;
    --transition: 0.3s ease;
    --radius: 14px;
    --shadow-sm: 0 1px 3px rgba(20,33,59,0.06);
    --shadow-md: 0 4px 16px rgba(20,33,59,0.08);
    --shadow-lg: 0 10px 30px rgba(20,33,59,0.12);
}

/* === Buttons === */
.btn { padding: 9px 24px; border-radius: 10px; font-family: 'Cairo'; font-weight: 600; font-size: 16px; cursor: pointer; transition: var(--transition); border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.4; }
.btn-primary { background-color: var(--secondary); color: white; border-color: var(--secondary); box-shadow: 0 4px 12px rgba(251,109,0,0.25); }
.btn-primary:hover { background-color: #e65100; box-shadow: 0 6px 18px rgba(251,109,0,0.35); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background-color: var(--primary); color: white; }
.btn-outline-block { width: 100%; background: transparent; color: var(--primary); border-color: var(--primary); padding: 11px; border-radius: 10px; font-family: 'Cairo'; font-weight: 700; cursor: pointer; transition: var(--transition); text-align: center; display:block; text-decoration:none; }
.btn-outline-block:hover { background-color: var(--primary); color: white; }
.btn-outline-icon { background: transparent; color: var(--text-main); border-color: var(--border-color); padding: 10px 18px; }
.btn-outline-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-light); }
.btn-sm { font-size: 13px; padding: 6px 14px; }

/* Wishlisted state - Red Heart */
.btn-outline-icon.wishlisted-btn { background: #E53935 !important; border-color: #E53935 !important; color: #fff !important; }
.btn-outline-icon.wishlisted-btn i { color: #fff !important; }
.btn-outline-icon.wishlisted-btn:hover { background: #C62828 !important; border-color: #C62828 !important; }

/* === Breadcrumbs === */
.breadcrumbs-bar { padding: 14px 0; background: var(--bg-light); border-bottom: 1px solid var(--border-light); }
.breadcrumb-list { display: flex; align-items: center; gap: 8px; list-style: none; font-size: 14px; color: var(--text-light); flex-wrap: wrap; }
.breadcrumb-list li { display: flex; align-items: center; }
.breadcrumb-list li a { color: var(--primary); text-decoration: none; }
.breadcrumb-list li a:hover { text-decoration: underline; }
.breadcrumb-list li.active { color: var(--text-dark); font-weight: 600; }
.breadcrumb-list li i { font-size: 10px; color: var(--text-light); }

/* === Product Detail Layout (Main column + Sidebar) === */
.product-detail-main { padding: 32px 0; background: #fff; }
.product-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px 32px; align-items: start; }
.product-main-col { min-width: 0; display: flex; flex-direction: column; gap: 22px; }

/* Spacing reset — sections use flex gap, so kill per-card bottom margins here */
.product-main-col > * { margin: 0; }

/* Sidebar */
.product-sidebar { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
@media (min-width: 993px) {
    .product-sidebar { position: -webkit-sticky; position: sticky; top: 90px; }
}
.sidebar-block { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.sidebar-title { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 14px; }

/* Sponsored cards in sidebar */
.sponsored-list { display: flex; flex-direction: column; gap: 12px; }
.sponsored-card { position: relative; border: 1px solid var(--border-light); border-radius: 12px; padding: 12px; transition: var(--transition); background:#fff; }
.sponsored-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-color); }
.sponsored-discount { position: absolute; top: 10px; inset-inline-start: 10px; background: #E53935; color:#fff; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 20px; z-index:2; }
.sponsored-thumb { display:block; width: 100%; height: 110px; border-radius: 8px; overflow: hidden; background: #f3f2f7; margin-bottom: 10px; }
.sponsored-thumb img { width:100%; height:100%; object-fit: cover; }
.sponsored-thumb .ph { width:100%; height:100%; display:flex; align-items:center; justify-content:center; color:#ccc; font-size:32px; }
.sponsored-name { display:block; font-size: 14px; font-weight: 700; color: var(--text-dark); text-decoration:none; line-height:1.4; margin-bottom: 6px; }
.sponsored-name:hover { color: var(--primary); }
.sponsored-meta { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.sponsored-price { font-size: 16px; font-weight: 800; color: var(--price-color); margin-bottom: 10px; }
.sponsored-btn { width: 100%; padding: 8px; font-size: 14px; font-weight: 700; }

/* My purchases empty state */
.purchases-empty { text-align: center; padding: 22px 12px; color: var(--text-light); }
.purchases-empty i { font-size: 30px; color: var(--border-color); display:block; margin-bottom: 8px; }
.purchases-empty p { font-size: 14px; margin: 0; }

/* Sidebar gallery */
.sidebar-gallery .main-image-container { aspect-ratio: 1 / 1; max-height: 520px; }
.sidebar-gallery .img-fallback { width:100%; height:100%; display:flex; align-items:center; justify-content:center; }
.sidebar-gallery .img-fallback i { font-size: 64px; color: var(--border-color); }
.sidebar-gallery .thumbnail-strip { margin-top: 12px; }

/* === Product Gallery (Left) === */
.product-gallery { display: flex; flex-direction: column; gap: 14px; }
.main-image-container { background: linear-gradient(180deg,#fafafe,#f1f0f7); border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; aspect-ratio: 1 / 1; max-height: 480px; position: relative; display:flex; align-items:center; justify-content:center; }
.main-image-container img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.4s; }
.main-image-container:hover img { transform: scale(1.04); }

/* Discount badge on main image */
.discount-badge-main { position: absolute; top: 16px; right: 16px; background: #E53935; color: #fff; padding: 6px 16px; border-radius: 20px; font-size: 16px; font-weight: 800; z-index: 5; pointer-events: none; box-shadow: 0 4px 10px rgba(229,57,53,0.35); }
html[dir="ltr"] .discount-badge-main { right: auto; left: 16px; }

/* Thumbnails */
.thumbnail-strip { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.thumb-item { width: 72px; height: 72px; border: 2px solid var(--border-light); border-radius: 10px; overflow: hidden; cursor: pointer; transition: border-color 0.2s, transform 0.2s; background:#fff; }
.thumb-item:hover { transform: translateY(-2px); border-color: var(--border-color); }
.thumb-item.active { border-color: var(--orange); }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }

/* === Contact Seller Card === */
.contact-seller-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.contact-seller-card h3 { margin-bottom: 16px; font-size: 18px; color: var(--primary); font-weight: 700; }
.contact-list-details { list-style: none; margin-bottom: 16px; padding:0; }
.contact-list-details li { display: flex; gap: 12px; margin-bottom: 12px; font-size: 14px; align-items: center; }
.contact-list-details li i { color: var(--primary); width: 18px; text-align: center; flex-shrink: 0; }
.contact-list-details li a { color: var(--text-main); text-decoration: none; }
.contact-list-details li a:hover { color: var(--primary); }

/* === Product Title block (Right) === */
.section-title { min-width: 0; }
.product-meta-top { display: flex; justify-content: space-between; align-items: center; gap:12px; margin-bottom: 10px; flex-wrap: wrap; }
.ref-number { color: var(--primary-text); font-weight: 700; font-size: 14px; background: var(--bg-light); padding: 4px 12px; border-radius: 8px; }
.badge.verified { background: var(--success); color: white; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.product-title { font-size: 30px; color: var(--text-dark); line-height: 1.3; margin-bottom: 14px; font-weight: 800; }
.product-category-company { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; font-size: 15px; flex-wrap: wrap; }
.category { color: var(--text-light); }
.dot { width: 4px; height: 4px; background: var(--border-color); border-radius: 50%; }
.company-link { color: var(--primary); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.company-link:hover { text-decoration: underline; }

/* === Pricing Card (Buy Box) === */
.pricing-card { background: var(--bg-light); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.pricing-card h3 { font-size: 18px; color: var(--primary); margin-bottom: 16px; font-weight: 700; }
.price-tier { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: white; border: 1px solid var(--border-light); border-radius: 10px; margin-bottom: 8px; transition: var(--transition); }
.price-tier:hover { border-color: var(--primary); }
.price-tier.featured { border: 2px solid var(--primary); background: #fff; box-shadow: 0 2px 10px rgba(26,35,126,0.1); }
.price-amount .price { font-size: 22px; font-weight: 800; color: var(--primary-text); display: block; }
.price-amount .label { font-size: 12px; color: var(--text-light); }
.price-range { text-align: end; flex-shrink: 0; }
.range-text { font-size: 14px; font-weight: 600; color: var(--text-main); display: block; }
.discount-badge { display: inline-block; font-size: 12px; font-weight: 700; color: #D32F2F; background: #FFEBEE; padding: 2px 8px; border-radius: 4px; margin-top: 4px; }

.moq-section { display: flex; align-items: center; gap: 10px; margin: 16px 0 20px; font-size: 14px; background: #fff; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-light); }
.moq-icon { color: var(--success); font-size: 20px; flex-shrink:0; }
.moq-section p { margin: 0; }

.action-buttons { display: flex; flex-direction: column; gap: 12px; }
.btn-contact { width: 100%; justify-content: center; font-size: 17px; padding: 15px; font-weight: 700; }
.secondary-actions { display: flex; gap: 12px; }
.secondary-actions .btn-outline-icon { flex: 1; justify-content: center; }

/* === Info Card (Description, Seller) === */
.info-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.info-card h3 { font-size: 19px; color: var(--primary); margin-bottom: 16px; font-weight: 700; }
.description-text { color: var(--text-main); line-height: 1.9; font-size: 15px; }
.description-text img { max-width: 100%; height: auto; border-radius: 8px; }

/* Seller info as a clean spec table */
.section-seller .spec-row { display:flex; border-bottom: 1px solid var(--border-light); }
.section-seller .spec-row:last-child { border-bottom: none; }

/* Product Features */
.product-features-section { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.product-features-section h3 { font-size: 19px; color: var(--primary); margin-bottom: 16px; font-weight: 700; display:flex; align-items:center; gap:8px; }
.product-features-list { display: flex; flex-wrap: wrap; gap: 10px; }
.feature-item { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-light); color: var(--text-main); padding: 8px 14px; border-radius: 24px; font-size: 14px; font-weight: 600; }
.feature-item i { color: var(--success); }

/* === Specs Table === */
.specs-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.specs-header { background: var(--bg-light); padding: 14px 24px; border-bottom: 1px solid var(--border-light); }
.specs-header h3 { font-size: 17px; color: var(--primary); font-weight: 700; }
.spec-row { display: flex; border-bottom: 1px solid var(--border-light); }
.spec-row:last-child { border-bottom: none; }
.spec-label { width: 35%; min-width: 120px; padding: 13px 18px; font-weight: 600; font-size: 14px; color: var(--text-main); background: #fbfbfd; border-left: 1px solid var(--border-light); }
html[dir="ltr"] .spec-label { border-left: none; border-right: 1px solid var(--border-light); }
.spec-value { width: 65%; padding: 13px 18px; font-size: 14px; color: var(--text-light); word-break: break-word; }
.spec-value a { color: var(--primary); text-decoration: none; font-weight: 600; }
.spec-value a:hover { text-decoration: underline; }

/* === Special Offer Card === */
.special-offer-card { background: linear-gradient(135deg, #E53935, #FF6F00); border-radius: var(--radius); padding: 24px; color: #fff; text-align: center; box-shadow: var(--shadow-md); }
.offer-discount { font-size: 38px; font-weight: 800; }
.offer-label { font-size: 16px; margin-top: 4px; }
.offer-ends { font-size: 13px; margin-top: 8px; opacity: 0.92; }
.offer-prices { margin-top: 12px; font-size: 16px; }
.old-price { text-decoration: line-through; opacity: 0.8; }
.new-price { font-size: 24px; font-weight: 800; margin-inline-start: 8px; }

/* === Related Sections === */
.related-section { padding: 56px 0; }
.bg-light { background-color: var(--bg-light); }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; border-bottom: 2px solid #E5EEFF; padding-bottom: 16px; flex-wrap: wrap; }
.section-text h2 { font-size: 24px; color: var(--primary-text); font-weight: 800; }
.section-text p { color: var(--text-light); margin-top: 4px; }
.view-all { color: var(--primary-text); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.view-all:hover { text-decoration: underline; }

/* Product Cards (Related) */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.product-card { background: white; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-light); transition: var(--transition); }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.product-img { height: 200px; position: relative; background: #f3f2f7; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-info { padding: 16px; }
.product-info h3 { font-size: 16px; margin-bottom: 4px; line-height:1.45; max-height: 47px; overflow: hidden; }
.product-info h3 a { color: inherit; text-decoration: none; }
.company-name { font-size: 14px; color: var(--text-light); margin-bottom: 12px; }
.product-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px dashed var(--border-color); padding-top: 12px; }
.price { font-size: 16px; font-weight: 700; color: var(--primary-text); }

/* === Responsive === */

/* Tablet / stacked single column — sidebar drops below the main content */
@media (max-width: 992px) {
    .product-layout { grid-template-columns: 1fr; gap: 22px; }
    .product-sidebar { position: static; }
    /* Spread sponsored cards across the row when the sidebar is full-width */
    .sponsored-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
    .sidebar-gallery .main-image-container { max-height: 360px; }
    .related-section { padding: 44px 0; }
}

@media (max-width: 768px) {
    .product-detail-main { padding: 24px 0; }
    .product-title { font-size: 23px; }
    .main-image-container { aspect-ratio: 4 / 3; max-height: none; }
    .btn-contact { font-size: 16px; padding: 14px; }
    .pricing-card, .contact-seller-card, .info-card, .product-features-section { padding: 18px; }
    .price-tier { flex-direction: column; align-items: flex-start; gap: 6px; }
    .price-range { text-align: start; }
    .product-category-company { gap: 8px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
    .section-text h2 { font-size: 20px; }
    .product-img { height: 170px; }

    /* Mobile reordering */
    .product-layout { display: flex; flex-direction: column; }
    .product-main-col { display: contents; }
    .product-sidebar { display: contents; }

    .product-head { order: 1; }
    .sidebar-gallery { order: 2; }
    .product-features-section,
    .specs-card,
    .info-card { order: 3; }
    .pricing-card { order: 4; }
    .special-offer-card { order: 4; }
    .contact-seller-card { order: 5; }
    .sidebar-block:not(.sidebar-gallery):not(.contact-seller-card) { order: 6; }

    .product-head,
    .sidebar-gallery,
    .product-features-section,
    .specs-card,
    .info-card,
    .pricing-card,
    .special-offer-card,
    .contact-seller-card,
    .sidebar-block {
        display: block;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .breadcrumb-list { font-size: 12px; gap: 4px; }
    .product-title { font-size: 20px; }
    .main-image-container { aspect-ratio: 1 / 1; }
    .thumb-item { width: 60px; height: 60px; }
    .btn-contact { font-size: 15px; padding: 13px; }
    .action-buttons { gap: 10px; }
    .secondary-actions { flex-direction: column; gap: 8px; }
    .secondary-actions .btn-outline-icon { padding: 10px 12px; font-size: 14px; }
    .price-amount .price { font-size: 20px; }
    .products-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .product-img { height: 130px; }
    .product-info { padding: 11px; }
    .product-info h3 { font-size: 13px; max-height: 38px; }
    .company-name { font-size: 12px; margin-bottom: 8px; }
    .product-meta { font-size: 12px; padding-top: 8px; }
    .spec-label { min-width: 100px; padding: 11px 12px; }
    .spec-value { padding: 11px 12px; }
    .offer-discount { font-size: 30px; }
    .offer-prices .new-price { font-size: 20px; }
}
