﻿/* Reset and Base Styles */
body {
    font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    width: 100%;
    overflow-x: hidden;
}

/* ===== HERO SECTION ===== */
.hero-section {
    padding: 48px 50px 32px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0;
    background: #fff;
}

.hero-inner {
    max-width: 112.5rem;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}

.hero-eyebrow {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #ff5943;
    margin-bottom: 10px;
    display: block;
}

.hero-title {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 3.2rem;
    font-weight: 900;
    color: #000;
    text-transform: uppercase;
    letter-spacing: -.02em;
    line-height: 1;
    margin: 0 0 10px;
}

.hero-sub {
    font-size: .8rem;
    color: #888;
    margin: 0;
    letter-spacing: .03em;
}

.hero-right {
    flex-shrink: 0;
}

.hero-search-wrap {
    position: relative;
    width: 280px;
}

.hero-search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: .85rem;
    color: #111;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    outline: none;
    transition: border-color .25s;
    letter-spacing: .02em;
}

    .hero-search-input::placeholder {
        color: #aaa;
        font-size: .8rem;
    }

    .hero-search-input:focus {
        border-color: #111;
    }

.hero-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color .2s;
}

    .hero-search-btn:hover {
        color: #111;
    }

/* ===== PRODUCTS SECTION ===== */
.products-section {
    position: relative;
    z-index: 10;
    margin-left: -20px;
    margin-right: -20px;
}

.products-container {
    max-width: 112.5rem;
    margin: 0 auto;
    padding: 1.2rem 50px 20px;
}

/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
}

.results-count {
    color: #7f8c8d;
    font-weight: 400;
    white-space: nowrap;
}

/* ===== PRODUCT GRID ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

/* ===== PRODUCT CARD ===== */
.product-card {
    background: white;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    transition: all 0.3s ease;
    position: relative;
    width: 100%;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    min-height: 350px;
    border: 1px solid rgba(128, 128, 128, 0.17);
}

    .product-card:hover {
        text-decoration: none;
        color: inherit;
    }

    .product-card.out-of-stock {
        cursor: not-allowed;
        opacity: 0.7;
    }

        .product-card.out-of-stock:hover {
            transform: none;
            box-shadow: none;
        }

    /* Initial Load Animation */
    .product-card.initial-load {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        animation: productCardFadeIn 0.6s ease forwards;
        animation-delay: calc(0.3s + var(--delay, 0s));
    }

@keyframes productCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== PRODUCT IMAGE CONTAINER ===== */
.product-image-container {
    position: relative;
    overflow: hidden;
    background: #f7f7f7;
    flex-shrink: 0;
    aspect-ratio: 4 / 5;
    width: 100%;
}

    .product-image-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: opacity 0.4s ease;
        position: absolute;
        top: 0;
        left: 0;
    }

    .product-image-container .primary-image {
        opacity: 1;
        z-index: 1;
    }

    .product-image-container .secondary-image {
        opacity: 0;
        z-index: 2;
    }

/* Desktop: swap ảnh khi hover */
@media (min-width: 769px) {
    .product-card:hover .product-image-container .primary-image {
        opacity: 0;
    }

    .product-card:hover .product-image-container .secondary-image {
        opacity: 1;
    }
}

/* ===== PRODUCT BADGES ===== */
.product-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 5;
}

    .product-badges .badge {
        font-size: 0.65rem;
        padding: 3px 6px;
        border-radius: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

.badge.bg-danger {
    background: #ff5943 !important;
    color: white !important;
}

.badge.bg-success {
    background: #ff6b35 !important;
    color: white !important;
}

/* ===== CARD BODY ===== */
.card-body {
    padding: 12px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 60px;
    overflow: hidden;
}

/* ===== CARD TITLE ===== */
.card-title {
    font-size: 15px;
    color: #111;
    line-height: 1.4;
    margin: 0;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    text-align: left;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== QUICK VIEW — trong card-body ===== */
.product-quick-view {
    height: 28px;
    display: flex;
    align-items: center;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    margin-top: 6px;
}

    .product-quick-view span {
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #ff5943;
    }

/* Hover: title nhích lên, quick view trượt lên */
.product-card:hover .card-title {
    transform: translateY(-4px);
}

.product-card:hover .product-quick-view {
    transform: translateY(0);
    opacity: 1;
}

/* ===== OUT OF STOCK ===== */
.out-of-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.out-of-stock-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: #ff5943;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
    z-index: 2;
    white-space: nowrap;
}

/* ===== INFINITE SCROLL ===== */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    font-size: 16px;
    color: #666;
}

    .loading-indicator .spinner {
        width: 20px;
        height: 20px;
        border: 3px solid #f3f3f3;
        border-top: 3px solid #ff5943;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.no-more-products {
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
    font-size: 16px;
}

    .no-more-products i {
        font-size: 24px;
        margin-bottom: 10px;
        display: block;
        opacity: 0.5;
    }

/* ===== CARD ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card.fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

.product-card.loading-new {
    opacity: 0;
    transform: translateY(30px);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 20px;
    margin: 40px 0;
    grid-column: 1 / -1;
}

    .empty-state i {
        font-size: 4rem;
        color: #bdc3c7;
        margin-bottom: 20px;
        display: block;
    }

    .empty-state h4 {
        color: #7f8c8d;
        font-weight: 600;
        margin-bottom: 10px;
    }

    .empty-state p {
        color: #95a5a6;
        font-size: 1rem;
        margin: 0;
    }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .products-container {
        padding: 2rem 30px 20px;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-card {
        min-height: 320px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .product-badges .badge {
        font-size: 0.6rem;
        padding: 2px 5px;
    }
}

@media (max-width: 768px) {
    .products-container {
        padding: 2rem 20px 20px;
    }

    .results-info {
        flex-direction: row;
        gap: 15px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-card {
        min-height: 280px;
    }

    .card-body {
        padding: 12px;
        min-height: 50px;
    }

    .card-title {
        font-size: 14px;
    }

    .product-badges .badge {
        font-size: 0.55rem;
        padding: 2px 4px;
    }
    /* Mobile: quick view luôn hiện */
    .product-quick-view {
        transform: translateY(0);
        opacity: 1;
    }

    .product-card:hover .card-title {
        transform: translateY(0);
    }

    html, body {
        width: 100%;
        max-width: 100%;
        position: relative;
    }

    .hero-section {
        padding: 32px 20px 24px;
    }

    .hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .hero-search-wrap {
        width: 100%;
    }

    .hero-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .results-info {
        flex-direction: column;
        gap: 15px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-card {
        min-height: 250px;
    }

    .card-body {
        padding: 10px;
        min-height: 45px;
    }

    .card-title {
        font-size: 14px;
        line-height: 1.2;
    }

    .results-count {
        font-size: 0.75rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }
}
