/* Products main section */
.products-main {
    padding-top: 2rem;
    min-height: 100vh;
}

.products-header {
    text-align: center;
    margin-bottom: 3rem;
}

.products-header h1 {
    color: var(--primary-color, #2c3e50);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.products-header p {
    color: var(--text-color, #666);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Filter section */
.filter-section {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.filter-select {
    display: none;
    width: 100%;
    max-width: 300px;
}

.filter-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color, #333);
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: var(--primary-color, #2c3e50);
    color: white;
    border-color: var(--primary-color, #2c3e50);
}

.filter-btn.active {
    background: var(--primary-color, #2c3e50);
    color: white;
    border-color: var(--primary-color, #2c3e50);
}

#podklasaSelect {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-color, #666);
}

.loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color, #2c3e50);
}

/* Products grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
}

.product-image img {
    width: auto !important;
    height: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    object-fit: contain !important;
    transition: transform 0.3s ease;
    background: transparent !important;
    display: block !important;
    margin: 0 auto !important;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

/* Dodaj placeholder za slike koje se ne učitaju */
.product-image img[src=""], 
.product-image img:not([src]), 
.product-image img[src="assets/img/placeholder.jpg"] {
    background: #f8f9fa url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>') center/50px no-repeat;
    object-fit: contain;
}

.product-info {
    padding: 1.5rem;
}

.product-info h3 {
    color: var(--primary-color, #2c3e50);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.product-packaging {
    color: var(--text-color, #666);
    font-size: 0.95rem;
    margin: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover {
    color: #000;
    background: white;
}

.modal-body {
    display: flex;
    flex-direction: column;
}

.modal-image {
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-image img {
    width: auto !important;
    height: calc(100% - 40px) !important;
    max-width: calc(100% - 40px) !important;
    object-fit: contain !important;
    background: transparent !important;
    display: block !important;
    margin: 0 auto !important;
}

.modal-image img[src=""], 
.modal-image img:not([src]), 
.modal-image img[src="assets/img/placeholder.jpg"] {
    background: #f8f9fa url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>') center/80px no-repeat;
    object-fit: contain;
}

.modal-info {
    padding: 2rem;
}

.modal-info h3 {
    color: var(--primary-color, #2c3e50);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-details p {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.6;
}

.modal-details strong {
    color: var(--primary-color, #2c3e50);
}

/* CTA section */
.cta-section {
    background: linear-gradient(135deg, var(--primary-color, #2c3e50) 0%, #34495e 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    margin-top: 4rem;
}

.cta-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn-primary {
    background: white;
    color: var(--primary-color, #2c3e50);
}

.btn-primary:hover {
    background: transparent;
    color: white;
    border-color: white;
}

/* Error and no products messages */
.no-products,
.error {
    text-align: center;
    padding: 3rem;
    color: var(--text-color, #666);
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

.error {
    color: #e74c3c;
}

/* Responsive design */
@media (max-width: 900px) {
    .filter-buttons {
        display: none;
    }
    
    .filter-select {
        display: block;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .products-header h1 {
        font-size: 2rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .modal-image {
        height: 250px;
    }
    
    .modal-info {
        padding: 1.5rem;
    }
    
    .cta-content h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 600px) {
    .products-main {
        padding-top: 1rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-image {
        height: 180px;
        padding: 8px;
    }
    
    .product-image img {
        height: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        width: auto !important;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .modal-image {
        height: 200px;
        padding: 15px;
    }
    
    .modal-image img {
        height: calc(100% - 30px) !important;
        max-width: calc(100% - 30px) !important;
        width: auto !important;
    }
    
    .modal-info h3 {
        font-size: 1.25rem;
    }
    
    .cta-section {
        padding: 3rem 0;
    }
    
    .cta-content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .modal-content {
        margin: 5% auto;
    }
    
    .modal-info {
        padding: 1rem;
    }
}
