* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: #2c3e50;
    border-bottom: none;
    padding: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    display: flex;
    align-items: center;
}

.logo-image {
    height: 50px;
    width: auto;
}

.logo-right {
    display: flex;
    align-items: center;
}

.logo-svg {
    height: 50px;
    width: auto;
}

/* Main Content */
main {
    padding: 30px 20px;
}

.page-title {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 25px;
    font-weight: 600;
}

/* Top Controls - Search and Filter side by side */
.top-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    align-items: flex-start;
}

/* Search Section */
.search-section {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: none;
    margin: 0;
}

#searchInput {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#clearBtn {
    padding: 12px 24px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.3s;
}

#clearBtn:hover {
    background: #c0392b;
}

/* Filter Section */
.filter-section {
    width: 250px;
    margin: 0;
    position: relative;
}

.filter-toggle {
    width: 100%;
    padding: 12px 15px;
    background: #3498db;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: white;
    transition: all 0.3s;
}

.filter-toggle:hover {
    background: #2980b9;
}

.filter-toggle .arrow {
    transition: transform 0.3s;
    font-size: 12px;
}

.filter-toggle.active .arrow {
    transform: rotate(180deg);
}

.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    position: absolute;
    width: 100%;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.filter-content.active {
    max-height: 500px;
    overflow-y: auto;
}

.filter-group {
    padding: 20px;
}

.filter-group h3 {
    margin-bottom: 15px;
    color: #0066cc;
    font-size: 1.1rem;
}

.filter-group label {
    display: block;
    padding: 8px 0;
    cursor: pointer;
    transition: color 0.2s;
}

.filter-group label:hover {
    color: #0066cc;
}

.filter-group input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.filter-count {
    color: #999;
    font-size: 0.9em;
    margin-left: 5px;
}

/* Search and Clear button styles already defined above */
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#clearBtn:hover {
    background-color: #0052a3;
}

/* Loading & Error Messages */
.loading, .error {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.error {
    color: #d32f2f;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
    width: 100%;
}

.product-card {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid #e0e0e0;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border-color: #3498db;
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: #fafafa;
    padding: 15px;
}

.product-info {
    padding: 18px;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 50px;
}

.product-description {
    font-size: 0.88rem;
    color: #7f8c8d;
    line-height: 1.5;
    max-height: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.product-files {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.file-link {
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 5px;
    padding: 5px 10px;
    background: #f0f0f0;
    color: #0066cc;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.85rem;
    transition: background-color 0.3s;
}

.file-link:hover {
    background: #e0e0e0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    max-width: 900px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding: 10px 20px;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

#modalBody {
    padding: 30px;
}

.modal-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.modal-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: #f9f9f9;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-image:hover {
    transform: scale(1.05);
}

.modal-title {
    font-size: 2rem;
    color: #0066cc;
    margin-bottom: 20px;
}

.modal-description {
    line-height: 1.8;
    color: #555;
    margin-bottom: 20px;
}

.modal-description h3 {
    color: #0066cc;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 5px;
}

.modal-description strong {
    color: #333;
}

.modal-description br + br {
    display: block;
    margin-bottom: 10px;
}

.modal-files {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.modal-files h3 {
    margin-bottom: 10px;
    color: #333;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 25px 0;
    margin-top: 60px;
}

footer p {
    margin: 0;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    header .logo,
    .logo-right {
        width: 100%;
        justify-content: center;
    }

    .logo-image,
    .logo-svg {
        max-width: 100%;
        height: auto;
        max-height: 50px;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .top-controls {
        flex-direction: column;
        gap: 15px;
    }

    .filter-section {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .modal-content {
        margin: 10% 10px;
        max-width: 100%;
    }
}

/* Lightbox galéria */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    flex-direction: row;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: lightboxZoomIn 0.3s;
    z-index: 10000;
}

@keyframes lightboxZoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 2001;
}

.lightbox-close:hover {
    color: #ccc;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    padding: 20px;
    user-select: none;
    transition: color 0.2s;
    z-index: 2001;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    color: #ccc;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10001;
}

@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next {
        font-size: 35px;
        padding: 10px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .lightbox-counter {
        bottom: 20px;
        font-size: 14px;
        padding: 8px 15px;
    }
}
