/* --- Professional App-Style CSS --- */
:root {
    --nx-primary: #0044cc;
    --nx-accent: #ff0000;
    --nx-bg: #f8f9fa;
    --nx-card: #ffffff;
    --nx-text-main: #2d3436;
    --nx-text-sub: #636e72;
    --nx-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--nx-bg);
    color: var(--nx-text-main);
    overflow-x: hidden;
    padding-bottom: 20px; /* Space for footer */
}

/* --- Container --- */
.custom-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 8px; /* App-style narrow padding */
}

/* --- Section Headers --- */
.nx-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5px 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nx-header-icon img {
    width: 24px;
    height: 24px;
    animation: pulse 2s infinite;
}

.nx-section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--nx-text-main);
}

.nx-view-all-btn {
    font-size: 12px;
    color: var(--nx-primary);
    text-decoration: none;
    font-weight: 600;
    background: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: var(--nx-shadow);
}

/* --- Grid System (3 Columns on Mobile) --- */
.nx-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* FORCED 3 COLUMNS */
    gap: 6px; /* Tight gap for app look */
    width: 100%;
}

/* --- Product Card (App UI) --- */
.nx-product-card {
    background: var(--nx-card);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--nx-shadow);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease backwards;
}

.nx-product-card:active {
    transform: scale(0.95); /* Touch feedback */
}

.nx-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* --- Badges --- */
.nx-discount-badge, .nx-hot-label {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--nx-accent);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    z-index: 2;
}

/* --- Image Area --- */
.nx-img-container {
    width: 100%;
    aspect-ratio: 1/1;
    background: #f1f2f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nx-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* --- Info Area --- */
.nx-product-info {
    padding: 8px 6px;
    background: #fff;
}

.nx-product-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--nx-text-main);
    line-height: 1.3;
    height: 28px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}

.nx-price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nx-current-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--nx-accent);
}

.nx-current-price.nx-blue { color: var(--nx-primary); }
.nx-current-price.dark { color: #000; }

.nx-old-price {
    font-size: 9px;
    color: var(--nx-text-sub);
    text-decoration: line-through;
}

/* --- App Style Tags --- */
.nx-shipping-tag {
    font-size: 8px;
    color: #2ecc71;
    background: #eafaf1;
    display: inline-block;
    padding: 1px 4px;
    border-radius: 4px;
    margin-top: 4px;
}

.nx-rating-box {
    font-size: 8px;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.nx-stars { color: #f1c40f; }
.nx-rating-count { color: var(--nx-text-sub); }

/* --- PC/Tablet Responsiveness --- */
@media (min-width: 600px) {
    .nx-product-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .nx-product-title { font-size: 13px; height: 34px; }
    .nx-current-price { font-size: 15px; }
}

@media (min-width: 1024px) {
    .nx-product-grid { grid-template-columns: repeat(6, 1fr); gap: 20px; }
    .custom-container { padding: 0 15px; }
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Grid animation delay for items */
.nx-product-card:nth-child(1) { animation-delay: 0.1s; }
.nx-product-card:nth-child(2) { animation-delay: 0.2s; }
.nx-product-card:nth-child(3) { animation-delay: 0.3s; }
