:root {
    --primary: #326168;
    --primary-dark: #264a50;
    --secondary: #F6706D;
    --secondary-dark: #d65552;
    --bg-light: #f9fafb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-full: 9999px;
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
    border: 3px solid #f1f1f1;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--secondary);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.text-ciano { color: var(--primary); }

.main-content {
    flex-grow: 1;
}

.catalog-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.catalog-container.sidebar-collapsed {
    grid-template-columns: 0 1fr;
    gap: 0;
}

.filter-sidebar {
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    height: fit-content;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    padding: 1.5rem;
    opacity: 1;
    transition: opacity 0.2s ease;
    min-width: 250px;
    overflow-y: auto;
}

.catalog-container.sidebar-collapsed .filter-sidebar {
    width: 0;
    border: none;
    padding: 0;
}

.catalog-container.sidebar-collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.filter-group h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary);
    display: inline-block;
}

.filter-group ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.custom-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: color 0.2s;
    user-select: none;
    padding: 0.25rem 0;
}

.custom-checkbox-label:hover {
    color: var(--secondary);
}

.custom-checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 20px;
    width: 20px;
    background-color: var(--white);
    border: 2px solid #d1d5db;
    border-radius: 6px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.custom-checkbox-label:hover input ~ .checkmark {
    border-color: var(--secondary);
    background-color: #fff5f5;
}

.custom-checkbox-label input:checked ~ .checkmark {
    background-color: var(--secondary);
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(246, 112, 109, 0.2);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox-label input:checked ~ .checkmark:after {
    display: block;
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-top: 1rem;
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(50, 97, 104, 0.2);
}

.product-grid-container {
    width: 100%;
    min-width: 0;
}

.product-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-toggle-btn {
    background: var(--bg-light);
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.filter-toggle-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.products-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-by-select {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sort-by-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(50, 97, 104, 0.1);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
}

.catalog-product-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.6s backwards;
}

.catalog-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border-color: #d1d5db;
}

.product-image-wrapper {
    position: relative;
    padding-top: 85%;
    overflow: hidden;
    background: #f3f4f6;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.catalog-product-card:hover .product-image {
    transform: scale(1.08);
}

.product-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.4;
    min-height: 3.2rem;
}

.product-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-primary, .btn-view {
    border: none;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    width: 100%;
    text-decoration: none;
}

.btn-primary {
    background: var(--secondary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(246, 112, 109, 0.3);
}

.btn-view {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-view:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(50, 97, 104, 0.2);
}

.no-results-container {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    background: white;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

.pagination-container {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.pagination-container ul {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
}

.page-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.page-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 4px 6px rgba(50, 97, 104, 0.2);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(31, 41, 55, 0.6);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(4px);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: var(--secondary);
    transform: translateY(-5px);
}

@media (max-width: 768px) {
    .catalog-container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1.5rem;
    }

    .filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 85%;
        max-width: 340px;
        z-index: 50;
        border-radius: 0 1.5rem 1.5rem 0;
        border: none;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .filter-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.25rem 1.5rem;
        background-color: var(--bg-light);
        border-bottom: 1px solid var(--border);
    }

    .sidebar-header h2 {
        font-size: 1.25rem;
    }

    #close-sidebar-btn {
        background: rgba(0,0,0,0.05);
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    #close-sidebar-btn:hover {
        background: #fee2e2;
        color: #ef4444;
    }

    .sidebar-content {
        padding: 1.5rem;
    }

    .product-grid-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    
    .header-controls {
        justify-content: space-between;
    }

    .sort-controls {
        justify-content: space-between;
        width: 100%;
    }
    
    .sort-select-wrapper {
        flex-grow: 1;
        margin-left: 1rem;
    }
    
    .sort-by-select {
        width: 100%;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr); 
        gap: 1rem;
    }
    
    .product-content {
        padding: 1rem;
    }
    
    .product-title {
        font-size: 0.9rem;
        min-height: 2.5rem;
        margin-bottom: 0.75rem;
    }

    .btn-primary, .btn-view {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .products-section-title {
        font-size: 1.25rem;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}