/**
 * Coffee Shop V2 - Products Page
 * Modern luxury design with smooth animations
 */

/* ============================================
   PAGE HEADER
   ============================================ */

.products-page-header {
    background: linear-gradient(135deg, #0f1f3d 0%, #1e3a5f 100%);
    padding: 4rem 0 3rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    color: white;
}

.products-page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 50%);
    animation: headerFloat 15s ease-in-out infinite;
}

@keyframes headerFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, 20px); }
}

.products-page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-family: 'Playfair Display', serif;
    position: relative;
    z-index: 2;
    opacity: 1 !important;
    color: #fff;
}

.products-page-header p {
    font-size: 1.1rem;
    opacity: 0.9 !important;
    position: relative;
    z-index: 2;
}

.products-count {
    display: inline-block;
    background: rgba(212, 175, 55, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    font-size: 0.95rem;
    margin-top: 1rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

/* ============================================
   SEARCH & FILTER BAR
   ============================================ */

.filter-bar {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    margin-bottom: 3rem;
    border: 1px solid rgba(27, 77, 62, 0.1);
    transition: all 0.3s ease;
}

.filter-bar:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12);
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .form-control {
    border-radius: 15px;
    border: 2px solid #E8E8E8;
    padding: 0.75rem 3rem 0.75rem 1.25rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input-wrapper .form-control:focus {
    border-color: #d4a574;
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.15);
}

.search-input-wrapper .search-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.sort-select {
    border-radius: 15px;
    border: 2px solid #E8E8E8;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    appearance: none;
}

.sort-select:focus {
    border-color: #d4a574;
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.15);
}

/* ============================================
   SIDEBAR CATEGORIES
   ============================================ */

.category-sidebar {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 100px;
    border: 1px solid rgba(27, 77, 62, 0.1);
}

.category-sidebar h5 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #F0F0F0;
    opacity: 1 !important;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.category-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: #d4a574;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-link:hover {
    background: rgba(27, 77, 62, 0.05);
    color: var(--primary-dark);
    transform: translateX(8px);
}

.category-link:hover::before {
    transform: scaleY(1);
}

.category-link.active {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4f7a 100%);
    color: white;
    box-shadow: 0 5px 20px rgba(27, 77, 62, 0.3);
}

.category-link.active::before {
    display: none;
}

.category-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.clear-filter-btn {
    margin-top: 1.5rem;
    border-radius: 12px;
    padding: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ============================================
   PRODUCTS GRID
   ============================================ */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card-modern {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card-modern:hover {
    transform: translateY(-15px);
    box-shadow: 0 20px 60px rgba(27, 77, 62, 0.15);
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    padding-top: 75%;
    background: #F8F8F8;
}

.product-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card-modern:hover .product-image-wrapper img {
    transform: scale(1.15);
}

.product-badge-sale {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #DC3545, #C82333);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
    z-index: 2;
}

.product-badge-new {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #d4a574, #e6b885);
    color: #0f1f3d;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
    z-index: 2;
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1.5rem;
}

.product-card-modern:hover .product-overlay {
    opacity: 1;
}

.quick-view-btn {
    background: white;
    color: var(--primary-dark);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s ease;
}

.product-card-modern:hover .quick-view-btn {
    transform: translateY(0);
    opacity: 1;
}

.quick-view-btn:hover {
    background: #d4a574;
    color: white;
}

.product-info {
    padding: 1.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
    opacity: 1 !important;
}

.product-title a {
    text-decoration: none;
    color: inherit;
}

.product-title a:hover {
    color: #d4a574;
}

.product-description {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    flex: 1;
    opacity: 1 !important;
}

.product-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #F0F0F0;
}

.product-price-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4a574;
    font-family: 'Playfair Display', serif;
    opacity: 1 !important;
}

.product-price-old-wrapper {
    text-align: right;
}

.product-price-old-main {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
    display: block;
    opacity: 1 !important;
}

.product-stock-badge {
    font-size: 0.85rem;
    color: #666;
    opacity: 1 !important;
}

.product-actions {
    display: grid;
    gap: 0.75rem;
}

.btn-add-cart {
    background: linear-gradient(135deg, #1e3a5f, #2d4f7a);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-add-cart:hover {
    background: linear-gradient(135deg, #2d4f7a, #3a5f8f);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(27, 77, 62, 0.3);
    color: white;
}

.btn-add-cart:active {
    transform: translateY(0);
}

.btn-out-of-stock {
    background: #E0E0E0;
    color: #999;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: not-allowed;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state-modern {
    text-align: center;
    padding: 5rem 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.empty-state-modern i {
    font-size: 5rem;
    color: #d4a574;
    margin-bottom: 2rem;
    opacity: 0.5;
}

.empty-state-modern h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', serif;
    opacity: 1 !important;
}

.empty-state-modern p {
    color: #777;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 1 !important;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination-modern {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.pagination-modern .page-link {
    border: 2px solid #E8E8E8;
    color: #555;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.pagination-modern .page-link:hover {
    border-color: #d4a574;
    background: #d4a574;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

.pagination-modern .page-item.active .page-link {
    background: linear-gradient(135deg, #1e3a5f, #2d4f7a);
    border-color: #1e3a5f;
    color: white;
    box-shadow: 0 5px 20px rgba(27, 77, 62, 0.3);
}

.pagination-modern .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

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

@media (max-width: 1199px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 991px) {
    .products-page-header {
        padding: 3rem 0 2rem;
    }

    .products-page-header h1 {
        font-size: 2rem;
    }

    .filter-bar {
        padding: 1.5rem;
    }

    .category-sidebar {
        position: static;
        margin-bottom: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 767px) {
    .products-page-header h1 {
        font-size: 1.75rem;
    }

    .filter-bar {
        padding: 1.25rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .product-info {
        padding: 1.25rem;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-price-main {
        font-size: 1.25rem;
    }

    .btn-add-cart {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .pagination-modern .page-link {
        padding: 0.5rem 0.875rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 575px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-image-wrapper {
        padding-top: 60%;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.product-card-modern:nth-child(1) { animation-delay: 0.1s; }
.product-card-modern:nth-child(2) { animation-delay: 0.15s; }
.product-card-modern:nth-child(3) { animation-delay: 0.2s; }
.product-card-modern:nth-child(4) { animation-delay: 0.25s; }
.product-card-modern:nth-child(5) { animation-delay: 0.3s; }
.product-card-modern:nth-child(6) { animation-delay: 0.35s; }

/* ============================================
   LOADING STATE
   ============================================ */

.products-loading {
    display: none;
    text-align: center;
    padding: 3rem;
}

.products-loading.active {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #F0F0F0;
    border-top: 4px solid #d4a574;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
