/* ============================
   Mento Goods - Products Page Styles
   ============================ */

/* Product Filters */
.product-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    border: 2px solid var(--brand-line);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    z-index: 150;
}

.product-filters:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand-accent);
}

.search-container {
    display: flex;
    flex: 1;
    min-width: 250px;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--brand-line);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    background: white;
    font-family: inherit;
    font-size: 0.9375rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.15);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: rgba(17, 17, 17, 0.4);
}

.search-btn {
    padding: 0.75rem 1.25rem;
    background: var(--brand-accent);
    color: white;
    border: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.search-btn:hover::before {
    width: 300px;
    height: 300px;
}

.search-btn:hover {
    background: color-mix(in srgb, var(--brand-accent) 85%, black);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.3);
}

.search-btn:active {
    transform: translateY(0);
}

.search-icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
}

.filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-badge {
    padding: 0.5rem 1.25rem;
    background: white;
    color: rgba(17, 17, 17, 0.7);
    border: 2px solid var(--brand-line);
    border-radius: var(--radius-xl);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.filter-badge::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: var(--brand-accent);
    transition: height 0.3s ease;
    z-index: -1;
}

.filter-badge:hover::after {
    height: 100%;
}

.filter-badge:hover {
    color: white;
    border-color: var(--brand-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(107, 68, 35, 0.2);
}

.filter-badge.active {
    background: var(--brand-accent);
    color: white;
    border-color: var(--brand-accent);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.3);
    transform: scale(1.05);
}

.filter-badge.active::after {
    height: 100%;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.sort-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(17, 17, 17, 0.7);
}

/* Custom Select */
.custom-select {
    position: relative;
    min-width: 220px;
    user-select: none;
    z-index: 200;
}

.custom-select-trigger {
    padding: 0.65rem 2.5rem 0.65rem 1rem;
    border: 2px solid var(--brand-line);
    border-radius: var(--radius-xl);
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.custom-select-trigger:hover {
    border-color: var(--brand-accent);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.15);
    transform: translateY(-1px);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--brand-accent);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.2);
}

.custom-select-arrow {
    transition: transform 0.3s ease;
    color: var(--brand-accent);
    flex-shrink: 0;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--brand-accent);
    border-top: none;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: 0 8px 24px rgba(107, 68, 35, 0.2);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 250;
}

.custom-select.open .custom-select-options {
    max-height: 300px;
    opacity: 1;
    overflow-y: auto;
}

.custom-option {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.custom-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-accent) 0%, var(--brand-accent2) 100%);
    transition: width 0.3s ease;
    z-index: -1;
}

.custom-option:hover::before {
    width: 100%;
}

.custom-option:hover {
    color: white;
    padding-left: 1.25rem;
}

.custom-option.active {
    background: linear-gradient(90deg, rgba(107, 68, 35, 0.1) 0%, rgba(160, 104, 56, 0.1) 100%);
    color: var(--brand-accent);
    font-weight: 600;
    border-left: 3px solid var(--brand-accent);
    padding-left: calc(1rem - 3px);
}

.custom-option.active:hover {
    background: linear-gradient(90deg, var(--brand-accent) 0%, var(--brand-accent2) 100%);
    color: white;
}

.custom-option:last-child {
    border-radius: 0 0 calc(var(--radius-xl) - 2px) calc(var(--radius-xl) - 2px);
}

/* Scrollbar for options */
.custom-select-options::-webkit-scrollbar {
    width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: rgba(231, 225, 214, 0.3);
    border-radius: 0 0 var(--radius-xl) 0;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--brand-accent);
    border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--brand-accent2);
}

.search-results {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(107, 68, 35, 0.05);
    border-left: 3px solid var(--brand-accent);
    border-radius: var(--radius-sm);
    color: rgba(17, 17, 17, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideInLeft 0.4s ease;
    display: none;
}

.search-results.active {
    display: block;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.search-results #resultCount {
    font-weight: 700;
    color: var(--brand-accent);
    font-size: 1rem;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--brand-line);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(107, 68, 35, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.product-card:hover::before {
    opacity: 1;
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(107, 68, 35, 0.2);
    border-color: var(--brand-accent);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }

.product-image {
    aspect-ratio: 4/3;
    background: rgba(var(--brand-line), 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--brand-ink), 0.5);
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(0.98);
}

.product-card:hover .product-image img {
    transform: scale(1.1) rotate(1deg);
    filter: brightness(1.05);
}

.product-info {
    padding: 1.5rem;
    position: relative;
    z-index: 2;
}

.product-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.product-card:hover .product-title {
    color: var(--brand-accent);
}

.product-description {
    color: rgba(var(--brand-ink), 0.7);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.product-footer .btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.product-card:hover .product-footer .btn {
    transform: translateX(4px);
}

.product-price {
    font-weight: 700;
    color: var(--brand-accent);
    font-size: 1.125rem;
    position: relative;
    display: inline-block;
}

.product-price::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--brand-accent);
    transition: width 0.3s ease;
}

