/* =====================================================
   نظام الإعلانات - أنماط مشتركة
   ===================================================== */

/* --- العلامة "إعلان" --- */
.ad-label {
    font-size: 0.65rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.ad-label-sm {
    font-size: 0.6rem;
    color: var(--gray-400);
    letter-spacing: 1px;
    font-weight: 600;
}

/* =====================================================
   1. بانر أفقي بين الأقسام
   ===================================================== */
.ad-banner-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.ad-banner-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ad-banner-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.ad-banner-card:hover {
    border-color: var(--gray-200);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.ad-img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.ad-img-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e0e7ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ad-banner-info {
    flex: 1;
    min-width: 0;
}
.ad-banner-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0 0 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ad-banner-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ad-banner-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: #059669;
}
.ad-banner-cta {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* =====================================================
   2. كرت سايدبار
   ===================================================== */
.ad-sidebar-card {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    text-align: center;
    position: relative;
}
.ad-sidebar-card .ad-label-sm {
    position: absolute;
    top: 6px;
    left: 8px;
}
.ad-sidebar-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}
.ad-sidebar-placeholder {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, #e0e7ff, #dbeafe);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.ad-sidebar-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0 0 0.25rem;
}
.ad-sidebar-price {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 0.4rem;
}
.ad-sidebar-cta {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    background: var(--primary);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    transition: background 0.2s;
}
.ad-sidebar-card:hover .ad-sidebar-cta {
    background: #1d4ed8;
}

/* =====================================================
   3. شريط المنتجات فوق الفوتر
   ===================================================== */
.ad-footer-strip {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid var(--gray-100);
    padding: 1.5rem 0;
}
.ad-footer-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.ad-footer-title-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-600);
}
.ad-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
.ad-footer-card {
    background: white;
    border-radius: 10px;
    padding: 0.75rem;
    text-decoration: none;
    color: inherit;
    text-align: center;
    transition: all 0.2s;
    border: 1px solid var(--gray-100);
}
.ad-footer-card:hover {
    border-color: var(--gray-200);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.ad-footer-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}
.ad-footer-placeholder {
    width: 100%;
    height: 70px;
    background: linear-gradient(135deg, #e0e7ff, #dbeafe);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.ad-footer-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.ad-footer-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ad-footer-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: #059669;
}

/* =====================================================
   4. شريط إعلانات تحت الهيدر
   ===================================================== */
.ad-header-bar {
    background: linear-gradient(180deg, #f0f4ff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--gray-100);
    padding: 1rem 0;
    position: relative;
}
.ad-header-bar .container {
    position: relative;
}
.ad-header-bar-inner {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.25rem 0;
}
.ad-header-bar-inner::-webkit-scrollbar {
    display: none;
}
.ad-hb-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--gray-100);
    transition: all 0.25s ease;
    flex-shrink: 0;
    min-width: 140px;
    max-width: 180px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ad-hb-card:hover {
    border-color: var(--primary-light, #93c5fd);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
    transform: translateY(-2px);
}
.ad-hb-img {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}
.ad-hb-img-placeholder {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0e7ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}
.ad-hb-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: 100%;
}
.ad-hb-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    line-height: 1.4;
    width: 100%;
}
.ad-hb-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: #059669;
}
.ad-hb-label {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.6rem;
    color: var(--gray-300);
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .ad-banner-card {
        gap: 0.75rem;
        padding: 0.6rem;
    }
    .ad-img, .ad-img-placeholder {
        width: 44px;
        height: 44px;
    }
    .ad-banner-cta {
        display: none;
    }
    .ad-footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ad-header-bar-inner {
        justify-content: flex-start;
        gap: 0.75rem;
        padding-bottom: 0.5rem;
    }
    .ad-hb-card {
        min-width: 120px;
        max-width: 150px;
        padding: 0.5rem 0.75rem;
    }
    .ad-hb-img, .ad-hb-img-placeholder {
        height: 65px;
    }
    .ad-hb-title {
        font-size: 0.75rem;
    }
    .ad-hb-price {
        font-size: 0.8rem;
    }
}

/* =====================================================
   5. إعلان منبثق (Popup)
   ===================================================== */
.ad-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}
.ad-popup-overlay.ad-popup-visible {
    opacity: 1;
}
.ad-popup-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    max-width: 420px;
    width: 100%;
    position: relative;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}
.ad-popup-visible .ad-popup-container {
    transform: scale(1) translateY(0);
}
.ad-popup-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}
.ad-popup-close:hover {
    background: rgba(0, 0, 0, 0.7);
}
.ad-popup-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--gray-500);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    z-index: 10;
    letter-spacing: 0.5px;
}
.ad-popup-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.ad-popup-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}
.ad-popup-img-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}
.ad-popup-content {
    padding: 1.25rem 1.5rem;
}
.ad-popup-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}
.ad-popup-desc {
    font-size: 0.88rem;
    color: var(--gray-500);
    margin: 0 0 1rem;
    line-height: 1.7;
}
.ad-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}
.ad-popup-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: #059669;
}
.ad-popup-cta {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.2s, transform 0.2s;
}
.ad-popup-link:hover .ad-popup-cta {
    background: #1d4ed8;
    transform: translateX(-3px);
}

@media (max-width: 480px) {
    .ad-popup-container {
        max-width: 95%;
        border-radius: 16px;
    }
    .ad-popup-img {
        height: 160px;
    }
    .ad-popup-content {
        padding: 1rem 1.25rem;
    }
    .ad-popup-title {
        font-size: 1rem;
    }
    .ad-popup-desc {
        font-size: 0.82rem;
    }
}
