/* ==========================================================================
   Easybutor Accessories — Termékoldali UI (v2)
   BEM: .eb-acc__*, .eb-overlay__*, .eb-sticky-cta__*, .eb-swatch*
   Mobile-first, 8px spacing rendszer, Poppins body / Oswald heading
   ========================================================================== */

/* --- Design tokens (fallback értékek) --- */
:root {
    --eb-primary: var(--color-primary, #8c9770);
    --eb-primary-hover: #aab295;
    --eb-text: var(--color-text, #4b3e3e);
    --eb-text-muted: var(--color-text-muted, #737373);
    --eb-border: var(--color-border, #d9d9d9);
    --eb-card-bg: var(--color-card-bg, #f9f7f3);
    --eb-bg: var(--color-background, #ffffff);
    --eb-radius-chip: 8px;
    --eb-radius-btn: 24px;
    --eb-font-body: 'Poppins', sans-serif;
    --eb-font-heading: 'Oswald', sans-serif;
}

/* ==========================================================================
   1. Color Swatches (variáció kép thumbnail-ek)
   ========================================================================== */

.eb-swatches-label {
    font-family: var(--eb-font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--eb-text);
    margin: 0 0 6px;
    letter-spacing: 0.02em;
}

.eb-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 10px;
}

.eb-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    background: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

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

.eb-swatch:hover {
    border-color: var(--eb-text-muted);
}

.eb-swatch--active {
    border-color: var(--eb-text);
    box-shadow: 0 0 0 2px var(--eb-bg), 0 0 0 4px var(--eb-text);
}

.eb-swatch__name {
    font-family: var(--eb-font-body);
    font-size: 13px;
    color: var(--eb-text-muted);
    margin-left: 6px;
    white-space: nowrap;
}

/* Visually hidden (accessible) */
.eb-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ==========================================================================
   2. Dynamic Price (fold felett, title alatt)
   ========================================================================== */

.eb-dynamic-price {
    display: inline-block;
    font-family: var(--eb-font-body);
    font-size: 22px;
    font-weight: 700;
    color: var(--eb-text);
    margin: 4px 0 12px;
    padding: 6px 16px;
    border: 1.5px solid var(--eb-border);
    border-radius: 20px;
    line-height: 1.3;
}

/* ==========================================================================
   3. Accessories Container
   ========================================================================== */

.eb-acc {
    margin: 8px 0 6px;
    padding: 0;
    background: transparent;
    border: none;
}

/* Eredeti h4 "Kiegészítők" cím — elrejtjük, a quick-label veszi át */
.eb-acc__title {
    display: none;
}

/* "Gyors kiegészítők" szekció cím */
.eb-acc__quick-label {
    font-family: var(--eb-font-heading);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--eb-text);
    margin: 0 0 6px;
    padding: 0;
}

/* ==========================================================================
   4. Chip Grid (kiegészítő elemek)
   ========================================================================== */

.eb-acc__items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}

.eb-acc__item {
    border: 1.5px solid var(--eb-border);
    border-radius: var(--eb-radius-chip);
    padding: 10px 12px;
    background: var(--eb-bg);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.eb-acc__item--active {
    border-color: var(--eb-primary);
    background-color: rgba(140, 151, 112, 0.06);
}

.eb-acc__item[data-unavailable="true"] {
    opacity: 0.35;
    pointer-events: none;
}

/* Linked state (auto-add, pl. lábazat → szintezőláb) */
.eb-acc__item--linked {
    opacity: 0.65;
    position: relative;
}

.eb-acc__item--linked::before {
    content: '↳ auto';
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 10px;
    font-family: var(--eb-font-body);
    color: var(--eb-primary);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.eb-acc__item--linked .eb-acc__qty-btn,
.eb-acc__item--linked .eb-acc__choice-select {
    pointer-events: none;
    opacity: 0.5;
}

/* --- Row layout inside a chip --- */
.eb-acc__row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
}

.eb-acc__row--multi {
    flex-wrap: wrap;
}

.eb-acc__label {
    flex: 1;
    font-family: var(--eb-font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--eb-text);
    line-height: 1.3;
}

.eb-acc__price {
    font-family: var(--eb-font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--eb-text-muted);
    white-space: nowrap;
    text-align: right;
}

/* ==========================================================================
   5. "Összes kiegészítő →" gomb (grid cella)
   ========================================================================== */

.eb-acc__show-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1.5px dashed var(--eb-border);
    border-radius: var(--eb-radius-chip);
    padding: 10px 12px;
    background: transparent;
    color: var(--eb-primary);
    font-family: var(--eb-font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    min-height: 36px;
}

.eb-acc__show-all:hover {
    background-color: rgba(140, 151, 112, 0.06);
    border-color: var(--eb-primary);
}

/* ==========================================================================
   6. Toggle Switch (CSS-only)
   ========================================================================== */

.eb-acc__toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.eb-acc__toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.eb-acc__toggle-track {
    display: block;
    width: 44px;
    height: 24px;
    background: var(--eb-border);
    border-radius: 999px;
    transition: background-color 0.2s ease;
    position: relative;
}

.eb-acc__toggle-thumb {
    display: block;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.eb-acc__toggle-input:checked + .eb-acc__toggle-track {
    background: var(--eb-primary);
}

.eb-acc__toggle-input:checked + .eb-acc__toggle-track .eb-acc__toggle-thumb {
    transform: translateX(20px);
}

.eb-acc__toggle-input:focus-visible + .eb-acc__toggle-track {
    outline: 2px solid var(--eb-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   7. Quantity Selector
   ========================================================================== */

.eb-acc__qty {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--eb-border);
    border-radius: var(--eb-radius-chip);
    overflow: hidden;
    flex-shrink: 0;
}

.eb-acc__qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: var(--eb-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.eb-acc__qty-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.eb-acc__qty-btn:active {
    background-color: rgba(0, 0, 0, 0.08);
}

.eb-acc__qty-input {
    width: 32px;
    height: 32px;
    border: none;
    border-left: 1.5px solid var(--eb-border);
    border-right: 1.5px solid var(--eb-border);
    text-align: center;
    font-family: var(--eb-font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--eb-text);
    background: transparent;
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0;
}

.eb-acc__qty-input::-webkit-inner-spin-button,
.eb-acc__qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ==========================================================================
   8. Controls Wrapper (dropdown + qty stacking)
   ========================================================================== */

.eb-acc__controls {
    flex-shrink: 0;
    width: 140px;
}

.eb-acc__controls--stacked {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.eb-acc__controls--stacked .eb-acc__choice-select {
    width: 100%;
}

.eb-acc__controls--stacked .eb-acc__qty {
    align-self: flex-end;
}

/* ==========================================================================
   9. Choice Dropdown (user_choice matching)
   ========================================================================== */

.eb-acc__choice-select {
    display: block;
    width: 140px;
    padding: 0 10px;
    border: 1.5px solid var(--eb-border);
    border-radius: var(--eb-radius-chip);
    font-family: var(--eb-font-body);
    font-size: 13px;
    color: var(--eb-text);
    background: var(--eb-bg);
    box-sizing: border-box;
}

/* ==========================================================================
   10. Color Selector Row (kiegészítő szín választó)
   ========================================================================== */

.eb-acc__color-row {
    padding: 8px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eb-acc__color-label {
    font-family: var(--eb-font-body);
    font-size: 13px;
    color: var(--eb-text-muted);
    flex-shrink: 0;
}

.eb-acc__color-select {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid var(--eb-border);
    border-radius: 6px;
    font-family: var(--eb-font-body);
    font-size: 13px;
    color: var(--eb-text);
    background: var(--eb-bg);
    max-width: 220px;
}

/* ==========================================================================
   11. Loading State
   ========================================================================== */

.eb-acc--loading .eb-acc__items {
    opacity: 0.5;
    pointer-events: none;
}

/* ==========================================================================
   12. Price Summary (kiegészítők összesítő)
   ========================================================================== */

.eb-acc__summary {
    margin: 4px 0;
    padding: 0;
    border: none;
}

.eb-acc__summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-family: var(--eb-font-body);
    font-size: 13px;
    color: var(--eb-text-muted);
}

.eb-acc__summary-row--total {
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px solid var(--eb-border);
    font-size: 15px;
    font-weight: 700;
    color: var(--eb-text);
}

.eb-acc__summary-value {
    font-weight: 600;
}

/* ==========================================================================
   13. Hidden Inputs
   ========================================================================== */

.eb-acc__hidden-inputs {
    display: none;
}

/* ==========================================================================
   14. Overlay Panel (Fázis D — <dialog> slide-in)
   ========================================================================== */

.eb-overlay {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 480px;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    border: none;
    background: var(--eb-bg);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    z-index: 10000;
}

.eb-overlay[open] {
    display: flex;
    flex-direction: column;
}

.eb-overlay--visible {
    transform: translateX(0);
}

.eb-overlay::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

body.eb-overlay-open {
    overflow: hidden;
}

/* Overlay header */
.eb-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--eb-border);
    flex-shrink: 0;
}

.eb-overlay__title {
    font-family: var(--eb-font-heading);
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0;
    color: var(--eb-text);
}

.eb-overlay__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-size: 22px;
    color: var(--eb-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.15s ease;
    padding: 0;
}

.eb-overlay__close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Overlay body (scrollable) */
.eb-overlay__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    -webkit-overflow-scrolling: touch;
}

/* Overlay section titles */
.eb-overlay__section-title {
    font-family: var(--eb-font-heading);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--eb-text);
    margin: 0 0 10px;
}

.eb-overlay__section + .eb-overlay__section {
    padding-top: 16px;
}

/* Overlay items list */
.eb-overlay__items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.eb-overlay__item {
    border: 1.5px solid var(--eb-border);
    border-radius: var(--eb-radius-chip);
    padding: 8px 12px;
    background: var(--eb-bg);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.eb-overlay__item--active {
    border-color: var(--eb-primary);
    background-color: rgba(140, 151, 112, 0.06);
}

.eb-overlay__row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
}

/* Overlay: wider controls (more space available than quick panel) */
.eb-overlay__item .eb-acc__controls {
    width: auto;
    min-width: 160px;
    flex: 1;
}

.eb-overlay__item .eb-acc__choice-select {
    width: 100%;
}

/* Overlay item thumbnail */
.eb-overlay__thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.eb-overlay__label {
    flex: 1;
    font-family: var(--eb-font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--eb-text);
    line-height: 1.3;
}

.eb-overlay__price {
    font-family: var(--eb-font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--eb-text-muted);
    white-space: nowrap;
    text-align: right;
}

/* Overlay footer (sticky) */
.eb-overlay__footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--eb-border);
    background: var(--eb-bg);
}

.eb-overlay__total {
    font-family: var(--eb-font-body);
    font-size: 20px;
    font-weight: 700;
    color: var(--eb-text);
    white-space: nowrap;
}

.eb-overlay__cart-btn {
    flex-shrink: 0;
    padding: 12px 28px;
    background: var(--eb-primary);
    color: #fff;
    border: none;
    border-radius: var(--eb-radius-btn);
    font-family: var(--eb-font-body);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.15s ease;
    line-height: 1.4;
}

.eb-overlay__cart-btn:hover {
    background: var(--eb-primary-hover);
}

/* ==========================================================================
   15. Sticky CTA (mobile only)
   ========================================================================== */

.eb-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--eb-bg);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.eb-sticky-cta__price {
    font-family: var(--eb-font-body);
    font-size: 18px;
    font-weight: 700;
    color: var(--eb-text);
    white-space: nowrap;
}

.eb-sticky-cta__btn {
    flex-shrink: 0;
    padding: 10px 24px;
    background: var(--eb-primary);
    color: #fff;
    border: none;
    border-radius: var(--eb-radius-btn);
    font-family: var(--eb-font-body);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.15s ease;
    line-height: 1.4;
}

.eb-sticky-cta__btn:hover {
    background: var(--eb-primary-hover);
}

/* Hide sticky CTA on desktop */
@media (min-width: 768px) {
    .eb-sticky-cta {
        display: none !important;
    }
}

/* ==========================================================================
   16. Responsive — Mobile (<768px)
   ========================================================================== */

@media (max-width: 767px) {
    .eb-overlay {
        width: 100vw;
    }

    .eb-overlay__header {
        padding: 14px 16px;
    }

    .eb-overlay__body {
        padding: 16px;
    }

    .eb-overlay__footer {
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* ==========================================================================
   17. Responsive — Tablet+ (≥768px)
   ========================================================================== */

@media (min-width: 768px) {
    .eb-acc__controls {
        width: 160px;
    }

    .eb-acc__choice-select {
        width: 160px;
    }
}

/* ==========================================================================
   18. WC Variation Price elrejtése (dynamic price veszi át)
   ========================================================================== */

.single-product .woocommerce-variation-price {
    display: none !important;
}