.product-card:hover .product-price::after {
    width: 100%;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

/* Product Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--brand-ink);
    z-index: 1;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 1);
}

.modal-body {
    padding: 2rem;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.product-detail-images {
    position: sticky;
    top: 2rem;
}

.main-image {
    margin-bottom: 1rem;
}

.product-image-placeholder {
    aspect-ratio: 4/5;
    background: rgba(var(--brand-line), 0.6);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--brand-ink), 0.5);
    font-size: 1rem;
}

.main-image img,
.main-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--brand-line);
    aspect-ratio: 4/5;
}

.thumbnail-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.thumbnail {
    aspect-ratio: 1;
    background: rgba(var(--brand-line), 0.6);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--brand-ink), 0.5);
    font-size: 0.75rem;
}

.thumbnail.active,
.thumbnail:hover {
    border-color: var(--brand-accent);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius-md) - 2px);
}

.product-detail-info {
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 1rem;
}

.product-detail-title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.product-detail-price {
    font-size: 1.5rem;
    color: var(--brand-accent);
    font-weight: 600;
    margin-bottom: 1rem;
}

.product-detail-description {
    color: rgba(var(--brand-ink), 0.8);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.product-options {
    margin-bottom: 2rem;
}

.option-group {
    margin-bottom: 1.5rem;
}

.option-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--brand-ink);
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.color-option {
    padding: 0.5rem 1rem;
    border: 1px solid var(--brand-line);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.875rem;
}

.color-option.active,
.color-option:hover {
    border-color: var(--brand-accent);
    background: var(--brand-accent);
    color: white;
}

.option-group input,
.option-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--brand-line);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition-fast);
    background: white;
}

.option-group input:focus,
.option-group select:focus {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(var(--brand-accent), 0.1);
}

.order-summary {
    background: rgba(var(--brand-line), 0.2);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.order-summary h4 {
    margin-bottom: 0.5rem;
    color: var(--brand-ink);
}

.order-summary ul {
    list-style: none;
    padding: 0;
}

.order-summary li {
    color: rgba(var(--brand-ink), 0.8);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.product-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.product-actions .btn {
    flex: 1;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: rgba(var(--brand-ink), 0.7);
    grid-column: 1 / -1;
}

.no-results h3 {
    margin-bottom: 1rem;
    color: var(--brand-ink);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.75rem;
    }
    
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .product-detail-images {
        position: static;
    }
}

@media (max-width: 768px) {
    .product-filters {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem;
        gap: 1.25rem;
    }
    
    .search-container {
        min-width: auto;
        width: 100%;
    }
    
    .filter-badges {
        justify-content: flex-start;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--brand-accent) rgba(231, 225, 214, 0.3);
        padding-bottom: 0.5rem;
    }
    
    .filter-badges::-webkit-scrollbar {
        height: 4px;
    }
    
    .filter-badges::-webkit-scrollbar-track {
        background: rgba(231, 225, 214, 0.3);
        border-radius: 2px;
    }
    
    .filter-badges::-webkit-scrollbar-thumb {
        background: var(--brand-accent);
        border-radius: 2px;
    }
    
    .filter-badges::-webkit-scrollbar-thumb:hover {
        background: var(--brand-accent2);
    }
    
    .filter-badge {
        font-size: 0.75rem;
        padding: 0.45rem 1rem;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .sort-container {
        width: 100%;
        justify-content: space-between;
    }
    
    .custom-select {
        flex: 1;
        min-width: auto;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.5rem;
    }
    
    .product-card:nth-child(n) {
        animation-delay: 0.1s;
    }
    
    .product-detail-info {
        max-height: none;
        padding-right: 0;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .product-actions .btn {
        width: 100%;
    }
    
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1.25rem;
    }
    
    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .product-filters {
        padding: 1rem;
    }
    
    .search-input {
        font-size: 0.875rem;
        padding: 0.65rem 0.875rem;
    }
    
    .search-btn {
        padding: 0.65rem 1rem;
    }
    
    .filter-badge {
        font-size: 0.7rem;
        padding: 0.4rem 0.875rem;
    }
    
    .sort-label {
        font-size: 0.8125rem;
    }
    
    .custom-select {
        min-width: auto;
    }
    
    .custom-select-trigger {
        font-size: 0.8125rem;
        padding: 0.6rem 2rem 0.6rem 0.875rem;
    }
    
    .custom-option {
        font-size: 0.8125rem;
        padding: 0.65rem 0.875rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .product-title {
        font-size: 1rem;
    }
    
    .product-description {
        font-size: 0.8125rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
    
    .thumbnail-images {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .color-options {
        justify-content: center;
    }
    
    .product-detail-title {
        font-size: 1.5rem;
    }
    
    .product-detail-price {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}
