#products-main {
    padding: 4rem 0;
    background: linear-gradient(to bottom right, #f8fafc, #e2e8f0);
}

#products-main .container-fluid {
    padding: 0 2rem;
}

.products-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sidebar Styles */
.products-sidebar {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    min-width: 280px;
}

.products-sidebar::-webkit-scrollbar {
    width: 6px;
}

.products-sidebar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.products-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.products-sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.products-sidebar h3 {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.filter-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
    overflow: visible;
}

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

.filter-section label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.filter-section input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.filter-section input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}

.filter-header:hover {
    color: #3b82f6;
}

.filter-header i {
    transition: transform 0.3s ease;
}

.filter-header.active i {
    transform: rotate(180deg);
}

.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filter-content.active {
    max-height: 800px;
    overflow-y: auto;
}

/* Regular Filter Items (for sectors, markets, product types) */
.filter-item {
    display: flex;
    align-items: flex-start;
    margin: 0.5rem 0;
    position: relative;
}

.filter-item input[type="radio"] {
    margin-right: 0.75rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.filter-item label {
    cursor: pointer;
    font-weight: 400;
    font-size: 0.9rem;
    margin-bottom: 0;
    flex: 1;
    line-height: 1.4;
}

/* Categories Section - Special Styling */
#categories-content .filter-item {
    display: block;
    /* Different from regular filter items */
    margin-bottom: 0.75rem;
}

.main-category-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    width: 100%;
}

.main-category-item input[type="radio"] {
    margin-right: 0.75rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.main-category-item label {
    font-weight: 600;
    color: #374151;
    flex: 1;
    cursor: pointer;
    line-height: 1.4;
    font-size: 0.9rem;
}

.sub-filter-content {
    margin-left: 0;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid #3b82f6;
    background-color: #f8fafc;
    border-radius: 6px;
    display: none;
    flex-direction: column;
}

.sub-filter-item {
    display: flex;
    align-items: flex-start;
    margin: 0.5rem 0;
    padding-left: 0;
    width: 100%;
}

.sub-filter-item input[type="radio"] {
    margin-right: 0.5rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.sub-filter-item label {
    cursor: pointer;
    font-weight: 400;
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0;
    flex: 1;
    line-height: 1.4;
    word-wrap: break-word;
}

.clear-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.clear-btn:hover {
    background-color: #dc2626;
}

/* Products Content */
.products-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    min-width: 0;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.products-header h2 {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.results-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-info span {
    font-weight: 600;
    color: #6b7280;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    background: white;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.view-btn:hover {
    background: #f3f4f6;
}

.view-btn.active:hover {
    background: #2563eb;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
    min-width: 0;
    align-items: stretch;
    justify-content: center;
}

.products-grid.list-view {
    grid-template-columns: 1fr;
}

.products-grid.list-view .modern-card {
    display: flex;
    flex-direction: row;
    max-width: none;
}

.products-grid.list-view .modern-card-content {
    flex: 1;
}

/* Modern Card Styles */
.modern-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
}

.modern-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.modern-card-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.5rem;
}

.modern-card-title {
    font-family: 'Roboto', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.modern-card-description {
    flex: 1 1 auto;
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.product-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.product-type,
.product-sector {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.product-type {
    background: #e0f2fe;
    color: #0369a1;
}

.product-sector {
    background: #f0fdf4;
    color: #15803d;
}

.modern-card-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    text-align: center;
    margin-top: auto;
}

.modern-card-button:hover {
    background-color: #2563eb;
}

/* No Products */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.no-products h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #374151;
}

/* Search Container Styles */
.products-filter-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.products-filter-search-container input {
    flex: 1;
    padding-right: 40px;
}

.products-filter-search-btn {
    position: absolute;
    right: 5px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    transform: scale(1);
}

.products-filter-search-btn:hover {
    color: #3b82f6;
    background-color: #e0f2fe;
    transform: scale(1.05);
}

.products-filter-search-btn:active {
    background-color: #3b82f6;
    color: white;
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.products-filter-search-btn.searching {
    background-color: #3b82f6;
    color: white;
    animation: pulse 1.5s infinite;
    pointer-events: none;
}

.products-filter-search-btn.searching i {
    animation: spin 1s linear infinite;
}

/* Success state class - briefly shows after search completes */
.products-filter-search-btn.search-success {
    background-color: #10b981;
    color: white;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Alternative: Click ripple effect */
.products-filter-search-btn {
    position: relative;
    overflow: hidden;
}

.products-filter-search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.products-filter-search-btn.clicked::before {
    width: 40px;
    height: 40px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .products-layout {
        grid-template-columns: 280px 1fr;
        gap: 1.5rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    #products-main .container-fluid {
        padding: 0 1.5rem;
    }
}

@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 250px 1fr;
        gap: 1.5rem;
    }

    .products-sidebar {
        min-width: 250px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .products-content {
        padding: 1.5rem;
    }
}

@media (max-width: 900px) {
    .products-layout {
        grid-template-columns: 220px 1fr;
        gap: 1rem;
    }

    .products-sidebar {
        min-width: 220px;
        padding: 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }

    .products-content {
        padding: 1rem;
    }

    .modern-card-content {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .products-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .products-sidebar {
        position: static;
        margin-bottom: 1rem;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        max-height: none;
        overflow-y: visible;
    }

    .products-content {
        padding: 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }

    .products-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .results-info {
        width: 100%;
        justify-content: space-between;
    }

    #products-main .container-fluid {
        padding: 0 1rem;
    }

    #products-main {
        padding: 2rem 0;
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modern-card {
        margin-bottom: 0;
    }

    .modern-card-content {
        padding: 1rem;
    }

    .products-content {
        padding: 1rem;
        border-radius: 8px;
    }

    .products-sidebar {
        padding: 1rem;
        border-radius: 8px;
    }

    .products-header h2 {
        font-size: 1.5rem;
    }

    .view-toggle {
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .modern-card-content {
        padding: 0.75rem;
    }

    .products-content {
        padding: 0.75rem;
        border-radius: 6px;
    }

    .products-sidebar {
        padding: 0.75rem;
        border-radius: 6px;
    }

    #products-main .container-fluid {
        padding: 0 0.75rem;
    }

    #products-main {
        padding: 1.5rem 0;
    }

    .products-header h2 {
        font-size: 1.25rem;
    }

    .modern-card-title {
        font-size: 1.1rem;
    }

    .modern-card-description {
        font-size: 0.9rem;
    }

    .results-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .results-info span {
        font-size: 0.9rem;
    }
}

/* Additional mobile improvements */
@media (max-width: 390px) {
    .products-grid {
        gap: 0.5rem;
    }

    .modern-card-content {
        padding: 0.5rem;
    }

    .products-content {
        padding: 0.5rem;
    }

    .products-sidebar {
        padding: 0.5rem;
    }

    #products-main .container-fluid {
        padding: 0 0.5rem;
    }

    .modern-card-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Ensure proper text wrapping */
.modern-card-title,
.modern-card-description,
.filter-item label,
.sub-filter-item label {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Prevent horizontal scrolling */
* {
    box-sizing: border-box;
}

.products-layout,
.products-content,
.products-sidebar,
.modern-card {
    max-width: 100%;
    overflow-x: hidden;
}
