* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, rgb(50, 168, 82) 0%, #764ba2 100%);
    height: 100vh;
    padding: 20px;
    color: #333;
    overflow: hidden;
}

.container {
    max-width: 95%;
    margin: 0 auto;
    height: 95%;
    display: flex;
    flex-direction: column;
    transform: scale(.95);
    transform-origin: top center;
}

.content-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    padding-top: 0;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

header {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 20px;
    z-index: 100;
    flex-shrink: 0;
}

.header-wrapper {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.header-left {
    flex: 0 0 80%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header-right {
    flex: 0 0 20%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
}

header h1 {
    font-size: 2.5rem;
    margin: 0;
    background: linear-gradient(135deg, rgb(50, 168, 82) 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-icons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.cart-container {
    position: relative;
}

.user-container {
    position: relative;
}

.cart-header-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s ease;
}

.cart-header-button:hover {
    transform: scale(1.1);
}

.cart-header-button svg {
    width: 28px;
    height: 28px;
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, rgb(50, 168, 82) 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid white;
}

.user-menu-container {
    position: relative;
}

.user-header-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s ease;
}

.user-header-button:hover {
    transform: scale(1.1);
}

.user-header-button svg {
    width: 28px;
    height: 28px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    overflow: hidden;
    z-index: 1000;
    animation: fadeInDropdown 0.2s ease;
}

.dropdown-username {
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    background: linear-gradient(135deg, rgba(50, 168, 82, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    width: 100%;
    padding: 14px 20px;
    border: none;
    background: white;
    text-align: left;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: inherit;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(50, 168, 82, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.dropdown-item svg {
    flex-shrink: 0;
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.search-container {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-container .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #999;
    pointer-events: none;
}

#searchInput {
    flex: 1;
    padding: 15px 15px 15px 50px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
}

#searchInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#searchInput::placeholder {
    color: #999;
}

.search-button {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, rgb(50, 168, 82) 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.search-button:active {
    transform: translateY(0);
}

.sidebar {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.sidebar h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgb(50, 168, 82) 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    padding-right: 5px;
}

/* Custom scrollbar for category list */
.category-list::-webkit-scrollbar {
    width: 6px;
}

.category-list::-webkit-scrollbar-track {
    background: transparent;
}

.category-list::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, rgb(50, 168, 82) 0%, #764ba2 100%);
    border-radius: 10px;
}

.category-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgb(45, 150, 75) 0%, #6a3d8f 100%);
}

/* Firefox scrollbar styling for category list */
.category-list {
    scrollbar-width: thin;
    scrollbar-color: rgb(50, 168, 82) transparent;
}

.category-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

/* Recommendations Section */
.recommendations-section {
    margin-top: 12px;
}

.view-recommendations-button {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: #333;
    text-align: left;
    user-select: none;
}

.view-recommendations-button:hover {
    background-color: #f5f5f5;
}

.view-recommendations-button svg {
    flex-shrink: 0;
}

.category-checkbox-label:hover {
    background-color: #f5f5f5;
}

.category-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: rgb(50, 168, 82);
    flex-shrink: 0;
}

.category-checkbox-label span {
    font-size: 1rem;
    color: #333;
    flex: 1;
}

main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

/* Custom scrollbar styling */
main::-webkit-scrollbar {
    width: 8px;
}

main::-webkit-scrollbar-track {
    background: transparent;
}

main::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, rgb(50, 168, 82) 0%, #764ba2 100%);
    border-radius: 10px;
    border: none;
}

main::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgb(45, 150, 75) 0%, #6a3d8f 100%);
}

/* Firefox scrollbar styling */
main {
    scrollbar-width: thin;
    scrollbar-color: rgb(50, 168, 82) transparent;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-top: 20px;
    padding-right: 8px;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.product-thumbnail {
    width: 100%;
    flex: 1;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 0;
    margin-top: auto;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(50, 168, 82, 0.5) 0%, rgba(118, 75, 162, 0.5) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
    z-index: 5;
}

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

/* Flash animation for adding to cart */
@keyframes flashWhite {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 0 0 30px 10px rgba(255, 255, 255, 1), inset 0 0 20px 10px rgba(255, 255, 255, 0.8);
        background: rgba(255, 255, 255, 0.5);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
        background: transparent;
    }
}

.product-card.flash-white {
    animation: flashWhite 0.2s ease-out;
}

.product-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    position: relative;
    z-index: 1;
    max-height: 3.9rem; /* Limit to ~3 lines (1.3rem * 1.2 line-height * 3 lines) */
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    mask-image: linear-gradient(to bottom, black 35%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 35%, transparent 100%);
}

.product-category {
    display: inline-block;
    background: linear-gradient(135deg, rgb(50, 168, 82) 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
    text-transform: capitalize;
    position: relative;
    z-index: 1;
}

.product-description {
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
}


.no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.no-results p {
    font-size: 1.2rem;
    color: #999;
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
}

.pagination-button {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-button:hover:not(:disabled) {
    border-color: rgb(50, 168, 82);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pagination-button:hover:not(:disabled) svg {
    stroke: rgb(50, 168, 82);
}

.pagination-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-button svg {
    transition: stroke 0.3s ease;
}

.page-info {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    min-width: 120px;
    text-align: center;
}


@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .search-button {
        width: 100%;
    }
    
    .content-wrapper {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-width: auto;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
}


