/* assets/css/compare.css */

.cc-compare-tray {
    position: fixed;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(120%);
    z-index: 9998;
    width: min(calc(100vw - 24px), 760px);
    opacity: 0;
    pointer-events: none;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .22s ease;
}

.cc-compare-tray.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.cc-compare-card {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(15, 23, 42, .10);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .20);
    border-radius: 24px;
    padding: 10px;
}

.dark .cc-compare-card {
    background: rgba(17, 17, 20, .92);
    border-color: rgba(255, 255, 255, .10);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

.cc-compare-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.cc-compare-products {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.cc-compare-product {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 58px;
    width: 58px;
    max-width: 58px;
    padding: 7px;
    border-radius: 18px;
    background: rgba(248, 250, 252, .92);
    border: 1px solid rgba(15, 23, 42, .08);
    overflow: hidden;
    transition: width .22s ease, max-width .22s ease, box-shadow .22s ease;
}

.cc-compare-product:hover,
.cc-compare-product:focus-within {
    width: 176px;
    max-width: 176px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
}

.dark .cc-compare-product {
    background: rgba(255, 255, 255, .055);
    border-color: rgba(255, 255, 255, .08);
}

.cc-compare-product img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    flex-shrink: 0;
}

.cc-compare-thumb {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: #fff;
    border: 2px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    flex-shrink: 0;
}

.cc-compare-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cc-compare-thumb.cc-score-good {
    border-color: #10b981;
}

.cc-compare-thumb.cc-score-mid {
    border-color: #f59e0b;
}

.cc-compare-thumb.cc-score-bad {
    border-color: #ef4444;
}

.cc-compare-thumb.cc-score-unknown {
    border-color: #cbd5e1;
}

.cc-compare-product-text {
    min-width: 104px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .18s ease, transform .18s ease;
}

.cc-compare-product:hover .cc-compare-product-text,
.cc-compare-product:focus-within .cc-compare-product-text {
    opacity: 1;
    transform: translateX(0);
}

.cc-compare-product-text {
    min-width: 0;
}

.cc-compare-product-name {
    display: block;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.05;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .cc-compare-product-name {
    color: #fff;
}

.cc-compare-product-brand {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-compare-remove {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 0;
    background: rgba(15, 23, 42, .06);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.dark .cc-compare-remove {
    background: rgba(255, 255, 255, .08);
    color: #cbd5e1;
}

.cc-compare-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-compare-count {
    font-size: 11px;
    font-weight: 1000;
    letter-spacing: .08em;
    color: #64748b;
    white-space: nowrap;
}

.dark .cc-compare-count {
    color: #cbd5e1;
}

.cc-compare-open {
    height: 46px;
    border-radius: 17px;
    padding: 0 16px;
    border: 0;
    cursor: pointer;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 13px;
    font-weight: 1000;
    letter-spacing: -.01em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 14px 30px rgba(16, 185, 129, .28);
    transition: transform .18s ease, box-shadow .18s ease;
}

.cc-compare-open:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(16, 185, 129, .34);
}

.cc-compare-open:active {
    transform: scale(.97);
}

.cc-compare-clear {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    border: 0;
    cursor: pointer;
    background: rgba(15, 23, 42, .06);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dark .cc-compare-clear {
    background: rgba(255, 255, 255, .08);
    color: #cbd5e1;
}

.cc-compare-toast {
    position: fixed;
    left: 50%;
    bottom: calc(max(18px, env(safe-area-inset-bottom)) + 92px);
    transform: translateX(-50%) translateY(20px);
    z-index: 10001;
    max-width: calc(100vw - 32px);
    padding: 12px 16px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .28);
    transition: opacity .18s ease, transform .18s ease;
}

.cc-compare-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dark .cc-compare-toast {
    background: #fff;
    color: #09090b;
}

.js-compare-btn.is-compared {
    background: #10b981 !important;
    color: white !important;
    border-color: rgba(16, 185, 129, .85) !important;
}

.js-compare-btn.is-compared i {
    transform: scale(1.08);
}

@media (max-width: 640px) {
    .cc-compare-tray {
        width: calc(100vw - 20px);
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .cc-compare-card {
        border-radius: 22px;
        padding: 9px;
    }

    .cc-compare-row {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .cc-compare-products {
        overflow-x: auto;
        padding-bottom: 1px;
        scrollbar-width: none;
    }

    .cc-compare-products::-webkit-scrollbar {
        display: none;
    }

    .cc-compare-products {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding: 1px 2px 3px;
    }

    .cc-compare-product {
        min-width: 58px;
        width: 58px;
        max-width: 58px;
    }

    .cc-compare-product:hover,
    .cc-compare-product:focus-within {
        width: 150px;
        max-width: 150px;
    }

    .cc-compare-add-slot {
        display: inline-flex !important;
    }

    .cc-compare-actions {
        display: grid;
        grid-template-columns: auto 1fr auto;
        width: 100%;
    }

    .cc-compare-open {
        width: 100%;
        justify-content: center;
    }
}

/* Página comparar.php */

.cc-compare-page {
    background:
        radial-gradient(circle at top left, rgba(16, 185, 129, .10), transparent 32rem),
        radial-gradient(circle at top right, rgba(59, 130, 246, .08), transparent 30rem);
}

.cc-compare-panel {
    position: relative;
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 32px;
    box-shadow: 0 18px 60px rgba(15, 23, 42, .08);
    padding: 20px;
    overflow: hidden;
}

.dark .cc-compare-panel {
    background: rgba(24, 24, 27, .86);
    border-color: rgba(255, 255, 255, .07);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .26);
}

.cc-compare-hero-panel {
    padding: 24px;
}

.cc-compare-hero-glow {
    position: absolute;
    inset: -160px -120px auto auto;
    width: 280px;
    height: 280px;
    border-radius: 999px;
    background: rgba(16, 185, 129, .16);
    filter: blur(20px);
    pointer-events: none;
}

.cc-compare-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(248, 250, 252, .9);
    color: #64748b;
    font-size: 12px;
    font-weight: 1000;
    white-space: nowrap;
    text-decoration: none !important;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}

.cc-compare-chip:hover {
    transform: translateY(-1px);
}

.cc-compare-chip.is-active {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.dark .cc-compare-chip {
    background: rgba(255, 255, 255, .055);
    border-color: rgba(255, 255, 255, .08);
    color: #cbd5e1;
}

.dark .cc-compare-chip.is-active {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.cc-compare-chips {
    scrollbar-width: none;
}

.cc-compare-chips::-webkit-scrollbar {
    display: none;
}

.cc-match-icon,
.cc-diff-icon {
    width: 44px;
    height: 44px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cc-match-excellent,
.cc-match-good {
    background: rgba(16, 185, 129, .12);
    color: #10b981;
}

.cc-match-weak {
    background: rgba(245, 158, 11, .12);
    color: #f59e0b;
}

.cc-match-bad {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
}

.cc-match-neutral {
    background: rgba(100, 116, 139, .12);
    color: #64748b;
}

.cc-diff-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 22px;
    padding: 14px;
    background: rgba(248, 250, 252, .9);
    border: 1px solid rgba(15, 23, 42, .06);
}

.dark .cc-diff-card {
    background: rgba(255, 255, 255, .045);
    border-color: rgba(255, 255, 255, .06);
}

.cc-diff-icon {
    width: 38px;
    height: 38px;
    border-radius: 15px;
    background: rgba(16, 185, 129, .12);
    color: #10b981;
}

.cc-product-compare-card {
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 30px;
    padding: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .07);
}

.dark .cc-product-compare-card {
    background: rgba(24, 24, 27, .86);
    border-color: rgba(255, 255, 255, .07);
}

.cc-nutrient-card {
    border-radius: 18px;
    padding: 12px;
    background: rgba(248, 250, 252, .9);
    border: 1px solid rgba(15, 23, 42, .06);
}

.dark .cc-nutrient-card {
    background: rgba(255, 255, 255, .045);
    border-color: rgba(255, 255, 255, .06);
}

.cc-bar-track {
    width: 100%;
    height: 9px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, .08);
}

.dark .cc-bar-track {
    background: rgba(255, 255, 255, .08);
}

.cc-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #10b981, #14b8a6);
}

.cc-mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border-radius: 22px;
    background: rgba(248, 250, 252, .9);
    border: 1px solid rgba(15, 23, 42, .06);
}

.dark .cc-mini-row {
    background: rgba(255, 255, 255, .045);
    border-color: rgba(255, 255, 255, .06);
}

.cc-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .06);
    color: #475569;
    font-size: 11px;
    font-weight: 1000;
    white-space: nowrap;
}

