/* ===== STIVO Compare — shared styles ===== */

.btn-compare {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-compare:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-compare svg {
    width: 18px;
    height: 18px;
}

.btn-compare-count {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Card overlay button */
.vehicle-card-compare {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    z-index: 3;
    padding: 0;
    color: #fff;
}

.vehicle-card-compare:hover {
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.7);
}

.vehicle-card-compare svg {
    width: 17px;
    height: 17px;
    stroke-width: 2.2;
}

.vehicle-card-compare.active {
    background: rgba(5, 150, 105, 0.85);
}

.vehicle-card-compare.active svg {
    stroke: #fff;
}

/* Detail page action button */
.btn-action-circle.btn-compare {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
}

.btn-action-circle.btn-compare:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-action-circle.btn-compare.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* Floating compare bar */
.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(16px);
    transform: translateY(100%);
    transition: transform 0.28s ease;
    padding: 0.85rem 1rem;
}

html.dark .compare-bar {
    background: rgba(17, 17, 17, 0.96);
}

.compare-bar.open {
    transform: translateY(0);
}

body.compare-bar-visible {
    padding-bottom: calc(var(--compare-bar-height, 120px) + env(safe-area-inset-bottom, 0px));
}

/* Evitar que el chatbot tape los botones de la barra en móvil */
body.compare-bar-visible .stivo-agent-launcher {
    bottom: calc(var(--compare-bar-height, 120px) + 0.75rem + env(safe-area-inset-bottom, 0px));
    transition: bottom 0.28s ease;
}

body.compare-bar-visible .stivo-agent-panel {
    bottom: calc(var(--compare-bar-height, 120px) + 0.75rem + 3.65rem + env(safe-area-inset-bottom, 0px));
}

.compare-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.compare-bar-slots {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    min-width: 0;
}

.compare-bar-slot {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    border: 1.5px dashed var(--border);
    background: var(--bg-input);
    min-width: 0;
}

.compare-bar-slot.filled {
    border-style: solid;
    background: var(--bg-card);
}

.compare-bar-slot.empty {
    justify-content: center;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.65rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
}

.compare-bar-slot.empty svg {
    width: 18px;
    height: 18px;
}

.compare-bar-slot-img {
    width: 52px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-bar-slot-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compare-bar-slot-img svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.compare-bar-slot-info {
    flex: 1;
    min-width: 0;
}

.compare-bar-slot-title {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compare-bar-slot-price {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-dark);
}

.compare-bar-slot-remove {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.compare-bar-slot-remove:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.compare-bar-slot-remove svg {
    width: 14px;
    height: 14px;
}

.compare-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.compare-bar-clear {
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.compare-bar-clear:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.compare-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.compare-bar-btn:hover {
    background: var(--accent-dark);
}

.compare-bar-btn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

@media (max-width: 768px) {
    .compare-bar-slots {
        grid-template-columns: 1fr;
    }

    .compare-bar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .compare-bar-actions {
        width: 100%;
    }

    .compare-bar-btn {
        flex: 1;
        justify-content: center;
    }

    .compare-bar-clear {
        flex: 1;
    }
}
