/* ==========================================
   MINI PRODUCT PREVIEW - INDEX PAGE
   ========================================== */

.index-products-preview {
    position: relative;
    padding: 2rem 0 5vw;
    background: #040000;
    overflow: hidden;
}

.index-products-preview::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 100%;
    background: radial-gradient(ellipse at center top, rgba(230, 0, 0, 0.06) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

.preview-container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* --- HEADER --- */
.preview-header {
    text-align: center;
    margin-bottom: 2rem;
}

.preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem;
    background: rgba(230, 0, 0, 0.1);
    border: 1px solid rgba(230, 0, 0, 0.22);
    border-radius: 50px;
    color: #ff4d4d;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 1.2rem;
}

.preview-title {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 0.8rem 0;
    line-height: 1.15;
}

.preview-title .text-red { color: #E60000; }

.preview-desc {
    color: #777;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    max-width: 540px;
    margin: 0 auto;
}

/* --- PRODUCT GRID --- */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 3vw;
}

/* --- PRODUCT CARD (INDEX) --- */
.idx-product-card {
    background: #121212;
    border: 1px solid #2C2C2C;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
    position: relative;
}

.idx-product-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #E60000;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7), 0 0 22px rgba(230, 0, 0, 0.18);
    z-index: 5;
}

.idx-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #1a1a1a;
    overflow: hidden;
}

.idx-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.idx-product-card:hover .idx-card-image img {
    transform: scale(1.1);
    filter: brightness(1.08);
}

.idx-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(230, 0, 0, 0.9);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 3;
}

.idx-card-quality {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(18, 18, 18, 0.85);
    border: 1px solid #2C2C2C;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 4px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
}

.idx-card-quality i { color: #FFD700; font-size: 0.6rem; }

.idx-card-broken {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #555;
    text-align: center;
    font-size: 0.8rem;
    z-index: 2;
    background: #161616;
}

.idx-card-broken i { font-size: 1.8rem; opacity: 0.4; margin-bottom: 6px; }

/* --- CARD BODY --- */
.idx-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.idx-card-cat {
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.idx-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e8e8e8;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.idx-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #1e1e1e;
}

.idx-card-price {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    transition: color 0.3s ease, transform 0.3s ease;
}

.idx-product-card:hover .idx-card-price {
    color: #FF1A1A;
    transform: scale(1.08);
}

.idx-card-btn {
    background: transparent;
    border: 1px solid #2C2C2C;
    color: #aaa;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
}

.idx-product-card:hover .idx-card-btn {
    background: #E60000;
    border-color: #E60000;
    color: #fff;
    box-shadow: 0 4px 12px rgba(230, 0, 0, 0.35);
}

/* --- LOADING STATE --- */
.preview-skeleton {
    background: #121212;
    border: 1px solid #1e1e1e;
    border-radius: 14px;
    overflow: hidden;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.preview-skeleton-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #1a1a1a;
}

.preview-skeleton-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-skeleton-line {
    height: 10px;
    border-radius: 4px;
    background: #1e1e1e;
}

.preview-skeleton-line.w-60 { width: 60%; }
.preview-skeleton-line.w-80 { width: 80%; }
.preview-skeleton-line.w-40 { width: 40%; }

@keyframes skeletonPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- ERROR STATE --- */
.preview-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: #555;
}

.preview-error i {
    font-size: 2.5rem;
    margin-bottom: 14px;
    opacity: 0.4;
    display: block;
}

/* --- FOOTER / CTA --- */
.preview-footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.preview-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: transparent;
    border: 1.5px solid #E60000;
    color: #fff;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
    font-family: 'Poppins', sans-serif;
}

.preview-cta-btn:hover {
    background: #E60000;
    box-shadow: 0 8px 25px rgba(230, 0, 0, 0.35);
    transform: translateY(-2px);
}

.preview-cta-btn i {
    transition: transform 0.3s ease;
}

.preview-cta-btn:hover i {
    transform: translateX(4px);
}

.preview-count-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: rgba(255,255,255,0.03);
    border: 1px solid #2C2C2C;
    border-radius: 8px;
    color: #666;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

.preview-count-chip strong { color: #ccc; }

.idx-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.idx-kakobuy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #2C2C2C;
    transition: all 0.25s ease;
    flex-shrink: 0;
    text-decoration: none;
}

.idx-kakobuy-btn img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 3px;
}

.idx-kakobuy-btn:hover {
    background: rgba(255, 193, 7, 0.12);
    border-color: rgba(255, 193, 7, 0.4);
    transform: scale(1.1);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1100px) {
    .preview-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .index-products-preview { padding: 12vw 0 8vw; }
    .preview-header { margin-bottom: 6vw; }
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .preview-grid .idx-product-card:nth-child(n+7) { display: none; }
}

@media (max-width: 480px) {
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .preview-grid .idx-product-card:nth-child(n+5) { display: none; }
    .idx-card-name { font-size: 0.8rem; }
    .idx-card-price { font-size: 0.9rem; }
}