.dark .cc-pill {
    background: rgba(255, 255, 255, .07);
    color: #cbd5e1;
}

@media (max-width: 640px) {
    .cc-compare-panel {
        border-radius: 26px;
        padding: 16px;
    }

    .cc-compare-hero-panel {
        padding: 18px;
    }

    .cc-mini-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .cc-pill {
        font-size: 10px;
        min-height: 28px;
    }
}

/* Nutrición con color semántico */

.cc-nutrient-block {
    border-radius: 24px;
    padding: 14px;
    background: rgba(248, 250, 252, .58);
    border: 1px solid rgba(15, 23, 42, .055);
}

.dark .cc-nutrient-block {
    background: rgba(255, 255, 255, .025);
    border-color: rgba(255, 255, 255, .055);
}

.cc-nutrient-main-icon {
    width: 38px;
    height: 38px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cc-nutrient-energy .cc-nutrient-main-icon,
.cc-nutrient-energy .cc-bar-fill {
    background: #ef4444;
    color: #fff;
}

.cc-nutrient-sugar .cc-nutrient-main-icon,
.cc-nutrient-sugar .cc-bar-fill {
    background: #f97316;
    color: #fff;
}

.cc-nutrient-protein .cc-nutrient-main-icon,
.cc-nutrient-protein .cc-bar-fill {
    background: #10b981;
    color: #fff;
}

.cc-nutrient-fiber .cc-nutrient-main-icon,
.cc-nutrient-fiber .cc-bar-fill {
    background: #8b5cf6;
    color: #fff;
}

.cc-nutrient-salt .cc-nutrient-main-icon,
.cc-nutrient-salt .cc-bar-fill {
    background: #64748b;
    color: #fff;
}

.cc-nutrient-satfat .cc-nutrient-main-icon,
.cc-nutrient-satfat .cc-bar-fill {
    background: #f59e0b;
    color: #fff;
}

.cc-nutrient-default .cc-nutrient-main-icon,
.cc-nutrient-default .cc-bar-fill {
    background: #14b8a6;
    color: #fff;
}

/* Procesado */

.cc-processing-card {
    border-radius: 28px;
    padding: 16px;
    background: rgba(248, 250, 252, .92);
    border: 1px solid rgba(15, 23, 42, .07);
}

.dark .cc-processing-card {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .07);
}

