/* Marketplace TROC - Estilos estilo Amazon */
.marketplace-troc-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header */
.marketplace-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.marketplace-hero h1 {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.marketplace-hero p {
    font-size: 1.2em;
    margin: 0;
    opacity: 0.9;
}

/* Filtros */
.marketplace-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.filter-group select,
.filter-group input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.btn-filter {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 25px;
}

.btn-filter:first-of-type {
    background: #ff9900;
    color: white;
}

.btn-filter:first-of-type:hover {
    background: #e68900;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Barra de búsqueda */
.search-bar {
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #ff9900;
    border-right: none;
    border-radius: 50px 0 0 50px;
    font-size: 16px;
    outline: none;
}

.search-btn {
    padding: 15px 30px;
    background: #ff9900;
    color: white;
    border: none;
    border-radius: 0 50px 50px 0;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.search-btn:hover {
    background: #e68900;
}

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

.producto-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    position: relative;
}

.producto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.producto-imagen {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.producto-card:hover .producto-imagen img {
    transform: scale(1.05);
}

.badge-oferta {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff4444;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.producto-info {
    padding: 20px;
}

.producto-categoria span {
    background: #e7f3ff;
    color: #007cba;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.producto-titulo {
    margin: 10px 0;
    font-size: 1.1em;
    line-height: 1.4;
}

.producto-titulo a {
    color: #2d3748;
    text-decoration: none;
}

.producto-titulo a:hover {
    color: #ff9900;
}

/* Rating */
.producto-rating {
    display: flex;
    align-items: center;
    margin: 8px 0;
    gap: 8px;
}

.estrellas {
    position: relative;
    display: inline-block;
    font-size: 1.2em;
    color: #ddd;
}

.estrellas::before {
    content: '★★★★★';
    position: absolute;
    left: 0;
    top: 0;
    width: calc(var(--rating) * 20%);
    overflow: hidden;
    color: #ffb400;
}

.rating-count {
    font-size: 0.9em;
    color: #6b7280;
}

/* Precios */
.producto-precios {
    margin: 12px 0;
}

.precio-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.9em;
    margin-right: 8px;
}

.precio-actual {
    font-size: 1.4em;
    font-weight: 700;
    color: #1f2937;
}

/* TROC Info */
.producto-troc {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

.troc-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.troc-icon {
    font-size: 1.2em;
}

.troc-precio {
    font-weight: 600;
    color: #856404;
}

/* Ganancia afiliado */
.ganancia-afiliado {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

.ganancia-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ganancia-icon {
    font-size: 1.1em;
}

.ganancia-texto {
    font-size: 0.9em;
    font-weight: 600;
    color: #155724;
}

.ganancia-detalle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ganancia-porcentaje {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.ganancia-monto {
    font-weight: 700;
    color: #155724;
}

/* Acciones */
.producto-acciones {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.btn-ver-producto,
.btn-generar-enlace,
.btn-login-afiliado {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-ver-producto {
    background: #007cba;
    color: white;
}

.btn-ver-producto:hover {
    background: #005a87;
}

.btn-generar-enlace {
    background: #28a745;
    color: white;
}

.btn-generar-enlace:hover {
    background: #218838;
}

.btn-login-afiliado {
    background: #6f42c1;
    color: white;
}

.btn-login-afiliado:hover {
    background: #5a2d91;
}

/* Cargar más */
.load-more-section {
    text-align: center;
    margin: 40px 0;
}

.btn-cargar-mas {
    background: #ff9900;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cargar-mas:hover {
    background: #e68900;
    transform: translateY(-2px);
}

/* Loading spinner */
.loading-spinner {
    text-align: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff9900;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 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);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    z-index: 1;
}

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

/* Grid de categorías */
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.categoria-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

.categoria-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.categoria-imagen {
    height: 150px;
    overflow: hidden;
}

.categoria-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.categoria-card:hover .categoria-imagen img {
    transform: scale(1.1);
}

.categoria-info {
    padding: 15px;
}

.categoria-info h3 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 1.2em;
}

.categoria-info p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9em;
    line-height: 1.4;
}

/* No products */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.no-products p {
    font-size: 1.2em;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .marketplace-troc-container {
        padding: 10px;
    }
    
    .marketplace-hero h1 {
        font-size: 2em;
    }
    
    .marketplace-filters {
        grid-template-columns: 1fr;
    }
    
    .productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 15px;
    }
    
    .search-container {
        flex-direction: column;
        border-radius: 12px;
    }
    
    .search-input {
        border-radius: 12px 12px 0 0;
        border-right: 2px solid #ff9900;
        border-bottom: none;
    }
    
    .search-btn {
        border-radius: 0 0 12px 12px;
    }
    
    .producto-acciones {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .productos-grid {
        grid-template-columns: 1fr;
    }
    
    .marketplace-hero h1 {
        font-size: 1.5em;
    }
    
    .precio-actual {
        font-size: 1.2em;
    }
}
