/* ===================================
   SHOP FEATURED SECTIONS - UPDATED
   ปรับ spacing และ style ให้เหมือนของเดิม
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

/* === FEATURED SECTIONS CONTAINER === */
.featured-products-section {
    width: 100%;
    max-width: 1400px;
    margin: 48px auto;
    padding: 0 20px;
}

.featured-products-section.new-arrivals {
    background: transparent;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 24px;
}

.featured-products-section.best-sellers {
    background: transparent;
    padding-top: 0;
    padding-bottom: 0;
}

.featured-products-section.popular-products {
    background: transparent;
    padding-top: 0;
    padding-bottom: 0;
}

/* === SECTION HEADER === */
.featured-section-header {
    text-align: center;
    margin-bottom: 40px;
}

.featured-section-title {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 48px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0 0 8px;
    line-height: 1.0714285714;
    letter-spacing: -0.005em;
}

.featured-section-subtitle {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 19px;
    font-weight: 400;
    color: #86868b;
    margin: 0;
    line-height: 1.381;
    letter-spacing: 0.011em;
}

/* === FEATURED SWIPER === */
.featured-swiper {
    width: 100%;
    padding: 20px 0 40px;
    position: relative;
}

.featured-swiper .swiper-slide {
    height: auto;
}

/* === FEATURED CARD - เหมือนของเดิม === */
.featured-card {
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.featured-card:hover {
    border-color: #d2d2d7;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

/* === CARD IMAGE === */
.featured-card-image {
    position: relative;
    overflow: hidden;
    background: #fbfbfd;
    aspect-ratio: 1 / 1;
}

.featured-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.featured-card:hover .featured-card-image img {
    transform: scale(1.05);
}

.featured-sale-badge {
    position: absolute;
    top: 12px;
    right: 11px;
    background: #ff3b30;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 12px;
    z-index: 2;
    letter-spacing: -0.016em;
}

/* === CARD CONTENT === */
.featured-card-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.featured-card-category {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.featured-card-title {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 12px;
    line-height: 1.294;
    letter-spacing: -0.022em;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-card-content a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.featured-card-content a:hover .featured-card-title {
    color: #325D53;
}

/* === CARD PRICE ROW (with sold count) === */
.featured-card-price-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin: 12px 0;
    gap: 8px;
}

/* === CARD PRICE === */
.featured-card-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* First line: sale price + discount badge */
.featured-card-price .price-line-1 {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Second line: regular price */
.featured-card-price .price-line-2 {
    display: flex;
    align-items: center;
}

/* Simple Price Format - Sale Price (ราคาลด) */
.featured-card-price .sale-price {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #ff424e;
    letter-spacing: -0.01em;
}

/* Simple Price Format - Discount Badge */
.featured-card-price .discount-badge {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: #ff424e;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Simple Price Format - Regular Price (ราคาเต็มขีดฆ่า) */
.featured-card-price .regular-price {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #999;
    text-decoration: line-through;
}

/* Simple Price Format - Normal Price (ราคาปกติไม่มีลด) */
.featured-card-price .normal-price {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.01em;
}

/* Legacy support for ins/del format */
.featured-card-price ins {
    text-decoration: none;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #ff424e;
    letter-spacing: -0.01em;
    order: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Discount Badge - ติดข้างราคาลด (ins) */
.featured-card-price ins::after {
    content: attr(data-discount);
    background: #ff424e;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    line-height: 1;
}

.featured-card-price del {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    color: #999;
    font-weight: 400;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    opacity: 1;
    order: 2;
}

.featured-card-price span {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === SOLD COUNT === */
.sold-count {
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #86868b;
    white-space: nowrap;
}

/* Desktop price-row for WooCommerce products */
.price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.price-row .price {
    margin: 0;
}

.price-row .sold-count {
    font-size: 11px;
}

/* === CARD BUTTON === */
.featured-card-button {
    margin-top: auto;
    width: 100%;
    padding: 10px 20px;
    background: #325D53;
    color: #ffffff;
    border: none;
    border-radius: 980px;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    letter-spacing: -0.016em;
}

.featured-card-button:hover {
    background: #285446;
    transform: scale(1.02);
    color: #ffffff;
}

.featured-card-button i {
    font-size: 15px;
    color: #ffffff;
}

.featured-card-button span {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

/* === SWIPER NAVIGATION === */
.featured-swiper .swiper-button-prev,
.featured-swiper .swiper-button-next {
    width: 44px;
    height: 44px;
    background: #325D53;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(50, 93, 83, 0.3);
    transition: all 0.3s ease;
}

.featured-swiper .swiper-button-prev:after,
.featured-swiper .swiper-button-next:after {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.featured-swiper .swiper-button-prev:hover,
.featured-swiper .swiper-button-next:hover {
    background: #285446;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(50, 93, 83, 0.4);
}

/* === SWIPER PAGINATION === */
.featured-swiper .swiper-pagination {
    bottom: 10px !important;
}

.featured-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #d2d2d7;
    opacity: 1;
    transition: all 0.3s ease;
}

.featured-swiper .swiper-pagination-bullet-active {
    width: 24px;
    border-radius: 4px;
    background: #325D53;
}

/* === DIVIDER BANNERS SECTION === */
.divider-banners-section {
    width: 100%;
    max-width: 1400px;
    margin: 48px auto;
    padding: 0 20px;
}

.divider-banners-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.divider-banner-item {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    transition: all 0.3s ease;
    aspect-ratio: 2 / 1;
}

.divider-banner-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.divider-banner-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.divider-banner-item a {
    display: block;
    width: 100%;
    height: 100%;
}

/* === FULL WIDTH BANNER SECTION === */
.full-width-banner-section {
    width: 100%;
    max-width: 1400px;
    margin: 48px auto;
    padding: 0 20px;
}

.full-width-banner-item {
    width: 100%;
    overflow: hidden;
    border-radius: 18px;
    transition: all 0.3s ease;
}

.full-width-banner-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.full-width-banner-item img {
    width: 100%;
    height: auto;
    display: block;
}

.full-width-banner-item a {
    display: block;
    width: 100%;
}

/* Shop Banners Grid - 2 columns */
.shop-banners-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* === ANIMATIONS === */
@keyframes featuredFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.featured-card {
    animation: featuredFadeInUp 0.6s ease forwards;
    animation-fill-mode: both;
}

.featured-swiper .swiper-slide:nth-child(1) .featured-card { animation-delay: 0.1s; }
.featured-swiper .swiper-slide:nth-child(2) .featured-card { animation-delay: 0.15s; }
.featured-swiper .swiper-slide:nth-child(3) .featured-card { animation-delay: 0.2s; }
.featured-swiper .swiper-slide:nth-child(4) .featured-card { animation-delay: 0.25s; }

/* === RESPONSIVE DESIGN === */

/* Tablet */
@media (max-width: 1024px) {
    .featured-products-section {
        margin: 40px auto;
        padding: 0 20px;
    }
    
    .featured-products-section.new-arrivals {
        margin-top: 40px;
    }
    
    .featured-section-header {
        margin-bottom: 32px;
    }
    
    .featured-section-title {
        font-size: 42px;
    }
    
    .featured-section-subtitle {
        font-size: 17px;
    }
    
    .featured-swiper {
        padding: 20px 0 35px;
    }
    
    .divider-banners-section {
        margin: 40px auto;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .featured-products-section {
        margin: 32px auto;
        padding: 0 16px;
    }
    
    .featured-products-section.new-arrivals {
        margin-top: 32px;
    }
    
    .featured-section-header {
        margin-bottom: 24px;
    }
    
    .featured-section-title {
        font-size: 36px;
    }
    
    .featured-section-subtitle {
        font-size: 16px;
    }
    
    .featured-swiper {
        padding: 15px 0 35px;
    }
    
    .featured-swiper .swiper-button-prev,
    .featured-swiper .swiper-button-next {
        width: 36px;
        height: 36px;
    }
    
    .featured-swiper .swiper-button-prev:after,
    .featured-swiper .swiper-button-next:after {
        font-size: 14px;
    }
    
    .featured-card-content {
        padding: 12px;
    }
    
    .featured-card-title {
        font-size: 15px;
        min-height: 38px;
    }
    
    .featured-card-price ins,
    .featured-card-price span {
        font-size: 21px;
    }
    
    .featured-card-price del {
        font-size: 15px;
    }
    
    .featured-card-button {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .divider-banners-section {
        margin: 32px auto;
        padding: 0 16px;
    }
    
    .divider-banners-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .divider-banner-item {
        border-radius: 12px;
    }
    
    .full-width-banner-section {
        margin: 24px auto;
        padding: 0 12px;
    }
    
    .full-width-banner-item {
        border-radius: 12px;
    }
    
    .shop-banners-grid-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .featured-section-title {
        font-size: 32px;
    }
    
    .featured-section-subtitle {
        font-size: 15px;
    }
    
    .featured-card-title {
        font-size: 14px;
        min-height: 36px;
    }
    
    .featured-card-price ins,
    .featured-card-price span {
        font-size: 19px;
    }
    
    .featured-card-price del {
        font-size: 12px;
    }
    
    .featured-card-price ins::after {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .featured-sale-badge {
        padding: 3px 8px;
        font-size: 11px;
    }
}

/* === UTILITY === */
.featured-card:focus-visible {
    outline: 2px solid #325D53;
    outline-offset: 2px;
}

.featured-card-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* ===================================
   MOBILE GRID VIEW - แสดง Grid 2 columns บน Mobile
   ซ่อน Swiper แสดง Grid แทน
   =================================== */

/* Mobile Grid Container - ซ่อนบน Desktop */
.mobile-products-grid {
    display: none;
}

/* All Products Section - Desktop/Mobile Toggle */
.desktop-products-view {
    display: grid;
}

.all-products-mobile-grid {
    display: none;
}

/* All Products desktop grid — uses .featured-card markup so it visually
   matches "สินค้ามาใหม่" and "สินค้าขายดี" sections. Capped to the same
   1360px content width as .featured-products-section so card images don't
   grow larger than the featured swiper cards on wide desktops where
   .woocommerce-main-content expands to 1600px. Breakpoints mirror the
   swiper config in js/shop-featured.js (4-up ≥1024, 3-up 768-1023). */
.desktop-products-view.all-products-grid {
    max-width: 1360px;
    margin-left: auto;
    margin-right: auto;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Cap each card at the same intrinsic width as a featured-swiper slide
   ((1360 - 3*24) / 4 = 322px). Belt-and-suspenders with the container
   max-width above: even if a parent stretches the grid wider (e.g. the
   1600px wide-desktop main-content), each card stays the same size as
   "สินค้ามาใหม่" / "สินค้าขายดี". */
.desktop-grid-item {
    width: 100%;
    max-width: 322px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 1023px) {
    .desktop-products-view.all-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* === MOBILE ONLY (768px and below) === */
@media (max-width: 768px) {
    /* ซ่อน Swiper บน Mobile */
    .featured-swiper {
        display: none !important;
    }
    
    /* แสดง Mobile Grid */
    .mobile-products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0;
    }
    
    /* All Products - ซ่อน Desktop แสดง Mobile */
    .desktop-products-view {
        display: none !important;
    }
    
    .all-products-mobile-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0;
    }
    
    .mobile-products-grid .mobile-grid-item {
        width: 100%;
    }
    
    /* Mobile Card Styles */
    .mobile-products-grid .featured-card {
        height: 100%;
        border: 1px solid #f0f0f0;
        border-radius: 12px;
        margin: 0;
    }
    
    .mobile-products-grid .featured-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .mobile-products-grid .featured-card-image {
        aspect-ratio: 1 / 1;
    }
    
    .mobile-products-grid .featured-card-content {
        padding: 10px;
    }
    
    .mobile-products-grid .featured-card-category {
        font-size: 9px;
        margin-bottom: 4px;
    }
    
    .mobile-products-grid .featured-card-title {
        font-size: 12px;
        min-height: 32px;
        margin-bottom: 6px;
        line-height: 1.35;
    }
    
    /* Price Row for Mobile */
    .mobile-products-grid .featured-card-price-row {
        margin: 6px 0;
        align-items: flex-start;
    }
    
    .mobile-products-grid .featured-card-price {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    
    /* Price lines for mobile */
    .mobile-products-grid .featured-card-price .price-line-1 {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .mobile-products-grid .featured-card-price .price-line-2 {
        display: flex;
        align-items: center;
    }
    
    /* Simple Price Format - Sale Price (ราคาลด) */
    .mobile-products-grid .featured-card-price .sale-price {
        font-size: 16px;
        font-weight: 700;
        color: #ff424e;
    }
    
    /* Simple Price Format - Discount Badge (อยู่หลัง sale-price) */
    .mobile-products-grid .featured-card-price .discount-badge {
        font-size: 9px;
        font-weight: 600;
        color: #fff;
        background: #ff424e;
        padding: 2px 4px;
        border-radius: 3px;
    }
    
    /* Simple Price Format - Regular Price (ราคาเต็มขีดฆ่า) */
    .mobile-products-grid .featured-card-price .regular-price {
        font-size: 10px;
        font-weight: 400;
        color: #999;
        text-decoration: line-through;
    }
    
    /* Simple Price Format - Normal Price (ราคาปกติไม่มีลด) */
    .mobile-products-grid .featured-card-price .normal-price {
        font-size: 14px;
        font-weight: 700;
        color: #1d1d1f;
    }
    
    /* Sold Count for Mobile */
    .mobile-products-grid .sold-count {
        font-size: 9px;
        color: #999;
    }
    
    /* Legacy support for ins/del format */
    .mobile-products-grid .featured-card-price ins {
        font-size: 16px;
        gap: 4px;
        text-decoration: none;
    }
    
    .mobile-products-grid .featured-card-price ins::after {
        font-size: 8px;
        padding: 2px 4px;
    }
    
    .mobile-products-grid .featured-card-price del {
        font-size: 10px;
    }
    
    .mobile-products-grid .featured-card-price > span.woocommerce-Price-amount {
        font-size: 14px;
        font-weight: 700;
        color: #1d1d1f;
    }
    
    .mobile-products-grid .featured-card-button {
        padding: 8px 10px;
        font-size: 11px;
        gap: 4px;
        border-radius: 20px;
    }
    
    .mobile-products-grid .featured-card-button i {
        font-size: 11px;
    }
    
    .mobile-products-grid .featured-card-button span {
        font-size: 11px;
    }
    
    .mobile-products-grid .featured-sale-badge {
        padding: 3px 6px;
        font-size: 9px;
        top: 6px;
        right: 6px;
        border-radius: 3px;
    }
}

/* === SMALL MOBILE (480px and below) === */
@media (max-width: 480px) {
    .mobile-products-grid {
        gap: 8px;
    }
    
    .mobile-products-grid .featured-card-content {
        padding: 8px;
    }
    
    .mobile-products-grid .featured-card-title {
        font-size: 11px;
        min-height: 28px;
    }
    
    /* Simple Price Format - Small Mobile */
    .mobile-products-grid .featured-card-price .sale-price {
        font-size: 14px;
    }
    
    .mobile-products-grid .featured-card-price .discount-badge {
        font-size: 8px;
        padding: 1px 3px;
    }
    
    .mobile-products-grid .featured-card-price .regular-price {
        font-size: 9px;
    }
    
    .mobile-products-grid .featured-card-price .normal-price {
        font-size: 13px;
    }
    
    .mobile-products-grid .sold-count {
        font-size: 8px;
    }
    
    /* Legacy support */
    .mobile-products-grid .featured-card-price ins {
        font-size: 14px;
    }
    
    .mobile-products-grid .featured-card-price del {
        font-size: 9px;
    }
    
    .mobile-products-grid .featured-card-price > span.woocommerce-Price-amount {
        font-size: 13px;
    }
    
    .mobile-products-grid .featured-card-button {
        padding: 6px 8px;
        font-size: 10px;
    }
}
/* ===================================
   FEATURED CARD - Cart + Buy Now Buttons
   =================================== */
.featured-card .shop-btn-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.featured-card .shop-btn-group .btn-add-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    min-width: 46px;
    height: 42px;
    border: 2px solid #325D53;
    background: #ffffff;
    color: #325D53;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    flex-shrink: 0;
}

.featured-card .shop-btn-group .btn-add-cart:hover {
    background: #325D53;
    color: #ffffff;
    transform: translateY(-1px);
}

.featured-card .shop-btn-group .btn-add-cart.added {
    background: #28a745;
    border-color: #28a745;
    color: #ffffff;
}

.featured-card .shop-btn-group .btn-buy-now {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    border: none;
    background: linear-gradient(135deg, #325D53 0%, #24473f 100%);
    color: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.featured-card .shop-btn-group .btn-buy-now:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(50,93,83,0.3);
}

@media (max-width: 768px) {
    .featured-card .shop-btn-group {
        gap: 6px;
        margin-top: 10px;
    }
    
    .featured-card .shop-btn-group .btn-add-cart {
        width: 40px;
        min-width: 40px;
        height: 38px;
        font-size: 14px;
    }
    
    .featured-card .shop-btn-group .btn-buy-now {
        height: 38px;
        font-size: 13px;
    }
}
