/**
 * Estilos para Perfil Público de Vendedor (Final - Ronda 6)
 * Refinando: Burbujas pequeñas, Precio azul y Carrito a la derecha
 */

/* ========================================
   CONTENEDOR PRINCIPAL Y FIX DE ANCHO ASTRA
   ======================================== */
/* OPCIÓN NUCLEAR: Anulamos la variable interna de Astra y su selector específico */
:root {
    --ast-narrow-container-width: 1200px !important;
}

.ast-narrow-container .site-content .ast-container,
html body .ast-container, 
html body #primary {
    max-width: 1200px !important;
    width: 100% !important;
    margin: 0 auto !important;
}

.tradea-vendor-profile-wrapper {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
    background: transparent;
}

/* ========================================
   CABECERA DEL PERFIL
   ======================================== */
.tvp-header {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.tvp-header h1 {
    margin: 0 0 8px;
    font-size: 28px;
    color: #1e293b !important;
    font-weight: 700;
}

.tvp-header p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.tvp-rating {
    text-align: right;
}

.tvp-stars {
    font-size: 22px;
    line-height: 1;
}

.tvp-stars .star-filled {
    color: #fbbf24;
}

.tvp-stars .star-empty {
    color: #cbd5e1;
}

.tvp-rating-info {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* ========================================
   ESTADÍSTICAS PÚBLICAS
   ======================================== */
.tvp-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 35px;
}

.tvp-stat-card {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tvp-stat-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 6px;
}

.tvp-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
}

/* ========================================
   BARRA DE FILTROS
   ======================================== */
.tvp-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 15px;
    margin-bottom: 25px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.tvp-filters input,
.tvp-filters select {
    height: 40px !important;
    padding: 0 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    background: #ffffff !important;
    color: #334155 !important;
}

/* ========================================
   GRID DE PRODUCTOS
   ======================================== */
.tvp-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    width: 100%;
}

/* 2 Columnas en móvil */
@media (max-width: 600px) {
    .tvp-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .tvp-card {
        padding: 8px;
        border-radius: 12px;
    }
    .tvp-card-traits {
        gap: 2px;
    }
    .tvp-trait {
        font-size: 8px;
        padding: 1px 4px;
    }
    .tvp-card h3 {
        font-size: 11px;
        height: 32px;
    }
    .tvp-card-price {
        font-size: 14px;
    }
    .tvp-add-cart-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

.tvp-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.tvp-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.tvp-card-img-wrap {
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: 10px;
    background: #f8fafc;
}

.tvp-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tvp-card h3 {
    margin: 2px 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: #1e293b;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ========================================
   BADGES (BURBUJAS MÁS PEQUEÑAS)
   ======================================== */
.tvp-card-expansion {
    margin-bottom: 4px;
}

.tvp-card-expansion span {
    display: inline-block;
    font-size: 10px;
    /* Reducido */
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 8px;
    /* Compacto */
    border-radius: 4px;
    font-weight: 500;
}

.tvp-card-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.tvp-trait {
    font-size: 10px;
    /* Reducido */
    padding: 2px 8px;
    /* Compacto */
    border-radius: 4px;
    font-weight: 600;
    line-height: 1;
}

.trait-lang {
    background: #eff6ff;
    color: #1d4ed8;
}

.trait-cond {
    background: #f0fdf4;
    color: #15803d;
}

.trait-ver {
    background: #faf5ff;
    color: #7e22ce;
}

/* ========================================
   FOOTER: PRECIO Y CARRITO
   ======================================== */
.tvp-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    /* Alineados al fondo */
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}

.tvp-price-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tvp-card-price {
    font-size: 18px;
    font-weight: 800;
    color: #00a8e8 !important;
    /* Azul vibrante */
}

.tvp-card-stock {
    font-size: 10px;
    /* Stock pequeño */
    color: #94a3b8;
    margin-top: -2px;
}

/* Botón Carrito Premium (Blanco con sombra) */
.tvp-add-cart-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    /* Gris suave */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.tvp-add-cart-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 6px 10px -2px rgba(0, 0, 0, 0.1);
}

.tvp-add-cart-btn.ok {
    background: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
}

/* Estructura del Header de Sección */
.tvp-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.tvp-section-title {
    margin: 0 !important;
}

