/* ========================================
   COMPARADOR DE EQUIPOS - La Casa del Fitness
   ======================================== */

/* --- Botón "Comparar" en cada producto --- */
.comp-btn {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 10;
    background: #ffffff;
    border: 1.5px solid #c0c0c0;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-family: 'Ubuntu', sans-serif;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.25s ease;
    opacity: 0;
    pointer-events: none;
}
.comp-btn i {
    font-size: 11px;
    transition: transform 0.3s ease;
}
.box-product {
    position: relative;
}
/* Desktop: mostrar al hover */
.box-product:hover .comp-btn {
    opacity: 1;
    pointer-events: auto;
}
/* Siempre visible si está seleccionado */
.box-product.comp-selected .comp-btn {
    opacity: 1;
    pointer-events: auto;
    background: #015f9e;
    border-color: #015f9e;
    color: #fff;
}
.box-product.comp-selected .comp-btn i {
    transform: rotate(180deg);
}
.box-product.comp-selected {
    box-shadow: 0 0 0 2px #015f9e;
    border-radius: 6px;
}
/* Hover del botón comparar */
.comp-btn:hover {
    background: #015f9e;
    border-color: #015f9e;
    color: #fff;
    transform: scale(1.05);
}
.box-product.comp-selected .comp-btn:hover {
    background: #de001a;
    border-color: #de001a;
}
/* Mobile: siempre visible */
@media (max-width: 991px) {
    .comp-btn {
        opacity: 1;
        pointer-events: auto;
        bottom: 6px;
        left: 6px;
        padding: 4px 10px;
        font-size: 11px;
    }
    .comp-btn-text {
        display: none;
    }
    .comp-btn i {
        font-size: 14px;
    }
}

/* --- Barra flotante inferior (cards) --- */
.comp-bar {
    position: fixed;
    bottom: -300px;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #014f84 0%, #0174b5 100%);
    color: #fff;
    padding: 14px 20px;
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -6px 30px rgba(0,0,0,0.3);
    font-family: 'Ubuntu', sans-serif;
    border-top: 3px solid rgba(255,255,255,0.15);
}
.comp-bar.comp-bar--visible {
    bottom: 0;
}
.comp-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.comp-bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.comp-bar-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comp-bar-title i {
    font-size: 16px;
    opacity: 0.8;
}
.comp-bar-count {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 400;
}
.comp-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.comp-bar-btn {
    background: #fff;
    color: #015f9e;
    border: none;
    border-radius: 25px;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Ubuntu', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.comp-bar-btn:hover {
    background: #e8f0fe;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.comp-bar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.comp-bar-clear {
    background: none;
    border: 1px solid rgba(255,255,255,0.35);
    color: rgba(255,255,255,0.85);
    border-radius: 25px;
    padding: 8px 18px;
    font-size: 12px;
    font-family: 'Ubuntu', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.comp-bar-clear:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Cards dentro de la barra */
.comp-bar-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 8px 0 2px;
    -webkit-overflow-scrolling: touch;
    justify-content: center;
}
.comp-bar-card {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 340px;
    flex-shrink: 0;
    position: relative;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}
.comp-bar-card:hover {
    background: rgba(255,255,255,0.18);
}
.comp-bar-card-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 3px;
    flex-shrink: 0;
}
.comp-bar-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.comp-bar-card-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.comp-bar-card-price {
    font-size: 16px;
    font-weight: 700;
    color: #a8dbff;
    line-height: 1.2;
}
.comp-bar-card-cuotas {
    font-size: 10px;
    opacity: 0.7;
    line-height: 1.2;
}
.comp-bar-card-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
    padding: 0;
}
.comp-bar-card-remove:hover {
    background: #de001a;
    border-color: #de001a;
    transform: scale(1.1);
}
/* Slot vacío */
.comp-bar-card--empty {
    background: rgba(255,255,255,0.06);
    border: 2px dashed rgba(255,255,255,0.2);
    min-width: 280px;
    justify-content: center;
    padding: 18px 12px;
}
.comp-bar-card--empty span {
    font-size: 12px;
    opacity: 0.45;
    font-style: italic;
}

