/* =============================================================
   Leora Charm Builder — Stylesheet
   ============================================================= */

#leora-charm-builder {
    font-family: inherit;
    margin: 2rem 0;
}

/* Tiêu đề section */
.lcb-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

/* ── Custom Name Input ─────────────────────────────────────── */
.lcb-name-section {
    margin-bottom: 1.5rem;
}

#lcb-custom-name {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
    background: #fff;
    color: #111827;
}

#lcb-custom-name:focus {
    border-color: #111827;
}

/* ── Layout chính: catalog + preview ──────────────────────── */
.lcb-builder-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 640px) {
    .lcb-builder-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Charm Catalog ─────────────────────────────────────────── */
.lcb-catalog {
    border: 1px solid #f3f4f6;
    border-radius: 0.75rem;
    padding: 1rem;
    background: #fafafa;
}

#lcb-charm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-height: 360px;
    overflow-y: auto;
}

.lcb-charm-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 0.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-align: center;
}

.lcb-charm-item:hover {
    border-color: #111827;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.lcb-charm-item img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.lcb-charm-name {
    font-size: 0.6875rem;
    color: #374151;
    line-height: 1.2;
}

.lcb-charm-price {
    font-size: 0.625rem;
    color: #6b7280;
}

/* ── Preview Canvas ────────────────────────────────────────── */
.lcb-preview {
    position: relative;
}

#lcb-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid #f3f4f6;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fafafa;
}

.lcb-base-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ── Slot indicator (vị trí trống) ────────────────────────── */
.lcb-slot-indicator {
    position: absolute;
    width: 13%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
    border: 2px dashed rgba(212, 175, 122, 0.45);
    border-radius: 50%;
    background: rgba(212, 175, 122, 0.06);
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s;
}

.lcb-slot-indicator::after {
    content: '+';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: rgba(212, 175, 122, 0.5);
    font-weight: 300;
}

/* ── Charm Layer wrapper ───────────────────────────────────── */
.lcb-charm-layer {
    position: absolute;
    width: 14%;
    transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
    pointer-events: none;
    z-index: 10;
    animation: lcb-charm-pop 0.28s cubic-bezier(.34,1.56,.64,1) both;
}

.lcb-charm-layer img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.22));
}

@keyframes lcb-charm-pop {
    from { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.3); opacity: 0; }
    to   { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1);   opacity: 1; }
}

/* Max slots indicator */
.lcb-slots-indicator {
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 0.5rem;
}

/* ── Selected Charms ───────────────────────────────────────── */
.lcb-selected-section {
    margin-top: 1.5rem;
    border-top: 1px solid #f3f4f6;
    padding-top: 1.25rem;
}

.lcb-selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

#lcb-selected-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.lcb-selected-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
}

.lcb-selected-item img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.lcb-charm-item-price {
    margin-left: auto;
    color: #6b7280;
    font-size: 0.75rem;
}

.lcb-remove-charm {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1.125rem;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color 0.15s;
}

.lcb-remove-charm:hover {
    color: #ef4444;
}

.lcb-empty-state {
    color: #9ca3af;
    font-size: 0.8125rem;
    padding: 0.5rem 0;
}

#lcb-clear-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: #9ca3af;
    text-decoration: underline;
    padding: 0;
}

#lcb-clear-all:hover {
    color: #374151;
}

/* ── Price Summary ─────────────────────────────────────────── */
.lcb-price-summary {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    border: 1px solid #f3f4f6;
}

.lcb-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.375rem;
}

.lcb-price-row.lcb-price-total {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.625rem;
    margin-top: 0.375rem;
    margin-bottom: 0;
}

/* ── Add to Cart button ────────────────────────────────────── */
.lcb-add-to-cart-wrap {
    margin-top: 1.25rem;
}

.lcb-btn-add-to-cart {
    display: block;
    width: 100%;
    padding: 0.875rem 2rem;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    letter-spacing: 0.01em;
}

.lcb-btn-add-to-cart:hover {
    background: #1f2937;
}

/* ── Name Layer trên canvas ────────────────────────────────── */
.lcb-name-layer {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: clamp(0.75rem, 2.5cqi, 1.1rem);
    font-style: italic;
    color: #c9a84c;
    letter-spacing: 0.08em;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(255,255,255,0.8);
    z-index: 50;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Notice ────────────────────────────────────────────────── */
#lcb-notice {
    display: none;
    margin-top: 0.75rem;
    padding: 0.625rem 1rem;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    color: #92400e;
}

#lcb-notice.lcb-notice--visible {
    display: block;
}

/* ── Cart / Checkout preview composite ────────────────────── */
.lcb-cart-preview {
    position: relative;
    width: 80px;
    height: 80px;
    display: inline-block;
    border-radius: 6px;
    overflow: hidden;
    background: #f9fafb;
}

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

.lcb-cart-charm-img {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 22%;
    height: 22%;
    object-fit: contain;
    pointer-events: none;
}

.lcb-cart-name-overlay {
    position: absolute;
    bottom: 6%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 7px;
    font-style: italic;
    color: #c9a84c;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255,255,255,0.9);
    pointer-events: none;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}
