/* ============================================
   PRODUCTS PAGE - STYLES
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary-color: #2d5a27;
    --primary-dark: #1e3d1a;
    --primary-light: #4a7c42;
    --secondary-color: #8b7355;
    --accent-color: #d4a84b;
    --text-color: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --bg-color: #ffffff;
    --bg-light: #f8f9fa;
    --bg-dark: #1a1a1a;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    --font-primary: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-heading: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --container-width: 1400px;
    --header-height: 80px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input,
select {
    font-family: inherit;
    font-size: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

/* --- Header --- */



.header{
    position: relative;
    background-color: var(--bg-color);
    height: 100px;
}

.nav-menu li a{
    color: var(--primary-dark);
}
/* --- Products Hero --- */
.products-hero {
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    text-align: center;
}

.hero-content h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--bg-color);
    margin-bottom: 0.5rem;
}

.hero-content p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.85);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Filters Section --- */
.filters-section {
    background: var(--bg-light);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 100;
}

.filters-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 1rem center;
    font-size: 0.95rem;
    color: var(--text-color);
    cursor: pointer;
    min-width: 180px;
    transition: var(--transition-fast);
    appearance: none;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

.filter-select:disabled {
    background-color: var(--bg-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-clear-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    font-size: 0.875rem;
    color: var(--text-light);
    transition: var(--transition-fast);
}

.btn-clear-filters:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-clear-filters svg {
    width: 16px;
    height: 16px;
}

.active-filters {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 1rem;
}

.active-filters:empty {
    display: none;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--primary-color);
    color: var(--bg-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

.filter-tag button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.filter-tag button:hover {
    opacity: 1;
}

.filter-tag svg {
    width: 14px;
    height: 14px;
}

.results-info {
    max-width: var(--container-width);
    margin: 1rem auto 0;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* --- Products Section --- */
.products-section {
    flex: 1;
    padding: 2rem;
    background: var(--bg-color);
}

.products-container {
    max-width: var(--container-width);
    margin: 0 auto;
    position: relative;
    min-height: 400px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* --- Product Card --- */
.product-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-base);
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.product-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--bg-light);
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card-image img {
    transform: scale(1.08);
}

.product-card-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.375rem 0.75rem;
    background: var(--primary-color);
    color: var(--bg-color);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
}

.product-card-badge.low-stock {
    background: var(--warning-color);
    color: var(--text-color);
}

.product-card-badge.out-of-stock {
    background: var(--danger-color);
}

.product-card-content {
    padding: 1.25rem;
}

.product-card-category {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.product-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.product-card-subcategory {
    font-size: 0.85rem;
    color: var(--text-light);
}

.product-card-quantity {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.product-card-quantity svg {
    width: 16px;
    height: 16px;
}

.product-card-quantity.in-stock {
    color: var(--success-color);
}

.product-card-quantity.low-stock {
    color: var(--warning-color);
}

.product-card-quantity.out-of-stock {
    color: var(--danger-color);
}

/* --- No Results --- */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.no-results svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    opacity: 0.4;
}

.no-results h3 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.no-results p {
    font-size: 0.95rem;
}

/* --- Loading Spinner --- */
.loading-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--bg-color);
    z-index: 10;
}

.loading-spinner[hidden] {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner span {
    font-size: 0.95rem;
    color: var(--text-light);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-light);
    z-index: 10;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-color);
    border-color: var(--text-light);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-height: 90vh;
    overflow: auto;
}

/* --- Modal Gallery --- */
.modal-gallery {
    background: var(--bg-light);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gallery-main {
    aspect-ratio: 4/3;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-color);
}

.gallery-main .main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-thumbnails {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 3px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
    opacity: 0.7;
}

.thumbnail-item:hover,
.thumbnail-item.active {
    opacity: 1;
    border-color: var(--primary-color);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Modal Details --- */
.modal-details {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
}

.modal-category {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.3;
    margin-bottom: 2rem;
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

.info-value.quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-value.quantity::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
}

.info-value.quantity.low-stock::before {
    background: var(--warning-color);
}

.info-value.quantity.out-of-stock::before {
    background: var(--danger-color);
}

.modal-actions {
    margin-top: auto;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: var(--bg-color);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary svg {
    width: 20px;
    height: 20px;
}

/* --- Footer --- */
.page-footer {
    background: var(--bg-dark);
    color: var(--bg-color);
    padding: 2rem;
    text-align: center;
}

.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
}

.page-footer p {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .modal-content {
        grid-template-columns: 1fr;
    }

    .modal-gallery {
        max-height: 50vh;
    }

    .modal-details {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 70px;
    }

    .header-container {
        padding: 0 1rem;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-base);
    }

    .main-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
    }

    .nav-list a {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border-light);
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .products-hero {
        padding: 3rem 1rem;
    }

    .filters-section {
        padding: 1rem;
        position: relative;
        top: 0;
    }

    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        max-width: none;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .btn-clear-filters {
        justify-content: center;
    }

    .products-section {
        padding: 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-container {
        max-height: 95vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-close {
        top: 0.75rem;
        right: 0.75rem;
    }

    .modal-gallery {
        padding: 1rem;
    }

    .modal-details {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .gallery-thumbnails {
        gap: 0.5rem;
    }

    .thumbnail-item {
        width: 60px;
        height: 45px;
    }
}

/* --- Utility Classes --- */
[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}