/* Mobile bar */
@media (max-width: 767px) {
    .comp-bar {
        padding: 10px 12px;
    }
    .comp-bar-top {
        flex-wrap: wrap;
        gap: 6px;
    }
    .comp-bar-title {
        font-size: 13px;
        white-space: nowrap;
    }
    .comp-bar-count {
        display: inline;
    }
    .comp-bar-cards {
        flex-direction: column;
        gap: 6px;
        overflow-x: hidden;
        justify-content: flex-start;
    }
    .comp-bar-card {
        min-width: unset;
        max-width: 100%;
        width: 100%;
        padding: 8px 10px;
        gap: 8px;
    }
    .comp-bar-card-img {
        width: 40px;
        height: 40px;
    }
    .comp-bar-card-name {
        font-size: 11px;
    }
    .comp-bar-card-price {
        font-size: 14px;
    }
    .comp-bar-card-cuotas {
        font-size: 9px;
    }
    .comp-bar-card--empty {
        min-width: unset;
        width: 100%;
        padding: 10px;
    }
    .comp-bar-btn {
        padding: 8px 18px;
        font-size: 13px;
    }
    .comp-bar-clear {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* --- Modal de comparación --- */
.comp-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: 'Ubuntu', sans-serif;
}
.comp-modal.comp-modal--open {
    display: flex;
}
.comp-modal-content {
    background: #fff;
    width: 100%;
    max-width: 1100px;
    max-height: 85vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: compSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
}
@keyframes compSlideUp {
    from { transform: translateY(40px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.comp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #e8e8e8;
    background: linear-gradient(135deg, #015f9e 0%, #0174b5 100%);
    color: #fff;
}
.comp-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comp-modal-title i {
    font-size: 16px;
    opacity: 0.8;
}
.comp-modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    font-size: 20px;
    color: #fff;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    border-radius: 8px;
    transition: background 0.2s;
}
.comp-modal-close:hover {
    background: rgba(255,255,255,0.3);
}
.comp-modal-body {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding-bottom: 8px;
}

/* --- Tabla de comparación --- */
.comp-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}
.comp-table th,
.comp-table td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid #d9d9d9;
    vertical-align: middle;
    font-size: 13px;
}
.comp-table tr:hover td {
    background: #fafcfe;
}
.comp-table tr:hover td:first-child {
    background: #f0f4f8;
}
.comp-table th:first-child,
.comp-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: #555;
    background: #f7f8fa;
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 140px;
    max-width: 160px;
    font-size: 12px;
    border-right: 2px solid #e8e8e8;
}

/* Header de cada producto en la tabla */
.comp-product-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 5px;
}
.comp-product-head img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 10px;
    background: #f5f5f5;
    padding: 4px;
    border: 1px solid #eee;
}
.comp-product-head-name {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    text-align: center;
    line-height: 1.3;
}
.comp-product-head-tipo {
    font-size: 11px;
    color: #888;
}
.comp-product-head-link {
    display: inline-block;
    font-size: 11px;
    color: #015f9e;
    text-decoration: none;
    margin-top: 2px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #e8f2fb;
    transition: background 0.2s;
}
.comp-product-head-link:hover {
    background: #d0e5f7;
    text-decoration: none;
}

/* Celdas de precio */
.comp-precio-normal {
    font-size: 18px;
    font-weight: 700;
    color: #015f9e;
}
.comp-precio-tachado {
    font-size: 12px;
    color: #aaa;
    text-decoration: line-through;
}
.comp-precio-promo {
    font-size: 16px;
    font-weight: 700;
    color: #de001a;
}
.comp-precio-promo-label {
    font-size: 10px;
    color: #de001a;
    text-transform: uppercase;
    font-weight: 600;
}
.comp-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.comp-badge-green {
    background: #e8f5e9;
    color: #2e7d32;
}
.comp-badge-blue {
    background: #e3f2fd;
    color: #1565c0;
}
.comp-badge-gray {
    background: #f5f5f5;
    color: #888;
}
.comp-badge-off {
    background: #de001a;
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}
/* Desglose de cuotas */
.comp-cuotas-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}
.comp-cuota-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.3;
}
.comp-cuota-sin-interes {
    background: #f0f7ed;
    color: #2e7d32;
    font-weight: 600;
}
.comp-cuota-con-interes {
    background: #f5f5f5;
    color: #777;
}
.comp-cuota-cant {
    white-space: nowrap;
}
.comp-cuota-valor {
    white-space: nowrap;
    font-weight: 700;
}
.comp-cuota-sin-interes .comp-cuota-valor {
    color: #1b5e20;
}
.comp-cuota-con-interes .comp-cuota-valor {
    color: #555;
}

