/* ── Builder Layout ──────────────────────────────────────────────────────────────── */

.charm-builder-wrap {
    width: 100vw;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.charm-builder-canvas {
    flex: 0 0 57%;
    background-color: #fafafa;
    position: relative;
}

#charm-canvas-container {
    width: 100%;
    height: 100%;
}

.charm-builder-panel {
    flex: 0 0 43%;
    background-color: #ffffff;
    border-left: 1px solid #000000;
    padding: 30px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* ── Step Header ─────────────────────────────────────────────────────────────────── */

.charm-step-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 24px;
    color: #111;
}

.charm-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Category Tabs — commented out in favour of pills ────────────────────────────── */
/*
.charm-chain-tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.charm-chain-tab {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: color 0.15s;
}

.charm-chain-tab:hover,
.charm-chain-tab:focus {
    background: none;
    outline: none;
    color: #111;
}

.charm-chain-tab.active {
    color: #111;
    border-bottom-color: #111;
}
*/

/* ── Chain Grid ──────────────────────────────────────────────────────────────────── */

#charm-chain-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.charm-chain-item {
    cursor: pointer;
    text-align: center;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    padding: 8px;
    transition: border-color 0.15s;
}

.charm-chain-item:hover {
    border-color: #ccc;
}

.charm-chain-item.selected {
    border-color: #111;
}

.charm-chain-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    background: #fafafa;
    margin-bottom: 8px;
}

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

.charm-chain-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 12px;
}

.charm-chain-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
}

/* ── States ──────────────────────────────────────────────────────────────────────── */

.charm-loading,
.charm-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px 0;
    margin: 0;
}

.charm-grid-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    color: #bbb;
    font-size: 15px;
    padding: 40px 0;
    margin: 0;
}

/* ── Previous Step Link ──────────────────────────────────────────────────────────── */

.charm-prev-step {
    display: inline-block;
    margin-bottom: 20px;
    font-size: 13px;
    color: #888;
    text-decoration: none;
}

.charm-prev-step:hover {
    color: #111;
}

/* ── Charm Category Tabs + Scrollbar — commented out in favour of pills ──────────── */
/*
.charm-charm-tabs-wrap {
    margin-bottom: 24px;
}

.charm-charm-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.charm-charm-tabs::-webkit-scrollbar {
    display: none;
}

.charm-charm-scrollbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.charm-charm-scrollbar-track {
    flex: 1;
    height: 3px;
    background: #e5e5e5;
    position: relative;
    overflow: hidden;
}

.charm-charm-scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    background: #888;
}

.charm-charm-scrollbar-arrows {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.charm-scroll-btn {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}

.charm-scroll-btn:hover,
.charm-scroll-btn:focus {
    background: #111;
    color: #fff;
    outline: none;
}

.charm-charm-tab {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.charm-charm-tab:hover,
.charm-charm-tab:focus {
    background: none;
    outline: none;
    color: #111;
}

.charm-charm-tab.active {
    color: #111;
    border-bottom-color: #111;
}
*/

/* ── Category Pills ──────────────────────────────────────────────────────────────── */

.charm-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.charm-chain-tab,
.charm-charm-tab {
    appearance: none;
    -webkit-appearance: none;
    background: #aaa;
    border: none;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    line-height: 1;
}

.charm-chain-tab:hover,
.charm-charm-tab:hover,
.charm-chain-tab:focus,
.charm-charm-tab:focus {
    background: #888;
    outline: none;
}

.charm-chain-tab.active,
.charm-charm-tab.active {
    background: #111;
}

/* ── Charm Grid ──────────────────────────────────────────────────────────────────── */

#charm-charm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.charm-charm-item {
    cursor: pointer;
    text-align: center;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    padding: 8px;
    transition: border-color 0.15s;
}

.charm-charm-item:hover {
    border-color: #ccc;
}

.charm-charm-item.selected {
    border-color: #111;
}

.charm-charm-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    background: #fafafa;
    margin-bottom: 8px;
}

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

.charm-charm-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 12px;
}

.charm-charm-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
}

/* ── Save Design Button ──────────────────────────────────────────────────────────────── */

#charm-save-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 90px;
    background: #111;
    color: #fff;
    border: none;
    padding: 19px 5px 17px;
    cursor: pointer;
    text-align: center;
    z-index: 10;
    border-radius: 6px;
    transition: background 0.15s;
}

