/**
 * ECOBOX Plugin — Frontend Styles
 * Usa variáveis CSS do tema Ecolivros (--eco-*)
 *
 * @package EcolivrosEcobox
 */

/* ─── Reset & Base ────────────────────────────────────────────────────────── */

.ecobox-widget,
.ecobox-modal,
.ecobox-slot-chooser,
.ecobox-genre-picker,
.ecobox-search-panel {
    box-sizing: border-box;
    font-family: var(--eco-font, 'Inter', -apple-system, sans-serif);
    font-size: 14px;
    color: var(--eco-ink, #1a2b22);
    line-height: 1.5;
}

.ecobox-widget *,
.ecobox-modal *,
.ecobox-slot-chooser *,
.ecobox-genre-picker *,
.ecobox-search-panel * {
    box-sizing: inherit;
}

/* ─── Floating Widget ─────────────────────────────────────────────────────── */

.ecobox-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9900;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ecobox-widget[hidden] {
    display: none !important;
}

.ecobox-widget:not(.is-active) {
    display: none !important;
    pointer-events: none !important;
}

.ecobox-widget__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    min-height: 44px;
    background: var(--eco-green, #2d8b57);
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(45,139,87,0.35);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.ecobox-widget__toggle:hover {
    background: var(--eco-green-dark, #1f5a3a);
    box-shadow: 0 6px 24px rgba(45,139,87,0.45);
    transform: translateY(-1px);
}

.ecobox-widget__toggle:active {
    transform: translateY(0);
}

.ecobox-widget__label {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1;
}

/* separador subtil entre o texto e os slots */
.ecobox-widget__slots {
    padding-left: 10px;
    margin-left: 2px;
    border-left: 1px solid rgba(255,255,255,0.3);
}

.ecobox-widget__slots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ecobox-widget__slot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    border: 1.5px solid rgba(255,255,255,0.6);
    transition: background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.ecobox-widget__slot.is-filled {
    background: #fff;
    border-color: #fff;
}

.ecobox-widget__slot.is-surprise {
    background: var(--eco-orange, #f0a531);
    border-color: var(--eco-orange, #f0a531);
}

.ecobox-widget__count {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.9;
}

/* ─── Modal Base & Backdrop ───────────────────────────────────────────────── */

.ecobox-modal,
.ecobox-slot-chooser,
.ecobox-genre-picker,
.ecobox-search-panel {
    position: fixed;
    inset: 0;
    z-index: 9950;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.ecobox-modal[hidden],
.ecobox-slot-chooser[hidden],
.ecobox-genre-picker[hidden],
.ecobox-search-panel[hidden] {
    display: none !important;
}

.ecobox-modal__backdrop,
.ecobox-slot-chooser__backdrop,
.ecobox-genre-picker__backdrop,
.ecobox-search-panel__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26,43,34,0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: ecobox-fade-in 0.2s ease;
}

/* ─── Modal Panel ─────────────────────────────────────────────────────────── */

.ecobox-modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    background: var(--eco-surface, #fff);
    border-radius: var(--eco-radius-lg, 16px) var(--eco-radius-lg, 16px) 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: ecobox-slide-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 560px) {
    .ecobox-modal,
    .ecobox-slot-chooser,
    .ecobox-genre-picker,
    .ecobox-search-panel {
        align-items: center;
    }

    .ecobox-modal__panel,
    .ecobox-slot-chooser__panel,
    .ecobox-genre-picker__panel,
    .ecobox-search-panel__panel {
        border-radius: var(--eco-radius-lg, 16px);
        max-height: 85vh;
    }
}

/* ─── Modal Header ────────────────────────────────────────────────────────── */

.ecobox-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--eco-border, #d8eade);
    position: sticky;
    top: 0;
    background: var(--eco-surface, #fff);
    z-index: 2;
}

.ecobox-modal__title {
    font-family: var(--eco-font-serif, 'Fraunces', Georgia, serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--eco-ink, #1a2b22);
    margin: 0 0 2px;
    line-height: 1.2;
}

.ecobox-modal__subtitle {
    font-size: 13px;
    color: var(--eco-text-sub, #52615a);
    margin: 0;
}

.ecobox-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--eco-border, #d8eade);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    color: var(--eco-text-sub, #52615a);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    margin-left: 12px;
}

.ecobox-modal__close:hover {
    background: var(--eco-green-light, #e6f3eb);
    color: var(--eco-green, #2d8b57);
    border-color: var(--eco-green, #2d8b57);
}

/* ─── Slots Grid ──────────────────────────────────────────────────────────── */

.ecobox-modal__slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px 20px;
}

/* ─── Slot Card ───────────────────────────────────────────────────────────── */

.ecobox-slot {
    border: 1.5px dashed var(--eco-border-mid, #c4d8cb);
    border-radius: var(--eco-radius, 10px);
    background: var(--eco-bg, #f3faf5);
    min-height: 90px;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}

.ecobox-slot.is-filled {
    border-style: solid;
    border-color: var(--eco-border, #d8eade);
    background: var(--eco-surface, #fff);
}

.ecobox-slot.is-surprise {
    border-color: rgba(240,165,49,0.5);
    background: #fffbf3;
}

/* Empty state */
.ecobox-slot__empty {
    height: 100%;
    min-height: 90px;
}

.ecobox-slot__add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    min-height: 90px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--eco-text-muted, #7a9080);
    padding: 12px;
    transition: color 0.15s, background 0.15s;
    border-radius: calc(var(--eco-radius, 10px) - 2px);
}

.ecobox-slot__add-btn:hover {
    color: var(--eco-green, #2d8b57);
    background: var(--eco-green-light, #e6f3eb);
}

.ecobox-slot__num {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ecobox-slot__plus {
    flex-shrink: 0;
}

/* Filled state */
.ecobox-slot__filled {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    height: 100%;
    min-height: 90px;
}

.ecobox-slot__filled[hidden] {
    display: none !important;
}

.ecobox-slot__thumb-wrap {
    flex-shrink: 0;
    position: relative;
    width: 44px;
    height: 58px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--eco-cream, #f6f3ec);
}

.ecobox-slot__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* O 'display: block' acima sobrepõe-se ao [hidden] da folha de estilos do
   browser, o que deixava uma imagem quebrada visível nos slots surpresa. */
.ecobox-slot__thumb[hidden] {
    display: none !important;
}

.ecobox-slot__surprise-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: linear-gradient(135deg, #fff8e1, #ffe082);
}

.ecobox-slot__surprise-icon[hidden] {
    display: none !important;
}

.ecobox-slot__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ecobox-slot__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--eco-ink, #1a2b22);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.ecobox-slot__sublabel {
    font-size: 11px;
    color: var(--eco-text-sub, #52615a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Preço do livro no slot */
.ecobox-slot__price {
    font-size: 11px;
    font-weight: 600;
    color: var(--eco-green, #2d8b57);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.ecobox-slot__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--eco-text-muted, #7a9080);
    padding: 0;
    align-self: flex-start;
    transition: background 0.15s, color 0.15s;
}

.ecobox-slot__remove:hover {
    background: #fde8e8;
    color: #c0392b;
}

/* ─── Price Block ─────────────────────────────────────────────────────────── */

.ecobox-modal__price {
    padding: 12px 20px;
    background: var(--eco-green-50, #f3faf5);
    border-top: 1px solid var(--eco-border, #d8eade);
    border-bottom: 1px solid var(--eco-border, #d8eade);
}

.ecobox-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Label "Preço ECOBOX" / "Suplemento" */
.ecobox-price-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--eco-text-sub, #52615a);
}

.ecobox-price-label--supplement {
    color: var(--eco-text-muted, #7a9080);
    font-weight: 500;
}

/* Wrapper para preço riscado + valor ECOBOX */
.ecobox-price-values {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Preço original riscado (valor de mercado dos livros) */
.ecobox-price-original {
    font-size: 13px;
    font-weight: 500;
    color: var(--eco-text-muted, #7a9080);
    text-decoration: line-through;
    font-variant-numeric: tabular-nums;
}

/* Preço ECOBOX (destaque) */
.ecobox-price-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--eco-green, #2d8b57);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Linha do suplemento */
.ecobox-price-row--supplement {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed var(--eco-border, #d8eade);
}

.ecobox-price-value--supplement {
    font-size: 14px;
    font-weight: 600;
    color: var(--eco-text-sub, #52615a);
}

/* Nota explicativa do suplemento */
.ecobox-price-note {
    margin: 6px 0 0;
    font-size: 11px;
    color: var(--eco-text-muted, #7a9080);
    line-height: 1.4;
    font-style: italic;
}

/* ─── Modal Message ───────────────────────────────────────────────────────── */

.ecobox-modal__message {
    padding: 10px 20px 0;
    font-size: 13px;
    color: var(--eco-text-sub, #52615a);
    min-height: 32px;
    margin: 0;
    text-align: center;
}

/* ─── Revert Upgrade ────────────────────────────────────────────────────── */

.ecobox-revert-upgrade {
    padding: 10px 20px;
    text-align: center;
}

.ecobox-revert-upgrade[hidden] {
    display: none !important;
}

.ecobox-revert-upgrade__btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--eco-text-sub, #52615a);
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.ecobox-revert-upgrade__btn:hover {
    color: var(--eco-ink, #1a2e22);
    background: var(--eco-green-50, #f3faf5);
}

/* ─── Upgrade Banner ─────────────────────────────────────────────────────── */

.ecobox-upgrade-banner {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding: 12px 20px;
    background: var(--eco-green-50, #f3faf5);
    border-top: 1px solid var(--eco-border, #d8eade);
    border-bottom: 1px solid var(--eco-border, #d8eade);
    border-left: none;
    border-right: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

.ecobox-upgrade-banner[hidden] {
    display: none !important;
}

.ecobox-upgrade-banner:hover {
    background: var(--eco-green-100, #e3f5e9);
}

.ecobox-upgrade-banner:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ecobox-upgrade-banner__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--eco-green, #2d8b57);
}

.ecobox-upgrade-banner__main::after {
    content: "→";
    font-size: 14px;
    flex-shrink: 0;
}

.ecobox-upgrade-banner__sub {
    font-size: 11px;
    color: var(--eco-text-sub, #52615a);
}

/* ─── Modal Actions ───────────────────────────────────────────────────────── */

.ecobox-modal__actions {
    padding: 12px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ecobox-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    border-radius: var(--eco-radius, 10px);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, opacity 0.2s, transform 0.15s;
    text-decoration: none;
    line-height: 1;
}

.ecobox-btn--primary {
    background: var(--eco-green, #2d8b57);
    color: #fff;
}

.ecobox-btn--primary:hover:not(:disabled) {
    background: var(--eco-green-dark, #1f5a3a);
    transform: translateY(-1px);
}

.ecobox-btn--primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.ecobox-btn--complete {
    background: var(--eco-cream, #f6f3ec);
    color: var(--eco-ink-soft, #52615a);
    border: 1px solid var(--eco-border-mid, #c4d8cb);
}

.ecobox-btn--complete:hover {
    background: var(--eco-green-light, #e6f3eb);
    color: var(--eco-green, #2d8b57);
    border-color: var(--eco-green, #2d8b57);
}

.ecobox-btn[hidden] {
    display: none !important;
}

/* ─── Slot Chooser Sub-modal ──────────────────────────────────────────────── */

.ecobox-slot-chooser__panel,
.ecobox-genre-picker__panel,
.ecobox-search-panel__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: var(--eco-surface, #fff);
    border-radius: var(--eco-radius-lg, 16px) var(--eco-radius-lg, 16px) 0 0;
    padding: 24px 20px;
    animation: ecobox-slide-up 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 560px) {
    .ecobox-slot-chooser__panel,
    .ecobox-genre-picker__panel,
    .ecobox-search-panel__panel {
        border-radius: var(--eco-radius-lg, 16px);
    }
}

.ecobox-slot-chooser__title,
.ecobox-genre-picker__title,
.ecobox-search-panel__title {
    font-family: var(--eco-font-serif, 'Fraunces', Georgia, serif);
    font-size: 17px;
    font-weight: 700;
    color: var(--eco-ink, #1a2b22);
    margin: 0 0 4px;
    text-wrap: balance;
}

.ecobox-slot-chooser__slot-num {
    font-size: 12px;
    color: var(--eco-text-muted, #7a9080);
    margin: 0 0 18px;
}

/* Chooser option buttons */
.ecobox-chooser-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.ecobox-chooser-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--eco-bg, #f3faf5);
    border: 1.5px solid var(--eco-border, #d8eade);
    border-radius: var(--eco-radius, 10px);
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}

.ecobox-chooser-option:hover {
    border-color: var(--eco-green, #2d8b57);
    background: var(--eco-green-light, #e6f3eb);
}

.ecobox-chooser-option__icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}

.ecobox-chooser-option__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--eco-ink, #1a2b22);
    margin-bottom: 2px;
}

.ecobox-chooser-option__sub {
    display: block;
    font-size: 12px;
    color: var(--eco-text-sub, #52615a);
}

.ecobox-chooser-cancel,
.ecobox-genre-cancel,
.ecobox-search-cancel {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: var(--eco-text-muted, #7a9080);
    padding: 4px 0;
    transition: color 0.15s;
}

.ecobox-chooser-cancel:hover,
.ecobox-genre-cancel:hover,
.ecobox-search-cancel:hover {
    color: var(--eco-ink, #1a2b22);
}

/* ─── Genre Picker ────────────────────────────────────────────────────────── */

.ecobox-genre-picker__title {
    margin-bottom: 16px;
}

.ecobox-genre-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    max-height: 50vh;
    overflow-y: auto;
}

@media (min-width: 400px) {
    .ecobox-genre-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.ecobox-genre-btn {
    padding: 10px 8px;
    background: var(--eco-bg, #f3faf5);
    border: 1.5px solid var(--eco-border, #d8eade);
    border-radius: var(--eco-radius-sm, 6px);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--eco-ink, #1a2b22);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    line-height: 1.3;
}

.ecobox-genre-btn:hover,
.ecobox-genre-btn.is-selected {
    background: var(--eco-green, #2d8b57);
    border-color: var(--eco-green, #2d8b57);
    color: #fff;
}

/* ─── Search Panel ────────────────────────────────────────────────────────── */

.ecobox-search-panel__panel {
    max-width: 480px;
}

.ecobox-search-panel__title {
    margin-bottom: 14px;
}

/* Search bar — estilo idêntico ao eco-header__search */
.ecobox-search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #E1E6DD;
    border-radius: 12px;
    height: 46px;
    padding: 0 6px 0 16px;
    overflow: hidden;
    transition: border-color 0.2s;
    margin-bottom: 14px;
}

.ecobox-search-bar:focus-within {
    border-color: var(--eco-green, #2d8b57);
}

.ecobox-search-bar__input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    font: 500 15px var(--eco-font, 'Inter', -apple-system, sans-serif);
    color: var(--eco-ink, #1a2b22);
    min-width: 0;
    -webkit-appearance: none;
}

.ecobox-search-bar__input::placeholder {
    color: #9aa79e;
    font-weight: 500;
}

.ecobox-search-bar__btn {
    background: #1f7a4d;
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.ecobox-search-bar__btn:hover {
    background: #196640;
}

/* Search results */
.ecobox-search-results {
    max-height: 45vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-bottom: 14px;
}

.ecobox-search-empty,
.ecobox-search-searching,
.ecobox-search-no-results {
    padding: 24px 0;
    text-align: center;
    font-size: 13px;
    color: var(--eco-text-muted, #7a9080);
    margin: 0;
}

.ecobox-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--eco-radius-sm, 6px);
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.ecobox-search-result:hover {
    background: var(--eco-green-light, #e6f3eb);
}

.ecobox-search-result + .ecobox-search-result {
    border-top: 1px solid var(--eco-border, #d8eade);
    border-radius: 0;
}

.ecobox-search-result + .ecobox-search-result:hover {
    border-radius: var(--eco-radius-sm, 6px);
    margin-top: -1px;
    position: relative;
    z-index: 1;
}

.ecobox-result-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 52px;
    border-radius: 3px;
    object-fit: cover;
    background: var(--eco-cream, #f6f3ec);
}

.ecobox-result-info {
    flex: 1;
    min-width: 0;
}

.ecobox-result-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--eco-ink, #1a2b22);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.ecobox-result-author {
    display: block;
    font-size: 12px;
    color: var(--eco-text-sub, #52615a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ecobox-result-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--eco-green, #2d8b57);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ─── Product Button (página de produto) ──────────────────────────────────── */

.ecobox-product-btn-wrap {
    margin-top: 10px;
}

.ecobox-product-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--eco-green-light, #e6f3eb);
    color: var(--eco-green-dark, #1f5a3a);
    border: 1.5px solid var(--eco-green, #2d8b57);
    border-radius: var(--eco-radius, 10px);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
    text-decoration: none;
    width: 100%;
    line-height: 1;
}

.ecobox-product-btn:hover:not(.is-added):not(.is-full) {
    background: var(--eco-green, #2d8b57);
    color: #fff;
    transform: translateY(-1px);
}

.ecobox-product-btn.is-added {
    background: var(--eco-green, #2d8b57);
    color: #fff;
    border-color: var(--eco-green, #2d8b57);
    cursor: default;
}

.ecobox-product-btn.is-full {
    background: var(--eco-cream, #f6f3ec);
    color: var(--eco-text-muted, #7a9080);
    border-color: var(--eco-border-mid, #c4d8cb);
    cursor: not-allowed;
}

.ecobox-product-btn__icon {
    font-size: 16px;
    line-height: 1;
}

.ecobox-product-btn__label {
    flex: 1;
}

.ecobox-product-btn__slot {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 400;
}

/* ─── Cart Conversion Notice ──────────────────────────────────────────────── */

/* Legacy — kept for backwards compat if someone overrides the template */
.ecobox-cart-notice { display: none; }

/* New notice (.ecn) */
.ecn {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 16px;
    row-gap: 14px;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f3faf5 0%, #e9f5ee 100%);
    border: 1.5px solid var(--eco-border-mid, #c4d8cb);
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(30, 90, 58, .06);
}

.ecn__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    grid-column: 1;
    grid-row: 1;
}

.ecn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--eco-green, #2d8b57);
    border-radius: 8px;
    flex-shrink: 0;
    color: #fff;
}

.ecn__titles { flex: 1; }

.ecn__title {
    font-weight: 800;
    font-size: 14px;
    color: var(--eco-green-dark, #1f5a3a);
    margin: 0 0 3px;
    line-height: 1.3;
}

.ecn__sub {
    font-size: 12.5px;
    color: var(--eco-ink-soft, #52615a);
    margin: 0;
    line-height: 1.4;
}

/* Slot thumbnails */
.ecn__slots {
    display: flex;
    gap: 6px;
    align-items: center;
    grid-column: 1;
    grid-row: 2;
    flex-wrap: wrap;
}

.ecn__slot {
    width: 46px; height: 56px;
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid var(--eco-border, #d8eade);
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.ecn__slot img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* CTA button */
.ecn__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    background: var(--eco-green, #2d8b57);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s, transform .12s;
    white-space: nowrap;
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    box-shadow: 0 2px 8px rgba(30, 90, 58, .22);
}

.ecn__btn:hover:not(:disabled) {
    background: var(--eco-green-dark, #1f5a3a);
    transform: translateY(-1px);
}

.ecn__btn:disabled {
    opacity: .7;
    cursor: wait;
}

.ecn__btn-arrow { flex-shrink: 0; transition: transform .18s; }
.ecn__btn:hover:not(:disabled) .ecn__btn-arrow { transform: translateX(3px); }

/* Spinner inside button */
.ecn__btn-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ecn-spin .6s linear infinite;
    flex-shrink: 0;
}
@keyframes ecn-spin { to { transform: rotate(360deg); } }

/* Responsive: stack button below on narrow screens */
@media (max-width: 480px) {
    .ecn {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .ecn__btn {
        grid-column: 1;
        grid-row: 3;
        justify-self: start;
    }
}

/* ─── Cart Item Display ───────────────────────────────────────────────────── */

.ecobox-cart-item {
    margin-top: 6px;
}

.ecobox-cart-item__slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.ecobox-cart-item__title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--eco-text, #1a2b22);
}

.ecobox-cart-item__slot-author {
    color: var(--eco-text-muted, #7a9080);
}

.ecobox-cart-item__slot {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--eco-text-sub, #52615a);
}

.ecobox-cart-item__slot-num {
    font-weight: 600;
    color: var(--eco-text-muted, #7a9080);
    min-width: 14px;
}

.ecobox-cart-item__slot-icon {
    font-size: 11px;
}

.ecobox-cart-item__slot-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ─── Loading Spinner ─────────────────────────────────────────────────────── */

.ecobox-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ecobox-spin 0.6s linear infinite;
    flex-shrink: 0;
}

.ecobox-spinner--green {
    border-color: rgba(45,139,87,0.25);
    border-top-color: var(--eco-green, #2d8b57);
}

/* ─── Animations ──────────────────────────────────────────────────────────── */

@keyframes ecobox-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ecobox-slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ecobox-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ecobox-modal__panel,
    .ecobox-slot-chooser__panel,
    .ecobox-genre-picker__panel,
    .ecobox-search-panel__panel,
    .ecobox-modal__backdrop,
    .ecobox-slot-chooser__backdrop,
    .ecobox-genre-picker__backdrop,
    .ecobox-search-panel__backdrop {
        animation: none;
    }
}

/* ─── Responsive — Mobile adjustments ────────────────────────────────────── */

@media (max-width: 399px) {
    .ecobox-widget {
        bottom: 16px;
        right: 16px;
    }

    .ecobox-widget__toggle {
        padding: 9px 12px;
        font-size: 12px;
    }

    .ecobox-modal__slots {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 12px 14px;
    }

    .ecobox-modal__header {
        padding: 16px 14px 12px;
    }

    .ecobox-modal__actions {
        padding: 10px 14px 16px;
    }

    .ecobox-modal__price {
        padding: 10px 14px;
    }
}
