/* ============================================================
   TABBED CATEGORY PRODUCTS SECTION  v2
   File: supgor-child/assets/css/addtocartcategory-products.css
   Changes: Image tabs, fixed button loading/success states
   ============================================================ */

/* ---------- CSS VARIABLES ---------- */
.cps-section {
    --cps-bg:         #fdf8f0;
    --cps-text:       #2c1810;
    --cps-accent:     #4a1942;
    --cps-btn-bg:     #7c3aed;
    --cps-btn-hover:  #6d28d9;
    --cps-border:     #e8ddd0;
    --cps-card-bg:    #ffffff;
    --cps-tab-active: #3d1535;
    --cps-star:       #f59e0b;
    --cps-sale:       #dc2626;
    --cps-radius:     12px;
    --cps-shadow:     0 2px 16px rgba(60,20,50,0.08);
    --cps-font:       'Poppins', 'Segoe UI', sans-serif;
}

/* ---------- SECTION ---------- */
.cps-section {
    width: 100%;
    padding: 60px 0 70px;
    background: var(--cps-bg);
    font-family: var(--cps-font);
}

.cps-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- TAGLINE ---------- */
.cps-tagline {
    text-align: center;
    font-size: 22px;
    font-weight: 400;
    color: var(--cps-text);
    margin: 0 0 36px 0;
    font-style: italic;
    letter-spacing: 0.2px;
    opacity: 0;
    animation: cps-fade-up 0.6s ease 0.1s forwards;
}

/* ---------- TABS WRAPPER ---------- */
.cps-tabs-wrap {
    position: relative;
    margin-bottom: 36px;
    opacity: 0;
    animation: cps-fade-up 0.6s ease 0.2s forwards;
}

.cps-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0 8px;
    border-bottom: 2px solid var(--cps-border);
}

.cps-tabs::-webkit-scrollbar { display: none; }

/* ---------- SINGLE TAB ---------- */
.cps-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.25s ease;
    border-radius: 8px 8px 0 0;
    min-width: 80px;
}

/* ---------- TAB ICON CIRCLE (image container) ---------- */
.cps-tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f5ede8;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

/* Tab image */
.cps-tab-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    transition: transform 0.3s ease;
    display: block;
}

/* Active + hover states for circle */
.cps-tab:hover .cps-tab-icon {
    background: #f0e0ec;
    border-color: rgba(61,21,53,0.3);
    box-shadow: 0 4px 14px rgba(61,21,53,0.12);
}

.cps-tab-active .cps-tab-icon {
    background: #f0e0ec;
    border-color: var(--cps-tab-active);
    box-shadow: 0 4px 18px rgba(61,21,53,0.2);
}

/* Image zoom on hover / active */
.cps-tab:hover .cps-tab-img {
    transform: scale(1.18) translateY(-2px);
}

.cps-tab-active .cps-tab-img {
    transform: scale(1.12);
}

/* ---------- TAB LABEL ---------- */
.cps-tab-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 0.2px;
    text-align: center;
    white-space: nowrap;
    transition: color 0.25s ease;
    line-height: 1.3;
    max-width: 90px;
    word-break: break-word;
    white-space: normal;
}

.cps-tab:hover .cps-tab-label,
.cps-tab-active .cps-tab-label {
    color: var(--cps-tab-active);
    font-weight: 700;
}

/* Active underline indicator */
.cps-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: var(--cps-tab-active);
    border-radius: 3px 3px 0 0;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.cps-tab-active::after {
    transform: scaleX(1);
}

/* ---------- TAB SCROLL ARROWS (mobile) ---------- */
.cps-tab-arrow {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-65%);
    width: 30px;
    height: 30px;
    background: #fff;
    border: 1px solid var(--cps-border);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 5;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    color: var(--cps-text);
    line-height: 1;
    padding: 0;
}

.cps-tab-prev { left: -6px; }
.cps-tab-next { right: -6px; }

@media (max-width: 768px) {
    .cps-tab-arrow { display: flex; }
    .cps-tabs { padding: 4px 20px 8px; }
}

/* ---------- PRODUCTS WRAP ---------- */
.cps-products-wrap { min-height: 380px; position: relative; }

/* ---------- PRODUCTS GRID ---------- */
.cps-products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

/* ---------- SINGLE PRODUCT CARD ---------- */
.cps-product-card {
    background: var(--cps-card-bg);
    border-radius: var(--cps-radius);
    border: 1px solid var(--cps-border);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    animation: cps-card-in 0.4s ease forwards;
}

.cps-product-card:nth-child(1)  { animation-delay: 0.05s; }
.cps-product-card:nth-child(2)  { animation-delay: 0.10s; }
.cps-product-card:nth-child(3)  { animation-delay: 0.15s; }
.cps-product-card:nth-child(4)  { animation-delay: 0.20s; }
.cps-product-card:nth-child(5)  { animation-delay: 0.25s; }
.cps-product-card:nth-child(6)  { animation-delay: 0.30s; }
.cps-product-card:nth-child(7)  { animation-delay: 0.35s; }
.cps-product-card:nth-child(8)  { animation-delay: 0.40s; }
.cps-product-card:nth-child(9)  { animation-delay: 0.45s; }
.cps-product-card:nth-child(10) { animation-delay: 0.50s; }