.tvp-header-search {
    flex-grow: 1;
    max-width: 400px;
}

.tvp-header-search input {
    width: 100%;
    padding: 10px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 99px;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tvp-header-search input:focus {
    border-color: #8b5cf6;
    outline: none;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

/* Filtros */
.tvp-filters {
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 35px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    border: 1px solid #e2e8f0;
}

.tvp-filters select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
    transition: border 0.2s;
}

.tvp-filters select:focus {
    border-color: #8b5cf6;
    outline: none;
}

@media (max-width: 768px) {
    .tvp-section-header {
        flex-direction: column;
        align-items: stretch;
    }
    .tvp-header-search {
        max-width: none;
    }
}

/* ========================================
   DARK MODE
   ======================================== */
body.dark-mode .tradea-vendor-profile-wrapper {
    color: #f1f5f9;
}

body.dark-mode .tvp-header h1,
body.dark-mode .tvp-products h2 {
    color: #a78bfa !important;
}

body.dark-mode .tvp-header p {
    color: #94a3b8;
}

body.dark-mode .tvp-stat-card,
body.dark-mode .tvp-filters,
body.dark-mode .tvp-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-mode .tvp-header-search input,
body.dark-mode .tvp-filters select {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #ffffff !important; /* Blanco puro para alta visibilidad */
}

body.dark-mode .tvp-header-search input::placeholder {
    color: #94a3b8 !important;
}

body.dark-mode .tvp-filters select option {
    background: #1e293b;
    color: #ffffff;
}

body.dark-mode .tvp-stat-label {
    color: #94a3b8;
}

/* Panel Administrativo (PDF Tools) */
.tvp-admin-panel {
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

body.dark-mode .tvp-admin-panel {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9;
}

body.dark-mode .tvp-admin-panel h3 {
    color: #ffffff;
}

body.dark-mode .tvp-admin-panel select {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #ffffff !important;
}

body.dark-mode .tvp-stat-value {
    color: #f1f5f9;
}

/* Tarjetas y Badges en Dark Mode */
body.dark-mode .tvp-card h3 {
    color: #ffffff;
}

body.dark-mode .tvp-card-expansion span {
    background: #334155;
    color: #cbd5e1;
}

body.dark-mode .trait-lang {
    background: #1e3a8a;
    color: #bfdbfe;
}

body.dark-mode .trait-cond {
    background: #064e3b;
    color: #a7f3d0;
}

body.dark-mode .trait-ver {
    background: #4c1d95;
    color: #ddd6fe;
}

body.dark-mode .tvp-add-cart-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 480px) {
    .tvp-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .tvp-card {
        padding: 8px;
    }

    .tvp-card-price {
        font-size: 16px;
    }

    .tvp-add-cart-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
}

/* ========================================
   STORE PRODUCTS GRID (NEW)
   ======================================== */
.tsp-public-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.tsp-public-product-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}

.tsp-public-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.tsp-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    background: #f8fafc;
}

.tsp-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.tsp-promo-badge, .tsp-preorder-badge {
    position: absolute;
    top: 10px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    color: #fff;
}

