/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* Navigation */
nav {
    padding: 0 !important;
    margin: 0 !important;
}

nav .container {
    padding: 0 1rem !important;
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: #000;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

/* Category Filters */
.category-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.3s ease;
    background-color: white;
}

.category-btn:hover {
    background-color: #f3f4f6;
}

.category-btn.active {
    background-color: black;
    color: white;
    border-color: black;
}

/* Category More Menu */
.category-more-menu {
    max-height: 80vh;
    overflow-y: auto;
}

.category-more-menu::-webkit-scrollbar {
    width: 6px;
}

.category-more-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.category-more-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.category-more-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.more-category-btn {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.3s ease;
    text-align: center;
    background-color: white;
    width: 100%;
}

.more-category-btn:hover {
    background-color: #f3f4f6;
}

.more-category-btn.active {
    background-color: black;
    color: white;
    border-color: black;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin: 0;
}

@media (max-width: 1280px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* Product Card */
.product-card {
    cursor: pointer;
    transition: transform 0.3s ease;
    background-color: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
}

.product-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Product Image Container */
.product-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Square aspect ratio */
    background-color: #f9fafb;
    overflow: hidden;
}

.product-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image-container img {
    transform: scale(1.05);
}

/* Product Info */
.product-info {
    padding: 1rem;
}

.product-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    color: #000;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.5em;
}

.product-category {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0.5rem 0 0;
    text-transform: uppercase;
}

/* Price Display */
.price-info {
    margin: 0.5rem 0 0;
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0;
    flex-wrap: wrap;
}

.original-price {
    text-decoration: line-through;
    color: #6b7280;
    font-size: 0.875rem;
}

.discounted-price {
    color: #dc2626;
    font-weight: 600;
    font-size: 0.875rem;
}

.regular-price {
    font-size: 0.875rem;
    font-weight: 500;
    color: #000;
}

.discount-badge {
    display: inline-block;
    background-color: #dc2626;
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Search Input */
.search-input {
    transition: width 0.3s ease;
}

.search-input:focus {
    width: 300px;
}

/* WhatsApp Button */
.whatsapp-btn {
    transition: all 0.3s ease;
    z-index: 50;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
}

/* Overlay */
.overlay {
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

/* Product Header */
.product-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.product-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: left;
    flex-shrink: 0; /* Pastikan "SHOP" tidak menyusut */
}

#products-count {
    color: #4b5563;
    font-size: 0.875rem;
    margin-right: auto; /* Dorong elemen berikutnya ke kanan */
}

#sort-select {
    min-width: 180px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

#sort-select:focus {
    outline: none;
    border-color: #000;
}

.product-header > div:first-child {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.product-header > div:last-child {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: flex-end;
    margin-left: auto;
    white-space: nowrap;
}

#products-count {
    color: #4b5563;
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

@media (max-width: 768px) {
    .product-header {
        flex-direction: row;
        align-items: center;
        margin-bottom: 1rem;
    }

    .product-header h2 {
        margin: 0;
        line-height: 1;
    }

    .product-header > div:last-child {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        margin-left: auto;
    }

    #products-count {
        font-size: 0.875rem;
        line-height: 1;
        margin-right: 0;
    }
}

@media (max-width: 640px) {
    .product-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .product-header h2 {
        margin: 0 0 0.5rem 0;
    }

    .product-header > div:last-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        width: 100%;
        margin-left: 0;
    }
}

/* Sort Select */
#sort-select {
    min-width: 180px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

#sort-select:focus {
    outline: none;
    border-color: #000;
}