/* Highlight de mejor valor */
.comp-best {
    background: #e8f5e9 !important;
    font-weight: 700;
}

/* Sección agrupada */
.comp-table .comp-section-row td {
    background: linear-gradient(135deg, #015f9e 0%, #0174b5 100%) !important;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 14px;
    border-bottom: none;
}

/* Fila removible */
.comp-product-remove {
    display: inline-block;
    background: none;
    border: 1px solid #ddd;
    color: #999;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 6px;
    transition: all 0.2s;
    line-height: 22px;
}
.comp-product-remove:hover {
    background: #de001a;
    border-color: #de001a;
    color: #fff;
}

/* --- Responsive modal --- */
@media (max-width: 767px) {
    .comp-modal {
        padding: 0;
        align-items: flex-end;
    }
    .comp-modal-content {
        max-height: 95vh;
        border-radius: 14px 14px 0 0;
    }
    .comp-modal-header {
        padding: 14px 16px;
    }
    .comp-modal-title {
        font-size: 15px;
    }
    /* Ocultar tabla en mobile */
    .comp-table { display: none; }
    .comp-scroll-hint { display: none; }
}

/* ====== Layout mobile: tarjetas apiladas ====== */
.comp-mobile {
    display: none;
}
@media (max-width: 767px) {
    .comp-mobile {
        display: block;
        padding: 12px;
    }
}

/* Header con productos en mobile */
.comp-m-products {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.comp-m-product-card {
    flex: 1;
    background: #f7f8fa;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    position: relative;
    border: 1px solid #e8e8e8;
}
.comp-m-product-card img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 3px;
    border: 1px solid #eee;
}
.comp-m-product-name {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    margin-top: 6px;
    line-height: 1.2;
}
.comp-m-product-tipo {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}
.comp-m-product-link {
    display: inline-block;
    font-size: 10px;
    color: #015f9e;
    text-decoration: none;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e8f2fb;
}
.comp-m-product-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #de001a;
    border: 2px solid #fff;
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

/* Sección agrupada mobile */
.comp-m-section {
    background: linear-gradient(135deg, #015f9e 0%, #0174b5 100%);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 7px 12px;
    border-radius: 8px;
    margin: 12px 0 8px;
}

/* Fila de atributo mobile */
.comp-m-row {
    margin-bottom: 6px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
}
.comp-m-row-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    padding: 6px 10px;
    background: #f7f8fa;
    border-bottom: 1px solid #e8e8e8;
}
.comp-m-row-label i {
    margin-right: 4px;
    font-size: 10px;
}
.comp-m-row-values {
    display: flex;
}
.comp-m-row-val {
    flex: 1;
    padding: 8px 10px;
    text-align: center;
    font-size: 12px;
    border-right: 1px solid #eee;
}
.comp-m-row-val:last-child {
    border-right: none;
}
.comp-m-row-val.comp-best {
    background: #e8f5e9 !important;
}

/* Precios mobile */
.comp-m-row-val .comp-precio-normal {
    font-size: 16px;
}
.comp-m-row-val .comp-precio-promo {
    font-size: 14px;
}
.comp-m-row-val .comp-precio-tachado {
    font-size: 11px;
}

/* Cuotas mobile */
.comp-m-row-val .comp-cuotas-list {
    text-align: left;
}
.comp-m-row-val .comp-cuota-row {
    font-size: 10px;
    padding: 2px 4px;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}
.comp-m-row-val .comp-cuota-cant {
    white-space: normal;
    font-size: 9px;
    line-height: 1.2;
}
.comp-m-row-val .comp-cuota-valor {
    font-size: 10px;
    white-space: normal;
}

/* --- Mensaje inline en la barra --- */
.comp-bar-msg {
    display: none;
    background: rgba(255,220,100,0.2);
    border: 1px solid rgba(255,220,100,0.5);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: #fff;
    text-align: center;
    animation: compMsgFade 0.3s ease;
}
.comp-bar-msg i {
    margin-right: 5px;
}
@keyframes compMsgFade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