.tsp-promo-badge { background: #ef4444; right: 10px; }
.tsp-preorder-badge { background: #10b981; left: 10px; }

.tsp-card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.tsp-card-body h3 {
    font-size: 16px !important;
    font-weight: 700;
    margin: 0 0 8px 0 !important;
    line-height: 1.3;
    color: #1e293b;
    height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tsp-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.tsp-badge-format {
    background: #6d28d9;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.tsp-detail-content {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid #e2e8f0;
    font-weight: 500;
}

.tsp-card-meta-secondary {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
}

.tsp-card-meta-secondary span {
    background: #f8fafc;
    padding: 1px 6px;
    border-radius: 3px;
}

.tsp-card-price {
    font-size: 18px;
    font-weight: 800;
    color: #3b82f6;
    margin-bottom: 15px;
}

.tsp-card-price del { font-size: 14px; color: #94a3b8; font-weight: 400; margin-right: 5px; }
.tsp-card-price ins { text-decoration: none; }

.tsp-card-btn {
    width: 100%;
    padding: 10px;
    background: #1e293b;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    text-decoration: none !important;
    display: block;
}

.tsp-card-btn:hover { background: #334155; transform: scale(1.02); }

body.dark-mode .tsp-public-product-card { background: #1e293b !important; border-color: #334155 !important; }
body.dark-mode .tsp-card-body h3 { color: #f9fafb; }
body.dark-mode .tsp-card-meta span { background: #334155; color: #cbd5e1; }
body.dark-mode .tsp-card-price { color: #60a5fa; }
body.dark-mode .tsp-card-btn { background: #3b82f6; }
body.dark-mode .tsp-card-btn:hover { background: #2563eb; }
/* ========================================
   ADMIN TOOLS (PDF GENERATION)
   ======================================== */
.tvp-admin-btn {
    background: #a78bfa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
}

.tvp-admin-btn:hover {
    background: #8b5cf6;
    transform: scale(1.02);
}

.tvp-admin-panel {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.tvp-admin-panel h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.tvp-pdf-controls {
    display: flex;
    gap: 10px;
}

.tvp-pdf-controls select {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: white;
}

#tvp-generate-pdf-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

/* ========================================
   ESTILOS DE IMPRESIÓN (PDF PREMIUM)
   ======================================== */
@media print {
    /* ESTRATEGIA DEFINITIVA: Ocultar TODOS los hijos directos del body excepto nuestro contenedor */
    body > *:not(#tvp-pdf-catalog-container) {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* Asegurar que el body y html no tengan márgenes que el navegador use para meter su propio header/footer */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        background: white !important;
    }

    #tvp-pdf-catalog-container {
        display: block !important;
        visibility: visible !important;
        position: relative !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        color: #1e293b !important;
    }

    /* Brand Header */
    .print-brand-row {
        text-align: left;
        margin-bottom: 25px;
        border-bottom: 4px solid #8b5cf6 !important; /* Púrpura */
        padding-bottom: 15px;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .print-site-logo {
        height: 60px;
        width: auto;
        margin-bottom: 5px;
    }

    .site-title-fallback {
        font-size: 32px;
        font-weight: 900;
        color: #1e293b;
        margin: 0;
        letter-spacing: -1px;
    }

    .print-site-tagline {
        font-size: 14px;
        color: #ef4444;
        font-weight: 700;
        text-transform: uppercase;
    }

    /* Vendor Profile Card (Inspirado en Masterset) */
    .print-vendor-card {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 25px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .print-vendor-info {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .print-vendor-avatar {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        border: 2px solid white;
        box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
        object-fit: cover;
    }

    .print-store-name {
        font-size: 22px;
        font-weight: 800;
        margin: 0;
    }

    .print-stats {
        font-size: 13px;
        color: #64748b;
    }

    /* Link box (Derecha) */
    .print-qr-link .link-box {
        background: white;
        border: 1px solid #e2e8f0;
        padding: 8px 15px;
        border-radius: 99px;
        font-size: 12px;
        color: #2563eb;
        font-weight: 600;
    }

    /* Filtros Aplicados */
    .print-applied-filters {
        margin-bottom: 20px;
        font-size: 13px;
        color: #64748b;
    }

    .print-applied-filters span {
        background: #e2e8f0;
        color: #1e293b;
        padding: 2px 10px;
        border-radius: 6px;
        margin-left: 5px;
        font-weight: 600;
    }

    /* Grid de Productos */
    .print-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
    }

    .print-card {
        border: 1px solid #f1f5f9;
        border-radius: 12px;
        padding: 8px;
        text-align: center;
        background: white;
        page-break-inside: avoid;
    }

    .print-card img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
        margin-bottom: 5px;
        box-shadow: 0 2px 4px rgb(0 0 0 / 0.1);
    }

    .print-card h4 {
        font-size: 11px;
        margin: 4px 0;
        height: 28px;
        overflow: hidden;
        line-height: 1.2;
        font-weight: 700;
    }

    .print-meta {
        font-size: 9px;
        color: #71717a;
        margin-bottom: 4px;
        line-height: 1.3;
    }

    .print-price {
        color: #2563eb;
        font-weight: 900;
        font-size: 13px;
        padding-top: 5px;
        border-top: 1px solid #f1f5f9;
    }

    /* Footer */
    .print-footer {
        margin-top: 40px;
        text-align: center;
        font-size: 10px;
        color: #94a3b8;
        border-top: 1px solid #e2e8f0;
        padding-top: 15px;
    }
}