/* VreauProaspat.ro - Responsive Styles */

/* ==================== */
/* TABLET (max-width: 1024px) */
/* ==================== */
@media (max-width: 1024px) {
    :root {
        --container-width: 960px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }

    .header-top {
        flex-wrap: wrap;
    }

    .search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: var(--spacing-md);
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    /* Homepage keeps 3 on tablet */
    .featured-products .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==================== */
/* MOBILE (max-width: 768px) */
/* ==================== */
@media (max-width: 768px) {
    :root {
        --spacing-xxl: 2rem;
    }

    html {
        font-size: 14px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    /* Header Mobile Layout */
    .header-top {
        padding: var(--spacing-md) 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "logo icons"
            "search search";
        gap: var(--spacing-md);
        align-items: center;
    }

    .logo {
        grid-area: logo;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .header-icons {
        grid-area: icons;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: var(--spacing-md);
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--spacing-xs);
        color: var(--color-primary);
        background: none;
        border: none;
        cursor: pointer;
    }

    .mobile-menu-toggle svg {
        width: 28px;
        height: 28px;
    }

    .cart-icon {
        position: relative;
        display: flex;
        align-items: center;
        color: var(--color-primary);
        padding: var(--spacing-xs);
        border: none !important;
        background: transparent !important;
    }

    .cart-icon svg {
        width: 26px;
        height: 26px;
    }

    .cart-count {
        position: absolute;
        top: -4px;
        right: -4px;
        background: var(--color-accent);
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        font-weight: bold;
    }

    .search-bar {
        grid-area: search;
        width: 100%;
        max-width: 100%;
    }

    /* Hide header actions on mobile - they'll appear in hamburger menu */
    .header-actions {
        display: none;
    }

    /* Main Nav Mobile - Hidden by default, shown via hamburger */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
        z-index: 2002;
        transition: right 0.3s ease;
        padding: var(--spacing-xl) var(--spacing-lg);
        overflow-y: auto;
    }

    .main-nav.active {
        right: 0;
    }

    .main-nav ul {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding-top: var(--spacing-xl);
    }

    .main-nav li {
        border-bottom: 1px solid var(--color-border-light);
    }

    .main-nav a {
        display: block;
        padding: var(--spacing-md);
        color: var(--color-text);
        font-size: 1rem;
        font-weight: 500;
    }

    .main-nav a:hover {
        background: var(--color-bg-light);
        color: var(--color-primary);
    }

    /* Mobile menu actions (login + devino producator) */
    .main-nav .mobile-menu-actions {
        margin-top: var(--spacing-lg);
        padding-top: var(--spacing-lg);
        border-top: 2px solid var(--color-border-light);
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .main-nav .mobile-menu-actions a {
        text-align: center;
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
        font-weight: 600;
        border: none;
    }

    .main-nav .mobile-menu-actions .login-link {
        background: var(--color-bg-light);
        color: var(--color-text);
        border: 1px solid var(--color-border);
    }

    .main-nav .mobile-menu-actions .btn-producer {
        background: var(--color-secondary);
        color: white;
    }

    .main-nav .mobile-menu-actions a:hover {
        opacity: 0.9;
    }

    /* Mobile Menu Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2000;
        display: none;
    }

    .mobile-menu-overlay.active {
        display: block;
    }

    /* Mobile Menu Close Button */
    .main-nav::before {
        content: '✕';
        position: absolute;
        top: var(--spacing-md);
        right: var(--spacing-md);
        font-size: 2rem;
        color: var(--color-text-light);
        cursor: pointer;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hero */
    .hero {
        padding: var(--spacing-xl) 0;
    }

    .hero h2 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-cta {
        flex-direction: column;
    }

    .hero-cta .btn {
        width: 100%;
    }

    /* Grids */
    .categories-grid {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    /* Homepage also 2 products per row on mobile */
    .featured-products .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Reduce product image height on mobile (1/3 smaller) */
    .product-image {
        height: 133px;
    }

    /* Smaller price on mobile (30% smaller + 10% increase: 0.875rem * 0.7 * 1.1 = 0.67rem) */
    .product-price {
        font-size: 0.67rem;
    }

    .product-unit {
        font-size: 0.55rem;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .producers-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    /* Products Page */
    .products-layout {
        display: block;
    }

    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        z-index: 2000;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-md);
    }

    .filters-sidebar.active {
        left: 0;
    }

    .filters-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1999;
        display: none;
    }

    .filters-overlay.active {
        display: block;
    }

    .mobile-filter-toggle {
        display: block;
        width: 100%;
        padding: var(--spacing-md);
        background-color: var(--color-primary);
        color: white;
        border-radius: var(--radius-md);
        margin-bottom: var(--spacing-md);
        font-weight: 600;
    }

    .products-toolbar {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: stretch;
    }

    .sort-options {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sort-options select {
        flex: 1;
        margin-left: var(--spacing-sm);
    }
}

/* ==================== */
/* SMALL MOBILE (max-width: 480px) */
/* ==================== */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .header-top {
        gap: var(--spacing-sm);
    }

    .header-icons {
        gap: var(--spacing-sm);
    }

    .mobile-menu-toggle svg,
    .cart-icon svg {
        width: 24px;
        height: 24px;
    }

    .header-actions a {
        font-size: 0.85rem;
        padding: var(--spacing-sm);
    }

    .search-bar input {
        font-size: 0.9rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .search-bar button {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.9rem;
    }

    .search-bar button span {
        display: none;
    }

    .search-bar button::after {
        content: '🔍';
        font-size: 1.2rem;
    }

    .product-card {
        font-size: 0.9rem;
    }

    section {
        padding: var(--spacing-xl) 0;
    }

    .main-nav {
        width: 85%;
    }
}

/* ==================== */
/* PRODUCTS PAGE SPECIFIC */
/* ==================== */
@media (min-width: 769px) {
    .products-layout {
        display: grid;
        grid-template-columns: 260px 1fr;
        gap: var(--spacing-xxl);
        align-items: start;
    }

    .filters-sidebar {
        position: sticky;
        top: 100px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    .mobile-filter-toggle {
        display: none;
    }
}

.filters-sidebar {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

/* Custom scrollbar for filters sidebar */
.filters-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filters-sidebar::-webkit-scrollbar-track {
    background: var(--color-bg-light);
    border-radius: 3px;
}

.filters-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 3px;
}

.filters-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-border-light);
}

.filters-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.filter-group {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-group h3 {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.filter-checkbox input {
    margin-right: var(--spacing-sm);
    cursor: pointer;
}

.filter-checkbox span {
    color: var(--color-text);
}

.price-range {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    flex-wrap: wrap;
}

.price-range input {
    flex: 1;
    min-width: 70px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.price-range span {
    color: var(--color-text-light);
    font-weight: 500;
}

#county-filter {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.results-count {
    font-weight: 600;
    color: var(--color-text);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sort-options label {
    font-weight: 500;
    color: var(--color-text-light);
}

.sort-options select {
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
}

.active-filters {
    background: var(--color-bg-light);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.active-filters h3 {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.filter-tag button {
    background: none;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    font-weight: bold;
}

.filter-tag button:hover {
    color: var(--color-accent);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xl);
    flex-wrap: wrap;
}

.pagination button,
.pagination a {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover,
.pagination a:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination button.active,
.pagination a.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

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

/* ==================== */
/* PRINT STYLES */
/* ==================== */
@media print {
    .header,
    .footer,
    .filters-sidebar,
    .products-toolbar,
    .cta-section,
    button {
        display: none;
    }

    body {
        font-size: 12pt;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== */
/* ACCESSIBILITY */
/* ==================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #1f5a2d;
        --color-text: #000000;
        --color-bg: #ffffff;
    }

    .btn {
        border-width: 3px;
    }
}