.cc-score-mini {
    min-height: 66px;
    border-radius: 20px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid transparent;
}

.cc-score-mini span {
    font-size: 9px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: .09em;
    opacity: .75;
}

.cc-score-mini strong {
    margin-top: 3px;
    font-size: 22px;
    font-weight: 1000;
    line-height: 1;
}

.cc-nutriscore-a,
.cc-nova-1,
.cc-additive-ok {
    background: rgba(16, 185, 129, .12);
    color: #059669;
    border-color: rgba(16, 185, 129, .22);
}

.cc-nutriscore-b,
.cc-nova-2 {
    background: rgba(132, 204, 22, .14);
    color: #65a30d;
    border-color: rgba(132, 204, 22, .24);
}

.cc-nutriscore-c,
.cc-nova-3 {
    background: rgba(245, 158, 11, .14);
    color: #d97706;
    border-color: rgba(245, 158, 11, .24);
}

.cc-nutriscore-d,
.cc-nutriscore-e,
.cc-nova-4,
.cc-additive-alert {
    background: rgba(239, 68, 68, .12);
    color: #dc2626;
    border-color: rgba(239, 68, 68, .24);
}

.cc-nutriscore-unknown,
.cc-nova-unknown {
    background: rgba(100, 116, 139, .12);
    color: #64748b;
    border-color: rgba(100, 116, 139, .22);
}

