:root {
    --primary-color: #ee4d2d;
    --primary-hover: #d73a1e;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --bg-main: #F9FAFB;
    --bg-card: #FFFFFF;
    --border-color: #E5E7EB;
    --badge-bg: #fff0ed;
    --badge-text: #ee4d2d;

    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background-color: var(--primary-color);
    padding: 1.25rem 0;
    /* Membuat header agak tinggi sedikit */
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: white;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    gap: 0.5rem;
}

.search-icon {
    color: #666;
    width: 18px;
    height: 18px;
}

.camera-icon {
    color: #666;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    padding: 0;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: #ee4d2d;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.action-btn {
    position: relative;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background-color: white;
    color: var(--primary-color);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 4px;
    border-radius: 10px;
    border: 1px solid var(--primary-color);
}

/* Main Content */
.main-content {
    padding: 0.5rem 0.5rem;
    min-height: calc(100vh - 60px);
    background-color: #f5f5f5;
}

/* Grid Layout (Mobile First: 2 columns) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* Tablet: 3 columns */
@media (min-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop: 4 columns */
@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
}

/* Large Desktop: 5 columns */
@media (min-width: 1280px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Product Card */
.product-card {
    background-color: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-img-wrapper {
    position: relative;
    padding-top: 100%;
    /* 1:1 Aspect Ratio (Square) */
    overflow: hidden;
    background-color: #f3f4f6;
}

.product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #fff;
}

.discount-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #ffeedf;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 4px;
    z-index: 2;
}

.product-content {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--badge-bg);
    color: var(--badge-text);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-self: flex-start;
}

.product-title {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}

/* Modal / Overlay Filter CSS */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-modal {
    background-color: white;
    width: 90%;
    max-width: 400px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-header h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.filter-body {
    padding: 1.5rem;
}

#category-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cat-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 99px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.cat-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cat-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

/* Utility / Status States */
.loading-container,
.error-container {
    text-align: center;
    padding: 4rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 0;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}