/**
 * Banner Sections Styles
 * CSS cho banner sections trên trang chủ
 * 
 * @package SCode_Theme
 */

/* Hero Banner */
.hero-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero-banner h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-banner h2 {
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.hero-banner p {
    font-size: 1.2rem;
    opacity: 0.8;
    line-height: 1.6;
}

/* Banner Section General */
.banner-section {
    margin: 40px 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.banner-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.banner-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.banner-content {
    display: flex;
    align-items: center;
    background: white;
}

.banner-image {
    flex: 0 0 40%;
    padding: 20px;
}

.banner-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
}

.banner-text {
    flex: 1;
    padding: 30px;
}

.banner-main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.banner-sub-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 1rem;
}

.banner-description {
    font-size: 1.1rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* Featured Banners */
.featured-banners {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 60px 0;
}

.featured-banner {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #e2e8f0;
}

.featured-banner .banner-content {
    flex-direction: column;
    text-align: center;
    min-height: 250px;
}

.featured-banner .banner-image {
    flex: none;
    padding: 20px 20px 0;
}

.featured-banner .banner-img {
    height: 150px;
}

.featured-banner .banner-text {
    padding: 20px;
}

.featured-banner .banner-main-title {
    font-size: 1.8rem;
}

.featured-banner .banner-sub-title {
    font-size: 1.2rem;
}

/* Middle Banners */
.middle-banners {
    margin: 60px 0;
}

.middle-banner {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
}

.middle-banner .banner-main-title {
    color: white;
    background: linear-gradient(45deg, #fff, #e5e7eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.middle-banner .banner-sub-title {
    color: #d1d5db;
}

.middle-banner .banner-description {
    color: #9ca3af;
}

/* Bottom Banners */
.bottom-banners {
    margin: 60px 0 0;
}

.bottom-banner {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
}

.bottom-banner .banner-main-title {
    color: white;
    background: linear-gradient(45deg, #fff, #fef2f2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bottom-banner .banner-sub-title {
    color: #fecaca;
}

.bottom-banner .banner-description {
    color: #fca5a5;
}

/* New Products Banners */
.new-products-banners {
    margin: 40px 0;
}

.new-products-banner {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border-radius: 20px;
    overflow: hidden;
}

.new-products-banner .banner-main-title {
    color: white;
    background: linear-gradient(45deg, #fff, #fef3c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.2rem;
    font-weight: 800;
}

.new-products-banner .banner-sub-title {
    color: #fed7aa;
    font-size: 1.4rem;
    font-weight: 600;
}

.new-products-banner .banner-description {
    color: #fdba74;
    font-size: 1.1rem;
    line-height: 1.6;
}

.new-products-banner .banner-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.new-products-banner .banner-img {
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-banner {
        padding: 60px 15px;
    }
    
    .hero-banner h1 {
        font-size: 2.5rem;
    }
    
    .hero-banner h2 {
        font-size: 1.4rem;
    }
    
    .hero-banner p {
        font-size: 1rem;
    }
    
    .banner-content {
        flex-direction: column;
        min-height: auto;
    }
    
    .banner-image {
        flex: none;
        padding: 20px;
    }
    
    .banner-img {
        height: 150px;
    }
    
    .banner-text {
        padding: 20px;
        text-align: center;
    }
    
    .banner-main-title {
        font-size: 2rem;
    }
    
    .banner-sub-title {
        font-size: 1.3rem;
    }
    
    .featured-banners {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 40px 0;
    }
    
    .middle-banners,
    .bottom-banners,
    .new-products-banners {
        margin: 40px 0;
    }
    
    .new-products-banner .banner-main-title {
        font-size: 1.8rem;
    }
    
    .new-products-banner .banner-sub-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .hero-banner {
        padding: 40px 10px;
    }
    
    .hero-banner h1 {
        font-size: 2rem;
    }
    
    .hero-banner h2 {
        font-size: 1.2rem;
    }
    
    .banner-main-title {
        font-size: 1.6rem;
    }
    
    .banner-sub-title {
        font-size: 1.1rem;
    }
    
    .banner-description {
        font-size: 1rem;
    }
    
    .banner-section {
        margin: 20px 0;
    }
    
    .banner-image,
    .banner-text {
        padding: 15px;
    }
    
    .new-products-banner .banner-main-title {
        font-size: 1.6rem;
    }
    
    .new-products-banner .banner-sub-title {
        font-size: 1.1rem;
    }
    
    .new-products-banner .banner-description {
        font-size: 1rem;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.banner-section {
    animation: fadeInUp 0.6s ease-out;
}

/* Hover Effects */
.banner-section:hover .banner-main-title {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.banner-section:hover .banner-img {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

/* Loading State */
.banner-section.loading {
    opacity: 0.7;
    pointer-events: none;
}

.banner-section.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   MOBILE RESPONSIVE BANNERS
   Tối ưu chiều cao banner trên mobile
   =================================== */

/* Tablet - Giảm 30% chiều cao */
@media (max-width: 1024px) {
    .hero-main-section-banner,
    .hero-banner {
        min-height: 210px !important; /* 300px -> 210px */
    }

    .category-icons-banner,
    .best-selling-banner,
    .robot-vacuum-banner,
    .vacuum-handheld-banner,
    .new-products-banner,
    .xiaomi-tv-banner,
    .air-purifier-banner,
    .services-banner,
    .news-banner {
        min-height: 140px !important; /* 200px -> 140px */
    }

    .flash-sale-banner {
        min-height: 175px !important; /* 250px -> 175px */
    }
}

/* Mobile - Giảm 50% chiều cao */
@media (max-width: 768px) {
    .hero-main-section-banner,
    .hero-banner {
        min-height: 0 !important;
        height: 33vw !important; /* ~1/3 chiều ngang màn hình */
        aspect-ratio: 3 / 1;
    }

    .category-icons-banner,
    .best-selling-banner,
    .robot-vacuum-banner,
    .vacuum-handheld-banner,
    .new-products-banner,
    .xiaomi-tv-banner,
    .air-purifier-banner,
    .services-banner,
    .news-banner {
        min-height: 0 !important;
        height: 33vw !important; /* ~1/3 chiều ngang màn hình */
        aspect-ratio: 3 / 1;
    }

    .flash-sale-banner {
        min-height: 0 !important;
        height: 33vw !important; /* ~1/3 chiều ngang màn hình */
        aspect-ratio: 3 / 1;
    }

    /* Tối ưu hiển thị hình ảnh banner trên mobile */
    div[class*="-banner"] {
        height: 33vw !important; /* đảm bảo chiều cao ~1/3 chiều rộng */
        min-height: 0 !important;
        aspect-ratio: 3 / 1;
        background-size: contain !important; /* Hiển thị toàn bộ hình, không cắt */
        background-position: center center !important; /* Căn giữa */
        background-repeat: no-repeat !important;
        background-color: #f5f5f5 !important; /* Màu nền khi hình không đầy */
    }

    /* Giảm padding và font size của text overlay trên mobile */
    div[class*="-banner"] .banner-overlay + div,
    div[class*="-overlay"] {
        padding: 15px !important;
    }

    div[class*="-banner"] h2,
    div[class*="-overlay"] h2 {
        font-size: 1.2rem !important;
        line-height: 1.3;
    }

    div[class*="-banner"] p,
    div[class*="-overlay"] p {
        font-size: 0.85rem !important;
        line-height: 1.4;
    }

    div[class*="-banner"] a.btn,
    div[class*="-banner"] button {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
}

/* Small Mobile - Giảm 60% chiều cao */
@media (max-width: 480px) {
    .hero-main-section-banner,
    .hero-banner {
        min-height: 0 !important;
        height: 33vw !important; /* giữ tỷ lệ ~1/3 chiều ngang */
        aspect-ratio: 3 / 1;
    }

    .category-icons-banner,
    .best-selling-banner,
    .robot-vacuum-banner,
    .vacuum-handheld-banner,
    .new-products-banner,
    .xiaomi-tv-banner,
    .air-purifier-banner,
    .services-banner,
    .news-banner {
        min-height: 0 !important;
        height: 33vw !important; /* giữ tỷ lệ ~1/3 chiều ngang */
        aspect-ratio: 3 / 1;
    }

    .flash-sale-banner {
        min-height: 0 !important;
        height: 33vw !important; /* giữ tỷ lệ ~1/3 chiều ngang */
        aspect-ratio: 3 / 1;
    }

    /* Tối ưu hiển thị hình ảnh banner cho màn hình rất nhỏ */
    div[class*="-banner"] {
        background-size: contain !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
        background-color: #f8f9fa !important;
    }

    /* Text overlay tối ưu cho màn hình nhỏ */
    div[class*="-banner"] .banner-overlay + div,
    div[class*="-overlay"] {
        padding: 10px !important;
    }

    div[class*="-banner"] h2,
    div[class*="-overlay"] h2 {
        font-size: 1rem !important;
        line-height: 1.2;
        margin-bottom: 5px;
    }

    div[class*="-banner"] p,
    div[class*="-overlay"] p {
        font-size: 0.75rem !important;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    div[class*="-banner"] a.btn,
    div[class*="-banner"] button {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
    }
}

/* Tối ưu cho landscape mode trên mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .hero-main-section-banner,
    .hero-banner {
        min-height: 100px !important;
    }

    .category-icons-banner,
    .best-selling-banner,
    .robot-vacuum-banner,
    .vacuum-handheld-banner,
    .new-products-banner,
    .xiaomi-tv-banner,
    .air-purifier-banner,
    .services-banner,
    .news-banner {
        min-height: 70px !important;
    }

    .flash-sale-banner {
        min-height: 85px !important;
    }

    /* Hiển thị toàn bộ hình trong landscape mode */
    div[class*="-banner"] {
        background-size: contain !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
    }
}

/* Giảm opacity overlay trên mobile để hình rõ hơn */
@media (max-width: 768px) {
    div[class*="-banner"] .banner-overlay {
        opacity: 0.5 !important; /* Giảm độ tối của overlay */
    }

    /* Tăng độ tương phản cho text khi overlay mờ hơn */
    div[class*="-banner"] .banner-overlay + div,
    div[class*="-overlay"] {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8) !important;
        background: rgba(0, 0, 0, 0.3) !important; /* Thêm nền cho text */
        border-radius: 8px !important;
    }

    div[class*="-banner"] h2,
    div[class*="-overlay"] h2 {
        color: #ffffff !important;
        font-weight: 700 !important;
    }

    div[class*="-banner"] p,
    div[class*="-overlay"] p {
        color: #ffffff !important;
    }
}