.cc-additives-details {
    border-radius: 20px;
    background: rgba(255, 255, 255, .70);
    border: 1px solid rgba(15, 23, 42, .06);
    padding: 12px;
}

.dark .cc-additives-details {
    background: rgba(255, 255, 255, .035);
    border-color: rgba(255, 255, 255, .07);
}

.cc-additives-details summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    font-weight: 1000;
    color: #0f172a;
}

.dark .cc-additives-details summary {
    color: #fff;
}

.cc-additives-details summary::-webkit-details-marker {
    display: none;
}

.cc-additives-details[open] summary i {
    transform: rotate(180deg);
}

.cc-additive-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid transparent;
}

.cc-additive-badge {
    flex-shrink: 0;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 9px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.cc-additive-high {
    background: rgba(239, 68, 68, .10);
    border-color: rgba(239, 68, 68, .18);
}

.cc-additive-high .cc-additive-badge {
    background: #ef4444;
    color: #fff;
}

.cc-additive-medium {
    background: rgba(245, 158, 11, .10);
    border-color: rgba(245, 158, 11, .20);
}

.cc-additive-medium .cc-additive-badge {
    background: #f59e0b;
    color: #fff;
}

.cc-additive-good {
    background: rgba(16, 185, 129, .10);
    border-color: rgba(16, 185, 129, .20);
}

.cc-additive-good .cc-additive-badge {
    background: #10b981;
    color: #fff;
}

.cc-additive-neutral {
    background: rgba(100, 116, 139, .08);
    border-color: rgba(100, 116, 139, .14);
}

.cc-additive-neutral .cc-additive-badge {
    background: #64748b;
    color: #fff;
}

@media (max-width: 900px) {
    .cc-compare-top-layout {
        grid-template-columns: 1fr;
    }

    .cc-compare-slots {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .cc-compare-slot {
        min-height: 92px;
        border-radius: 20px;
    }

    .cc-compare-slot-link {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 8px;
        padding: 9px;
    }

    .cc-compare-slot-img {
        width: 40px;
        height: 40px;
    }

    .cc-compare-slot-name {
        font-size: 11px;
    }

    .cc-compare-search-dialog {
        border-radius: 28px;
        padding: 18px;
    }
}

.cc-compare-collapse,
.cc-compare-expand {
    position: absolute;
    left: 50%;
    border: 0;
    cursor: pointer;
    width: 58px;
    height: 28px;
    border-radius: 999px 999px 0 0;
    background: rgba(255, 255, 255, .94);
    color: #64748b;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .10);
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dark .cc-compare-collapse,
.dark .cc-compare-expand {
    background: rgba(17, 17, 20, .94);
    color: #cbd5e1;
}

.cc-compare-collapse {
    top: -26px;
}

.cc-compare-expand {
    bottom: 0;
    border-radius: 999px 999px 0 0;
    display: none;
}

.cc-compare-tray.is-collapsed {
    transform: translateX(-50%) translateY(calc(100% - 22px));
    opacity: 1;
    pointer-events: auto;
}

.cc-compare-tray.is-collapsed .cc-compare-card,
.cc-compare-tray.is-collapsed .cc-compare-collapse {
    opacity: 0;
    pointer-events: none;
}

.cc-compare-tray.is-collapsed .cc-compare-expand {
    display: inline-flex;
    bottom: calc(100% - 22px);
}

.cc-compare-add-slot {
    border-style: dashed;
    cursor: pointer;
    color: #64748b;
}

.cc-compare-add-slot:hover {
    background: rgba(16, 185, 129, .08);
    border-color: rgba(16, 185, 129, .35);
}

.cc-compare-add-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(16, 185, 129, .12);
    color: #10b981;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cc-compare-tray {
    bottom: max(86px, env(safe-area-inset-bottom) + 74px);
}

@media (min-width: 768px) {
    .cc-compare-tray {
        bottom: 24px;
    }
}

.cc-compare-remove {
    opacity: 0;
    transform: scale(.8);
    transition: opacity .18s ease, transform .18s ease;
}

.cc-compare-product:hover .cc-compare-remove,
.cc-compare-product:focus-within .cc-compare-remove {
    opacity: 1;
    transform: scale(1);
}