/* =============================================================================
   Set Builder — Afed Styles v2.0
   Replicating the look and feel of afed.com.ua
   ============================================================================= */

:root {
    --sb-bg:           #ffffff;
    --sb-bg-alt:       #f2f2f2;
    --sb-border:       #eeeeee;
    --sb-border-dash:  #cccccc;
    --sb-text:         #1a1a1a;
    --sb-muted:        #888888;
    --sb-accent:       #a5a5a5; /* Afed's neutral gray button */
    --sb-accent-hover: #888888;
    --sb-transition:   0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --sb-panel-z:      10000;
}

/* ── Panel wrapper ──────────────────────────────────────────────────────────── */
.set-builder {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--sb-panel-z);
    background: var(--sb-bg);
    border-top: 1px solid var(--sb-border);
    box-shadow: 0 -5px 25px rgba(0,0,0,0.06);
    transform: translateY(100%);
    transition: transform var(--sb-transition);
    font-family: inherit;
    color: var(--sb-text);
}

.set-builder.is-open {
    transform: translateY(0);
}

.set-builder.is-collapsed {
    transform: translateY(100%);
}

/* ── Top Bar (Toggle) ────────────────────────────────────────────────────────── */
.set-builder__top-bar {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    background: #fff;
    border-bottom: 1px solid #f9f9f9;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sb-text);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--sb-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.03);
}

.set-builder__toggle-icon {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.set-builder.is-collapsed .set-builder__toggle-icon {
    transform: rotate(180deg);
}

/* ── Container ───────────────────────────────────────────────────────────────── */
.set-builder__content {
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    height: 340px; /* Fixed height like desktop afed */
}

.set-builder__main {
    flex: 1;
    padding: 30px 40px;
    overflow-x: auto;
}

.set-builder__sidebar {
    width: 320px;
    padding: 30px 40px;
    border-left: 1px solid #f5f5f5;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fafafa;
}

/* ── Slots ───────────────────────────────────────────────────────────────────── */
.set-builder__slots {
    display: flex;
    gap: 20px;
    height: 100%;
}

.set-builder__slot {
    flex: 1;
    min-width: 180px;
    max-width: 220px;
    aspect-ratio: 4/5;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.set-builder__slot--empty {
    border: 1px dashed var(--sb-border-dash);
    background: transparent;
}

.set-builder__slot--filled {
    background: var(--sb-bg-alt);
    border: 1px solid transparent;
}

.set-builder__slot-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 700;
    color: rgba(0,0,0,0.03);
    pointer-events: none;
    user-select: none;
}

.set-builder__slot-image {
    width: 80%;
    height: 60%;
    object-fit: contain;
    margin-bottom: 15px;
}

.set-builder__slot-info {
    text-align: center;
    padding: 0 10px;
}

.set-builder__slot-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.set-builder__slot-brand {
    display: block;
    font-size: 10px;
    color: var(--sb-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.set-builder__slot-meta {
    font-size: 11px;
    color: var(--sb-text);
}

.set-builder__slot-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.set-builder__slot-remove:hover {
    color: #ff4444;
}

.set-builder__slot-empty-icon {
    color: #dddddd;
    opacity: 0.5;
}

/* ── Sidebar Info ────────────────────────────────────────────────────────────── */
.set-builder__sidebar-title {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    margin: 0 0 10px;
    letter-spacing: 0.05em;
}

.set-builder__sidebar-desc {
    font-size: 12px;
    color: var(--sb-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.set-builder__set-image {
    width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 20px;
}

.set-builder__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 14px;
}

.set-builder__total-value {
    font-size: 18px;
    font-weight: 700;
}

.set-builder__submit {
    width: 100%;
    padding: 15px;
    background: var(--sb-accent);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.3s;
}

.set-builder__submit:hover:not(:disabled) {
    background: var(--sb-accent-hover);
}

.set-builder__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
}

/* ── Close Button ────────────────────────────────────────────────────────────── */
.set-builder__close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #ccc;
    z-index: 2;
}

.set-builder__close-btn:hover {
    color: var(--sb-text);
}

/* ── Floating Trigger (already implemented, keeping for consistency) ───────── */
.sb-trigger {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 54px;
    height: 54px;
    background: #fff;
    color: #333;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
}

.sb-trigger.is-visible {
    opacity: 1;
    visibility: visible;
}

.sb-trigger:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.12);
}

.sb-trigger__progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.sb-trigger__progress-bg {
    stroke: #f0f0f0;
}

.sb-trigger__progress-bar {
    stroke: #000;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.sb-trigger__icon {
    position: relative;
    z-index: 2;
    width: 20px;
    height: 12px;
}

.sb-trigger__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #111;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    border: 2px solid #fff;
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.sb-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 11000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sb-toast.is-visible {
    transform: translateX(-50%) translateY(0);
}

/* ── Add to Set Button (Shop Loop) ────────────────────────────────────────── */
.sb-add-btn--card {
    display: block;
    width: 100%;
    margin-top: 8px;
    margin-bottom: 0 !important;
    padding: 12px;
    background: #f5f5f5;
    border: none;
    color: #333;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.sb-add-btn--card:hover {
    background: #eeeeee;
}

.sb-add-btn__icon {
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

.sb-add-btn__icon svg {
    width: 16px;
    height: 10px;
    display: block;
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .set-builder__content {
        flex-direction: column;
        height: 70vh;
        overflow-y: auto;
    }
    
    .set-builder__main {
        padding: 20px;
    }
    
    .set-builder__slots {
        flex-direction: column;
    }
    
    .set-builder__slot {
        min-width: 100%;
        max-width: 100%;
        flex-direction: row;
        aspect-ratio: auto;
        padding: 10px;
        justify-content: flex-start;
        height: 100px;
    }
    
    .set-builder__slot--empty {
        justify-content: center;
    }
    
    .set-builder__slot-image {
        width: 60px;
        height: 60px;
        margin-bottom: 0;
        margin-right: 15px;
    }
    
    .set-builder__slot-info {
        text-align: left;
        flex: 1;
    }

    .set-builder__slot--empty {
        justify-content: center;
    }
    
    .set-builder__sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--sb-border);
        padding: 20px;
    }

    .set-builder__top-bar {
        top: -32px;
        width: auto;
        padding: 8px 22px;
        font-size: 10px;
    }

    .set-builder__slot-remove {
        top: 50%;
        transform: translateY(-50%);
        right: 15px;
    }

    .set-builder__close-btn {
        display: none !important;
    }

    .sb-trigger {
        right: 12px !important;
        bottom: 60px !important;
        width: 40px !important;
        height: 40px !important;
    }
    .sb-trigger__icon {
        width: 16px;
        height: 25px;
    }

    .sb-trigger__badge {
        width: 18px;
        height: 18px;
        font-size: 9px;
        top: -5px;
        right: -5px;
        border-width: 1px;
    }
}
