/**
 * DataFirefly - Box Builder (Mix & Match) - front styles
 * Colors: --dfbox-accent / --dfbox-accent-text (accent color setting), --dfbox-success.
 */
.dfbox-builder, .dfbox-home, .dfbox-product-cta, .dfbox-modal {
    --dfbox-accent: #2d8cf0;
    --dfbox-accent-text: #fff;
    --dfbox-success: #27ae60;
    --dfbox-success-dark: #1e7a37;
}
.dfbox-builder { margin: 1.5rem 0; }
.dfbox-intro { margin-bottom: 1.25rem; color: #555; }

.dfbox-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.75rem;
    align-items: start;
}
@media (max-width: 880px) {
    .dfbox-layout { grid-template-columns: 1fr; }
}

/* templates */
.dfbox-templates { margin-bottom: 1.5rem; }
.dfbox-section-title { font-size: 1.05rem; margin-bottom: .75rem; }
.dfbox-templates-list { display: flex; flex-wrap: wrap; gap: .75rem; }
.dfbox-template-card {
    border: 1px solid #e3e3e3; border-radius: 10px; padding: .75rem 1rem;
    background: #fff; cursor: pointer; text-align: left; min-width: 160px;
    display: flex; flex-direction: column; gap: .25rem; transition: border-color .15s, box-shadow .15s;
}
.dfbox-template-card:hover { border-color: var(--dfbox-accent); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.dfbox-template-name { font-weight: 600; }
.dfbox-template-desc { font-size: .82rem; color: #777; }

/* slot tabs */
.dfbox-slot-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.dfbox-slot-tab {
    border: 1px solid #ddd; background: #fafafa; border-radius: 999px;
    padding: .45rem .95rem; cursor: pointer; font-size: .9rem;
}
.dfbox-slot-tab.active { background: var(--dfbox-accent); border-color: var(--dfbox-accent); color: var(--dfbox-accent-text); }
.dfbox-slot-count { opacity: .8; font-size: .8rem; }

/* product grid */
.dfbox-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem;
}
.dfbox-card {
    border: 1px solid #ececec; border-radius: 12px; overflow: hidden; background: #fff;
    display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s;
}
.dfbox-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.dfbox-card.is-blocked { opacity: .45; }
.dfbox-card.is-selected { border-color: var(--dfbox-success); box-shadow: 0 0 0 2px rgba(39,174,96,.25); }
.dfbox-card-img { aspect-ratio: 1 / 1; overflow: hidden; background: #f6f6f6; }
.dfbox-card-img img { width: 100%; height: 100%; object-fit: cover; }
.dfbox-card-body { padding: .65rem .7rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.dfbox-card-name { font-size: .9rem; line-height: 1.25; font-weight: 500; }
button.dfbox-card-name, button.dfbox-card-img {
    background: none; border: 0; padding: 0; margin: 0; text-align: left; color: inherit; cursor: pointer; font-family: inherit;
}
button.dfbox-card-img { display: block; width: 100%; }
button.dfbox-card-name:hover, button.dfbox-card-name:focus-visible { text-decoration: underline; }
.dfbox-lowstock { font-size: .72rem; color: #c0392b; font-weight: 600; }
.dfbox-card .btn { margin-top: auto; padding: .35rem .5rem; font-size: .85rem; }

/* summary panel */
.dfbox-summary {
    position: sticky; top: 90px;
    border: 1px solid #ececec; border-radius: 14px; padding: 1.1rem 1.2rem; background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.dfbox-progress { margin-bottom: 1rem; }
.dfbox-progress-label { font-size: .85rem; color: #555; margin-bottom: .4rem; }
.dfbox-progress-bar { height: 9px; background: #eee; border-radius: 999px; overflow: hidden; }
.dfbox-progress-bar > span { display: block; height: 100%; width: 0; background: var(--dfbox-accent); transition: width .25s ease; }
.dfbox-progress-bar.dfbox-complete > span { background: var(--dfbox-success); }

.dfbox-selected { list-style: none; margin: 0 0 1rem; padding: 0; max-height: 280px; overflow-y: auto; }
.dfbox-selected-line {
    display: flex; justify-content: space-between; align-items: center;
    padding: .4rem 0; border-bottom: 1px dashed #eee; font-size: .9rem;
}
.dfbox-empty-line { color: #999; font-style: italic; padding: .4rem 0; }
.dfbox-sel-remove {
    border: none; background: none; color: #c0392b; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 .25rem;
}

.dfbox-price-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: .6rem 0; border-top: 2px solid #f0f0f0; margin-bottom: .75rem;
}
.dfbox-price-row strong { font-size: 1.4rem; color: #1a1a1a; }

.dfbox-errors {
    background: #fff5f5; border: 1px solid #f3c4c4; color: #c0392b;
    border-radius: 8px; padding: .55rem .7rem; font-size: .82rem; margin-bottom: .75rem;
}
.dfbox-errors > div + div { margin-top: .25rem; }

.dfbox-actions { display: flex; flex-direction: column; gap: .6rem; }
.dfbox-add { width: 100%; padding: .7rem; font-size: 1rem; font-weight: 600; }
.dfbox-secondary-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.dfbox-secondary-actions .btn { flex: 1; font-size: .82rem; padding: .4rem; }
.dfbox-share { display: flex; gap: .4rem; margin-top: .3rem; }
.dfbox-share input { flex: 1; font-size: .8rem; }

.dfbox-empty { color: #999; font-style: italic; padding: 1rem 0; }

/* home block */
.dfbox-home { margin: 2.5rem 0; }
.dfbox-home-title { text-align: center; margin-bottom: 1.25rem; }
.dfbox-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.dfbox-home-card {
    border: 1px solid #ececec; border-radius: 14px; padding: 1.5rem; text-align: center;
    background: #fff; display: flex; flex-direction: column; gap: .6rem; text-decoration: none; transition: box-shadow .15s;
}
.dfbox-home-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.08); }
.dfbox-home-name { font-weight: 700; font-size: 1.1rem; color: #1a1a1a; }
.dfbox-home-cta { color: var(--dfbox-accent); font-weight: 600; }

/* v1.1.0 additions */
.dfbox-card-price { font-size: .85rem; font-weight: 600; color: #1a1a1a; }
.dfbox-slot-tab.is-filled:not(.active) { border-color: var(--dfbox-success); color: var(--dfbox-success-dark); }
.dfbox-slot-price { display: block; font-size: .72rem; opacity: .85; }
.dfbox-reward {
    border-radius: 10px; padding: .55rem .7rem; margin-bottom: .9rem; font-size: .85rem;
    background: #fff8e6; border: 1px dashed #f0b429; color: #7a5300;
}
.dfbox-reward.is-unlocked { background: #eefaf0; border: 1px solid var(--dfbox-success); color: var(--dfbox-success-dark); font-weight: 600; }
.dfbox-tier-hint { font-size: .82rem; color: var(--dfbox-accent); margin: -.35rem 0 .75rem; }
.dfbox-sel-ctrl { display: inline-flex; gap: .2rem; align-items: center; }
.dfbox-sel-plus {
    border: 1px solid #ddd; background: #fff; color: #1a1a1a; border-radius: 4px;
    font-size: .9rem; line-height: 1; padding: .1rem .4rem; cursor: pointer;
}
.dfbox-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dfbox-home-excerpt { font-size: .85rem; color: #666; }
.dfbox-prod-add:disabled { cursor: not-allowed; }

/* v1.2.0 additions */
.dfbox-card-actions { display: flex; gap: .35rem; margin-top: auto; }
.dfbox-card-actions .dfbox-prod-add { flex: 1; }
.dfbox-card-actions .btn { margin-top: 0; }
.dfbox-prod-minus { min-width: 2.2rem; }

.dfbox-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.dfbox-toolbar .dfbox-search { flex: 1 1 200px; min-width: 0; padding: .4rem .6rem; border: 1px solid #ddd; border-radius: 6px; }
.dfbox-toolbar select { padding: .4rem .5rem; border: 1px solid #ddd; border-radius: 6px; background: #fff; max-width: 100%; }

.dfbox-preview { margin-bottom: .9rem; }
.dfbox-preview-row + .dfbox-preview-row { margin-top: .4rem; }
.dfbox-preview-label { display: block; font-size: .72rem; color: #777; margin-bottom: .2rem; }
.dfbox-preview-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.dfbox-cell {
    aspect-ratio: 1 / 1; border: 1px dashed #d6d6d6; border-radius: 6px; background: #fafafa;
    display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: .75rem; color: #666;
}
.dfbox-cell.is-filled { border: 1px solid var(--dfbox-success); background: #fff; }
.dfbox-cell img { width: 100%; height: 100%; object-fit: cover; }
.dfbox-cell-dot { width: 40%; height: 40%; border-radius: 50%; background: var(--dfbox-success); }
.dfbox-cell.is-more { border-style: solid; font-weight: 600; }

.dfbox-savings { font-size: .85rem; color: var(--dfbox-success-dark); font-weight: 600; margin: -.35rem 0 .6rem; }
.dfbox-remaining { display: inline-block; font-size: .85rem; font-weight: 600; color: #b54708; background: #fff4e5; border-radius: 999px; padding: .25rem .75rem; }
.dfbox-home-remaining { font-size: .8rem; font-weight: 600; color: #b54708; }

.dfbox-gift { border-top: 1px solid #f0f0f0; padding-top: .7rem; margin-bottom: .7rem; font-size: .88rem; }
.dfbox-gift-wrap { display: flex; align-items: center; gap: .4rem; cursor: pointer; margin-bottom: .5rem; }
.dfbox-gift-label { display: block; margin-bottom: .25rem; }
.dfbox-gift textarea { width: 100%; border: 1px solid #ddd; border-radius: 6px; padding: .4rem .5rem; font-size: .85rem; resize: vertical; }
.dfbox-gift-count { display: block; color: #888; font-size: .75rem; text-align: right; }

.dfbox-edit-link { display: inline-block; margin-left: .35rem; font-weight: 600; }

.dfbox-product-cta { margin: 1rem 0; padding: .75rem 1rem; border: 1px dashed #cfd8e3; border-radius: 10px; background: #f8fbff; font-size: .9rem; }
.dfbox-product-cta-title { display: block; font-weight: 600; margin-bottom: .3rem; }
.dfbox-product-cta-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.dfbox-product-cta-list a { font-weight: 600; }

.dfbox-unavailable { max-width: 720px; }

/* quick view */
.dfbox-modal { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.dfbox-modal[hidden] { display: none; }
.dfbox-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.dfbox-modal-dialog {
    position: relative; background: #fff; border-radius: 14px; max-width: 760px; width: 100%;
    max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.5rem; box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.dfbox-modal-close { position: absolute; top: .5rem; right: .75rem; border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #555; }
.dfbox-modal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.25rem; align-items: start; }
.dfbox-modal-img img { width: 100%; height: auto; border-radius: 10px; }
.dfbox-modal-title { font-size: 1.15rem; margin: 0 1.5rem .5rem 0; }
.dfbox-modal-price { font-weight: 700; font-size: 1.05rem; }
.dfbox-modal-desc { color: #555; font-size: .9rem; }
.dfbox-modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1rem; }
body.dfbox-modal-open { overflow: hidden; }
@media (max-width: 600px) {
    .dfbox-modal-grid { grid-template-columns: 1fr; }
}

/* mobile sticky bar */
.dfbox-mobile-bar { display: none; }
.dfbox-mobile-bar[hidden] { display: none !important; }
@media (max-width: 880px) {
    .dfbox-summary { position: static; }
    .dfbox-mobile-bar {
        display: flex; align-items: center; gap: .75rem; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
        background: #fff; border-top: 1px solid #e5e5e5; box-shadow: 0 -4px 16px rgba(0,0,0,.08);
        padding: .6rem 1rem; transition: transform .2s ease;
    }
    .dfbox-mobile-bar.is-away { transform: translateY(110%); }
    .dfbox-mobile-count { font-size: .85rem; color: #555; }
    .dfbox-mobile-price { margin-left: auto; font-size: 1.05rem; }
    .dfbox-mobile-bar .btn { padding: .45rem .8rem; font-size: .88rem; }
    .dfbox-builder { padding-bottom: 4rem; }
}

/* v1.3.0: guidance, steps, feedback, mobile */
.dfbox-hints {
    background: #f4f8fd; border: 1px solid #d6e4f5; color: #2f4a68;
    border-radius: 8px; padding: .55rem .7rem; font-size: .82rem; margin-bottom: .75rem;
}
.dfbox-hints > div + div { margin-top: .2rem; }
.dfbox-progress-bar { position: relative; }
.dfbox-progress-min { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #9aa5b1; border-radius: 1px; }
.dfbox-progress-bar.dfbox-complete .dfbox-progress-min { background: rgba(255,255,255,.8); }
.dfbox-progress-rule { color: #888; }
.dfbox-step-num {
    display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; margin-right: .3rem;
    border-radius: 50%; font-size: .72rem; font-weight: 700; background: rgba(0,0,0,.08);
}
.dfbox-slot-tab.active .dfbox-step-num { background: rgba(255,255,255,.25); }
.dfbox-slot-tab.is-filled .dfbox-step-num { background: var(--dfbox-success); color: #fff; }
.dfbox-next-step { display: flex; justify-content: flex-end; margin-top: 1rem; }
.dfbox-next-step .btn { white-space: nowrap; }
.dfbox-secondary-actions .btn { white-space: nowrap; flex: 1 1 auto; }
.dfbox-success {
    background: #eefaf0; border: 1px solid var(--dfbox-success); color: var(--dfbox-success-dark);
    border-radius: 8px; padding: .6rem .75rem; font-size: .85rem; margin-bottom: .75rem;
}
.dfbox-success a { font-weight: 600; margin-right: .75rem; }
@keyframes dfbox-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.dfbox-pop { animation: dfbox-pop .35s ease; }
.dfbox-card.is-just-added { box-shadow: 0 0 0 3px var(--dfbox-success); }
@media (prefers-reduced-motion: reduce) {
    .dfbox-pop { animation: none; }
    .dfbox-progress-bar > span, .dfbox-mobile-bar { transition: none; }
}
.dfbox-builder button:focus-visible, .dfbox-builder a:focus-visible, .dfbox-builder input:focus-visible,
.dfbox-builder select:focus-visible, .dfbox-builder textarea:focus-visible {
    outline: 2px solid var(--dfbox-accent); outline-offset: 2px;
}
.dfbox-mobile-bar.is-ready .btn { background: var(--dfbox-success); border-color: var(--dfbox-success); }
@media (max-width: 880px) {
    .dfbox-templates-list, .dfbox-slot-tabs {
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
        margin-left: -2px; margin-right: -2px; padding: 2px 2px 6px;
    }
    .dfbox-template-card { flex: 0 0 auto; max-width: 75%; }
    .dfbox-slot-tab { flex: 0 0 auto; }
}
@media (max-width: 575px) {
    .dfbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .dfbox-card-body { padding: .5rem; gap: .35rem; }
    .dfbox-card-name { font-size: .84rem; }
    .dfbox-card .btn { font-size: .8rem; padding: .35rem .3rem; }
    .dfbox-prod-minus { min-width: 1.9rem; }
    .dfbox-toolbar .dfbox-search { flex: 1 1 100%; }
    .dfbox-toolbar select { flex: 1 1 calc(50% - .25rem); min-width: 0; }
    .dfbox-summary { padding: 1rem; }
}
.dfbox-gift-toggle {
    background: none; border: 0; padding: 0; color: var(--dfbox-accent); font-weight: 600; font-size: .85rem; cursor: pointer;
}
.dfbox-gift-toggle:hover { text-decoration: underline; }
.dfbox-next-step.is-top { justify-content: flex-start; margin: -.25rem 0 1rem; }
.dfbox-next-step.is-top .btn { padding: .3rem .8rem; font-size: .85rem; }