@keyframes cps-card-in {
    to { opacity: 1; transform: translateY(0); }
}

.cps-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(60,20,50,0.14);
    border-color: #d0b8c8;
}

/* Sale badge */
.cps-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--cps-sale);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    z-index: 2;
}

/* Image */
.cps-card-img-wrap {
    background: #faf6f2;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 190px;
    overflow: hidden;
}

.cps-card-img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
    transition: transform 0.4s ease;
    display: block;
}

.cps-product-card:hover .cps-card-img {
    transform: scale(1.08);
}

/* Card body */
.cps-card-body {
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

/* Title */
.cps-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--cps-text);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
    margin: 0;
}

.cps-card-title:hover { color: var(--cps-accent); }

/* Stars */
.cps-card-stars {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cps-stars-display {
    color: var(--cps-star);
    font-size: 13px;
    letter-spacing: 1px;
}

.cps-rating-count { font-size: 11px; color: #999; }

/* Price */
.cps-card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--cps-text);
    margin-top: auto;
}

.cps-card-price del {
    font-size: 12px;
    color: #aaa;
    font-weight: 400;
    margin-right: 4px;
}

.cps-card-price ins {
    text-decoration: none;
    color: var(--cps-text);
}

/* ---------- ADD TO CART BUTTON ---------- */
.cps-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px 14px;
    background: var(--cps-btn-bg);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    margin-top: 10px;
    transition: background 0.25s ease, transform 0.2s ease;
    letter-spacing: 0.3px;
    font-family: var(--cps-font);
    min-height: 40px;
}

.cps-add-to-cart:hover:not(:disabled) {
    background: var(--cps-btn-hover);
    color: #fff;
    transform: translateY(-1px);
}

/* Loading state */
.cps-add-to-cart.cps-btn-loading {
    background: #7a5070;
    cursor: not-allowed;
}

/* Success state */
.cps-add-to-cart.cps-btn-success {
    background: #16a34a !important;
    color: #fff;
}

/* Spinner inside button (injected by JS) */
.cps-btn-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cpsSpin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes cpsSpin { to { transform: rotate(360deg); } }

/* ---------- SKELETON LOADERS ---------- */
.cps-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.cps-skeleton-card {
    background: #fff;
    border-radius: var(--cps-radius);
    border: 1px solid var(--cps-border);
    padding: 20px 14px 16px;
}

.cps-skel {
    background: linear-gradient(90deg, #f0e8e0 25%, #faf4ee 50%, #f0e8e0 75%);
    background-size: 200% 100%;
    animation: cps-shimmer 1.4s infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}

.cps-skel-img   { height: 150px; border-radius: 8px; margin-bottom: 14px; }
.cps-skel-title { height: 13px; width: 100%; }
.cps-skel-short { width: 65%; }
.cps-skel-stars { height: 12px; width: 80%; }
.cps-skel-price { height: 18px; width: 40%; }
.cps-skel-btn   { height: 40px; border-radius: 8px; margin-top: 4px; }

@keyframes cps-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- EMPTY STATE ---------- */
.cps-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.cps-empty span { font-size: 48px; display: block; margin-bottom: 12px; }
.cps-empty p    { font-size: 15px; }

/* ---------- VIEW ALL ---------- */
.cps-view-all-wrap {
    text-align: center;
    margin-top: 36px;
}

.cps-view-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: transparent;
    border: 2px solid var(--cps-btn-bg);
    color: var(--cps-btn-bg);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
    letter-spacing: 0.5px;
}

.cps-view-all:hover {
    background: var(--cps-btn-bg);
    color: #fff;
}

.cps-view-all svg { transition: transform 0.2s ease; }
.cps-view-all:hover svg { transform: translateX(4px); }

/* ---------- ANIMATIONS ---------- */
@keyframes cps-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
    .cps-products-grid,
    .cps-skeleton-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
    .cps-products-grid,
    .cps-skeleton-grid { grid-template-columns: repeat(3, 1fr); }
    .cps-tagline       { font-size: 18px; }
    .cps-tab-icon      { width: 52px; height: 52px; }
    .cps-tab-img       { width: 32px; height: 32px; }
}

@media (max-width: 640px) {
    .cps-products-grid,
    .cps-skeleton-grid { grid-template-columns: repeat(2, 1fr); }
    .cps-card-img-wrap { height: 150px; padding: 14px; }
    .cps-tagline       { font-size: 15px; }
    .cps-tab-icon      { width: 46px; height: 46px; }
    .cps-tab-img       { width: 28px; height: 28px; }
    .cps-tab           { padding: 8px 10px 12px; min-width: 70px; }
}

@media (max-width: 400px) {
    .cps-products-grid,
    .cps-skeleton-grid { grid-template-columns: repeat(2, 1fr); }
    .cps-container     { padding: 0 12px; }
}