/**
 * Estilos para el sistema de mercado
 */

.marketplace-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.marketplace-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #007bff;
}

/* Buscador */
.marketplace-search {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #007bff;
}

#search-btn {
    padding: 12px 24px;
    white-space: nowrap;
}

/* Filtros y acciones */
.marketplace-filters {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.marketplace-filters .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.province-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.marketplace-actions {
    display: flex;
    gap: 10px;
}

/* Grid de productos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    color: #6c757d;
    font-size: 48px;
}

.product-info {
    padding: 15px;
}

.product-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-author {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.product-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-price {
    font-size: 20px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 8px;
}

.product-quantity {
    font-size: 14px;
    color: #28a745;
    margin-bottom: 12px;
}

.product-quantity.sold-out {
    color: #dc3545;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.btn-buy {
    flex: 1;
    padding: 10px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-buy:hover {
    background: #218838;
}

.btn-buy:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #007bff;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Mensajes */
.loading-message,
.no-products {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.modal-close:hover {
    color: #000;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

#purchase-price-info {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

#purchase-price-info .price-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

#purchase-price-info .price-item:last-child {
    margin-bottom: 0;
    font-weight: bold;
    font-size: 18px;
    padding-top: 8px;
    border-top: 1px solid #dee2e6;
}

/* Responsive */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .marketplace-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .marketplace-actions {
        width: 100%;
    }
    
    .marketplace-actions button {
        flex: 1;
    }
    
    .marketplace-search {
        flex-direction: column;
    }
}