#charm-save-btn:hover {
    background: #333;
}

#charm-save-btn svg {
    display: block;
    margin: 0 auto 7px;
}

#charm-save-btn span {
    display: block;
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.3;
    color: #fff;
}

#charm-save-btn .charm-save-label--short {
    display: none;
}

/* ── Export Modal ────────────────────────────────────────────────────────────────────── */

.charm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.charm-modal-box {
    background: #fff;
    padding: 32px 28px 28px;
    width: 92%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.charm-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none !important;
    border: none !important;
    font-size: 24px;
    line-height: 1;
    color: #111 !important;
    cursor: pointer;
    padding: 0;
}

.charm-modal-close:hover {
    color: #555 !important;
}

.charm-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px;
    color: #111;
}

.charm-modal-preview {
    text-align: center;
    margin-bottom: 22px;
    border: 1px solid #e8e8e8;
    background: #fafafa;
    overflow: hidden;
}

.charm-modal-preview img {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.charm-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.charm-btn {
    display: inline-block;
    background: #111 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 22px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
    transition: background 0.15s;
    line-height: 1;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.charm-btn:hover,
.charm-btn:focus {
    background: #333 !important;
    color: #fff !important;
    text-decoration: none !important;
}

.charm-modal-email-row {
    display: flex;
    gap: 8px;
}

#charm-export-email {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid #ccc;
    font-size: 14px;
    outline: none;
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
}

#charm-export-email:focus {
    border-color: #111;
}

.charm-modal-send-status {
    font-size: 13px;
    color: #555;
    text-align: center;
    margin: 0;
}

/* ── Mobile Category Dropdown (hidden on desktop) ────────────────────────────────────── */

.charm-mobile-dropdown {
    display: none;
    position: relative;
    margin-bottom: 24px;
}

.charm-mobile-dropdown-trigger {
    display: block !important;
    width: 100% !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: #111 !important;
    border: none !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    padding: 5px 30px 5px 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    color: #fff !important;
    cursor: pointer;
    text-align: left !important;
    position: relative;
    box-sizing: border-box !important;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.charm-mobile-dropdown-trigger::after {
    content: '▾';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    line-height: 1;
}

.charm-mobile-dropdown--open .charm-mobile-dropdown-trigger::after {
    content: '▴';
}

.charm-mobile-dropdown-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #111;
    border-radius: 8px;
    overflow: hidden;
    z-index: 200;
}

.charm-mobile-dropdown-list--open {
    display: block;
}

.charm-mobile-dropdown-opt {
    display: block;
    width: 100%;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: none !important;
    border: none !important;
    border-bottom: 1px solid #e8e8e8 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 12px 16px;
    font-size: 14px;
    color: #333 !important;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    text-decoration: none !important;
}

.charm-mobile-dropdown-opt:last-child {
    border-bottom: none;
}

.charm-mobile-dropdown-opt:hover,
.charm-mobile-dropdown-opt:focus {
    background: #f5f5f5;
    color: #111;
    outline: none;
}

.charm-mobile-dropdown-opt.active {
    font-weight: 600;
    color: #111;
}

/* ── Mobile Layout ───────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {

    .charm-builder-wrap {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: auto;
        flex-direction: column;
    }

    .charm-builder-canvas {
        flex: 0 0 55%;
        width: 100%;
    }

    .charm-builder-panel {
        flex: 1;
        min-height: 0;
        width: 100%;
        border-left: none;
        border-top: 1px solid #000;
        padding: 20px;
        overflow-y: auto;
    }

    .charm-mobile-dropdown {
        display: block;
    }

    .charm-step--2 .charm-pill-row {
        display: none;
    }

    #charm-save-btn {
        width: 54px;
        padding: 8px 4px 7px;
    }

    #charm-save-btn svg {
        width: 18px;
        height: 18px;
        margin-bottom: 4px;
    }

    #charm-save-btn .charm-save-label--full { display: none; }
    #charm-save-btn .charm-save-label--short { display: block; }

    .charm-step-title {
        font-size: 18px !important;
        margin-bottom: 16px;
    }

    .charm-step-num {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .charm-step-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
    }

    .charm-step-header .charm-step-title {
        margin-bottom: 0;
        order: 1;
    }

    .charm-step-header .charm-prev-step {
        order: 2;
        margin-bottom: 0;
        flex-shrink: 0;
    }

}
