/**
 * Responsive Breakpoints - Mobile-First Design
 * Breakpoints:
 *   <= 1200px : Large tablets / small desktops
 *   <=  992px : Tablets
 *   <=  768px : Small tablets / large phones
 *   <=  576px : Phones
 */

/* ==========================================================================
   Large Tablets / Small Desktops (<= 1200px)
   ========================================================================== */

@media (max-width: 1200px) {

    /* Container */
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    /* Products grid: 4 -> 3 columns */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Categories grid: 4 -> 3 */
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Footer: keep 4 columns but tighter */
    .footer-grid {
        gap: 1.5rem;
    }

    /* Catalog sidebar narrower */
    .catalog-sidebar {
        min-width: 220px;
        max-width: 220px;
    }

    /* Product detail spacing */
    .product-gallery {
        max-width: 420px;
    }

    /* Hero slider text */
    .slide-content h2 {
        font-size: 2rem;
    }

    .slide-content p {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Tablets (<= 992px)
   ========================================================================== */

@media (max-width: 992px) {

    /* Container */
    .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    /* Header: stack search below logo row */
    .header-main-content {
        flex-wrap: wrap;
    }

    .header-search {
        order: 3;
        width: 100%;
        margin-top: 0.75rem;
    }

    /* Navigation becomes toggleable */
    .site-nav {
        display: none;
    }

    .site-nav.active {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-item > a {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #e5e7eb;
    }

    .nav-dropdown {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1.5rem;
        background: #f9fafb;
    }

    /* Mobile menu toggle visible */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Products grid: 3 -> 2 columns */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Categories grid: 3 -> 2 */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Catalog layout: hide sidebar by default */
    .catalog-layout {
        flex-direction: column;
    }

    .catalog-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        z-index: 1000;
        background: #fff;
        overflow-y: auto;
        padding: 1.5rem;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        border: none;
        max-width: 85vw;
    }

    .catalog-sidebar.active {
        display: block;
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
    }

    .close-sidebar {
        display: inline-flex;
    }

    .filter-toggle {
        display: inline-flex;
    }

    /* Product detail: stacked */
    .product-detail {
        flex-direction: column;
    }

    .product-gallery {
        max-width: 100%;
        margin-bottom: 2rem;
        margin-right: 0;
    }

    .product-info {
        width: 100%;
    }

    /* Footer: 4 -> 2 columns */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    /* Contact layout: stacked */
    .contact-layout {
        flex-direction: column;
    }

    .contact-form-wrapper {
        margin-bottom: 2rem;
    }

    .contact-info-sidebar {
        border-left: none;
        border-top: 1px solid #e5e7eb;
        padding-top: 2rem;
        padding-left: 0;
    }

    /* Hero slider */
    .slide-content h2 {
        font-size: 1.75rem;
    }

    .slide-content p {
        font-size: 0.9375rem;
    }

    .slider-prev,
    .slider-next {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    /* Sections spacing */
    .section {
        padding: 2.5rem 0;
    }

    /* Font sizes */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    /* Table overflow */
    .specs-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Product list view: stack in list mode too */
    .products-grid.view-list .product-card {
        flex-direction: column;
    }

    /* Toolbar wrap */
    .catalog-toolbar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    /* Subcategories scroll */
    .subcategories-strip {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }

    .subcategory-chip {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ==========================================================================
   Small Tablets / Large Phones (<= 768px)
   ========================================================================== */

@media (max-width: 768px) {

    /* Container */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Header top: stack or hide */
    .header-top-content {
        flex-direction: column;
        gap: 0.375rem;
        padding: 0.5rem 0;
    }

    .header-contact {
        font-size: 0.8125rem;
    }

    .header-lang {
        font-size: 0.8125rem;
    }

    /* Full-screen mobile menu */
    .site-nav.active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        z-index: 999;
        overflow-y: auto;
        padding: 4rem 1rem 2rem;
    }

    .site-nav.active .nav-list {
        flex-direction: column;
    }

    .site-nav.active .nav-item > a {
        padding: 1rem;
        font-size: 1.125rem;
        border-bottom: 1px solid #f3f4f6;
    }

    .site-nav.active .nav-dropdown {
        padding-left: 1.5rem;
    }

    .site-nav.active .nav-dropdown li a {
        padding: 0.625rem 1rem;
        font-size: 1rem;
    }

    /* Products grid: keep 2 columns */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Product card: tighter */
    .product-card-info {
        padding: 0.75rem;
    }

    .product-card-name {
        font-size: 0.875rem;
    }

    .product-card-price {
        font-size: 0.9375rem;
    }

    .product-card .btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    /* Categories grid: 2 columns */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Gallery thumbs */
    .gallery-thumbs {
        gap: 0.5rem;
    }

    .gallery-thumb {
        width: 56px;
        height: 56px;
    }

    /* Product actions: stack */
    .product-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .product-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Tabs */
    .tab-headers {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .tab-btn {
        flex: 1;
        min-width: auto;
        font-size: 0.875rem;
        padding: 0.625rem 0.75rem;
    }

    /* Hero slider */
    .hero-slider {
        min-height: 280px;
    }

    .slide-content h2 {
        font-size: 1.375rem;
    }

    .slide-content p {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }

    .slide-content .btn {
        font-size: 0.875rem;
        padding: 0.625rem 1.25rem;
    }

    .slider-prev,
    .slider-next {
        width: 32px;
        height: 32px;
    }

    .slider-dots {
        bottom: 0.75rem;
    }

    .slider-dots .dot {
        width: 8px;
        height: 8px;
    }

    /* Quick search */
    .quick-search-form {
        flex-direction: column;
    }

    .quick-search-form input {
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .quick-search-form button {
        border-radius: 0.5rem;
        width: 100%;
    }

    /* Section header */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Section spacing */
    .section {
        padding: 2rem 0;
    }

    /* Page header */
    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Search form large */
    .search-form-large {
        flex-direction: column;
    }

    .search-form-large input {
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .search-form-large button {
        border-radius: 0.5rem;
        width: 100%;
    }

    /* Contact form row: stack */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        width: 100%;
    }

    /* Footer: 2 -> 1 column */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer-col {
        text-align: center;
    }

    .footer-social {
        justify-content: center;
    }

    .footer-bottom {
        text-align: center;
        padding-top: 1.25rem;
    }

    /* Font sizes */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1rem;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.8125rem;
        flex-wrap: wrap;
    }

    /* Lightbox */
    .lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 1.75rem;
    }

    /* Back to top */
    .back-to-top {
        right: 1rem;
        bottom: 1rem;
        width: 40px;
        height: 40px;
    }

    /* Catalog sidebar overlay */
    .catalog-sidebar {
        width: 280px;
    }

    /* Sort and view toggle */
    .toolbar-right {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sort-select {
        width: 100%;
    }

    .sort-select select {
        width: 100%;
    }

    /* Product share buttons */
    .product-share {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ==========================================================================
   Phones (<= 576px)
   ========================================================================== */

@media (max-width: 576px) {

    /* Container */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Header top: simplify */
    .header-top {
        font-size: 0.75rem;
        padding: 0.375rem 0;
    }

    .header-contact a + a {
        margin-left: 0.75rem;
    }

    /* Logo */
    .site-logo img {
        max-height: 36px;
    }

    .logo-text {
        font-size: 1.125rem;
    }

    /* Header search */
    .header-search input {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    /* Products grid: 2 columns, very tight */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Product card mini */
    .product-card-info {
        padding: 0.5rem;
    }

    .product-card-category {
        font-size: 0.6875rem;
    }

    .product-card-name {
        font-size: 0.8125rem;
        line-height: 1.3;
    }

    .product-card-name a {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card-price {
        font-size: 0.875rem;
    }

    .product-card .btn {
        font-size: 0.6875rem;
        padding: 0.3125rem 0.5rem;
    }

    /* Categories grid: 2 columns */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .category-card {
        border-radius: 0.5rem;
    }

    .category-info h3 {
        font-size: 0.875rem;
    }

    .product-count {
        font-size: 0.75rem;
    }

    /* Hero slider */
    .hero-slider {
        min-height: 220px;
    }

    .slide-content {
        padding: 0 0.75rem;
    }

    .slide-content h2 {
        font-size: 1.125rem;
        margin-bottom: 0.375rem;
    }

    .slide-content p {
        font-size: 0.8125rem;
        margin-bottom: 0.75rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .slide-content .btn {
        font-size: 0.8125rem;
        padding: 0.5rem 1rem;
    }

    .slider-prev,
    .slider-next {
        display: none;
    }

    /* Quick search */
    .quick-search {
        padding: 1rem 0;
    }

    .quick-search-form input {
        font-size: 0.875rem;
    }

    .quick-search-form button {
        font-size: 0.875rem;
    }

    /* Section spacing */
    .section {
        padding: 1.5rem 0;
    }

    .section-header h2 {
        font-size: 1.125rem;
    }

    .see-all {
        font-size: 0.8125rem;
    }

    /* Product detail */
    .product-title {
        font-size: 1.25rem;
    }

    .product-price-block .product-price {
        font-size: 1.375rem;
    }

    .product-short-desc {
        font-size: 0.875rem;
    }

    /* Gallery */
    .gallery-thumbs {
        gap: 0.375rem;
    }

    .gallery-thumb {
        width: 48px;
        height: 48px;
    }

    /* Product actions */
    .product-actions .btn {
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
    }

    /* Tabs */
    .tab-headers {
        gap: 0;
    }

    .tab-btn {
        font-size: 0.8125rem;
        padding: 0.5rem 0.625rem;
    }

    .tab-panel {
        padding: 1rem;
        font-size: 0.875rem;
    }

    /* Specs table */
    .specs-table th,
    .specs-table td {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }

    /* Related products heading */
    .related-section h2 {
        font-size: 1.125rem;
    }

    /* Page content */
    .page-header h1 {
        font-size: 1.25rem;
    }

    .prose {
        font-size: 0.9375rem;
        line-height: 1.7;
    }

    /* Search page */
    .search-form-large input {
        font-size: 0.875rem;
    }

    .search-form-large button {
        font-size: 0.875rem;
    }

    /* Contact */
    .contact-form label {
        font-size: 0.875rem;
    }

    .contact-form input,
    .contact-form textarea {
        font-size: 0.875rem;
        padding: 0.625rem;
    }

    .contact-info-item {
        gap: 0.75rem;
    }

    .contact-info-item h4 {
        font-size: 0.875rem;
    }

    /* Catalog toolbar */
    .catalog-toolbar {
        gap: 0.5rem;
    }

    .filter-toggle {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }

    .results-count {
        font-size: 0.75rem;
    }

    .view-toggle button {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.75rem;
        gap: 0.25rem;
        padding: 0.75rem 0;
    }

    .breadcrumb .separator {
        margin: 0 0.125rem;
    }

    /* Alerts */
    .alert {
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    /* Buttons global */
    .btn-lg {
        font-size: 0.9375rem;
        padding: 0.625rem 1.25rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.3125rem 0.625rem;
    }

    /* Empty state */
    .empty-state i {
        font-size: 2.5rem;
    }

    .empty-state h3 {
        font-size: 1rem;
    }

    /* Footer */
    .footer-col h3 {
        font-size: 1rem;
    }

    .footer-links li a,
    .footer-contact li {
        font-size: 0.875rem;
    }

    .footer-bottom p {
        font-size: 0.75rem;
    }

    /* Lightbox */
    .lightbox img {
        max-width: 95vw;
        max-height: 80vh;
    }

    /* Catalog sidebar mobile */
    .catalog-sidebar {
        width: 100%;
        max-width: 100%;
    }

    /* Lang switcher */
    .lang-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Pagination compact */
    .pagination {
        gap: 0.25rem;
    }

    .pagination a,
    .pagination span {
        min-width: 32px;
        height: 32px;
        font-size: 0.8125rem;
    }
}
