/**
 * Chocolate Figures Builder Stylesheet
 * Aligned with the high-end DIY Chocolate configurator aesthetics.
 */

:root {
    --diy-primary: #a37254;
    --diy-primary-hover: #8c5f43;
    --diy-text: #333333;
    --diy-text-muted: #666666;
    --diy-bg-card: #ffffff;
    --diy-bg-body: #fdfaf6;
    --diy-border: #e8e2d9;
    --diy-radius: 4px;
    --diy-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --diy-font: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.kakao-figure-builder-container {
    font-family: var(--diy-font);
    color: var(--diy-text);
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.kakao-figure-builder-container * {
    box-sizing: border-box;
}

/* Step Title Styling */
.builder-section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px dashed var(--diy-border);
    padding-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--diy-text);
}

.builder-section-title::before,
.builder-section-title::after {
    content: "";
    display: inline-block;
    width: 40px;
    height: 1px;
    background: var(--diy-border);
    vertical-align: middle;
    margin: 0 15px;
}

.builder-section-title .number {
    background: var(--diy-primary);
    color: #fff;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    margin-right: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

/* 1. FIGURE SELECTOR GRID */
.figure-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 25px;
}

.figure-select-item {
    background: #fff;
    border: 1px solid var(--diy-border);
    border-radius: var(--diy-radius);
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.figure-select-item:hover {
    border-color: var(--diy-primary);
    box-shadow: 0 4px 12px rgba(163, 114, 84, 0.08);
    transform: translateY(-1px);
}

.figure-select-item.active {
    border-color: var(--diy-primary);
    background: #faf8f5;
    box-shadow: 0 4px 15px rgba(163, 114, 84, 0.12);
}

.figure-thumbnail {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.figure-thumbnail img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.figure-meta .figure-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--diy-text);
}

/* 2. WORKSPACE LAYOUT */
.figure-builder-workspace {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 1024px) {
    .figure-builder-workspace {
        grid-template-columns: 1fr;
    }
}

/* WOODMART SIDEBAR REMOVAL & FULL-WIDTH FORCE FOR FIGURE BUILDER PAGE */
.post-type-archive-product .sidebar-container,
.single-product .sidebar-container,
.page-template-default .sidebar-container,
.figure-builder-page-sidebar-hide .sidebar-container,
aside.sidebar-container {
    display: none !important;
}

.content-layout-wrapper {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
}

.site-content {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 1200px !important; /* Elegant boundary centered inside theme */
    margin: 0 auto !important;
    float: none !important;
}

@media (max-width: 768px) {
    .content-layout-wrapper,
    .site-content,
    .main-page-wrapper,
    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        float: none !important;
    }
}

/* LEFT: PREVIEW VISUALIZER PANEL */
.figure-visualizer-panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chocolate-shapes-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 16 / 9; /* Standard horizontal ratio matching Laravel project */
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.chocolate-shapes-wrapper.vertical-target {
    max-width: 360px;
    aspect-ratio: 9 / 16; /* Tall vertical ratio for Coupe matching Laravel project */
}

.chocolate-shape-item {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: contain;
    display: none;
}

.chocolate-shape-item.active {
    display: block;
}

/* Specific text placeholders aligned with the old site */
.text-placeholder {
    position: absolute;
}

.svg-text {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 1px;
}

.figure-svg-straight,
.figure-svg-curved {
    display: none;
    width: 100%;
    height: 100%;
}

.figure-svg-straight.active,
.figure-svg-curved.active {
    display: block;
}

/* 1. Sport Car (Porsche) placement */
.placeholder-sport-car {
    width: 18.5%;
    height: 4.5%;
    left: 38.5%;
    top: 48.5%;
}

/* 2. Truck placement */
.placeholder-truck {
    width: 61%;
    height: 4.5%;
    left: 31.5%;
    top: 48.5%;
}

/* 3. Champagne Bottle placement */
.placeholder-champagne {
    width: 40%;
    height: 4.5%;
    left: 28%;
    bottom: 17.5%;
}

/* 4. Sport Shoes placement */
.placeholder-sport-shoes {
    width: 25%;
    height: 6.8%;
    left: 37.3%;
    top: 50.8%;
    transform: rotate(-15.2deg);
}

/* 5. Sport Cup (Coupe) placement */
.placeholder-sport-cup {
    width: 32%;
    height: auto;
    left: 34.5%;
    top: 18.5%;
    line-height: 0;
    padding: 0;
    aspect-ratio: 1 / 1;
}

.svg-text.sport-cup-svg-text {
    position: relative;
    width: 100%;
    height: auto;
    left: 0;
    top: 0;
}

/* Chocolate Letters Font Styling inside SVGs */
.main-svg, .figure-live-text, .svg-text textPath {
    fill: #906c37 !important; /* Original gold-brown cocoa color */
    font-weight: 700;
    line-height: 1em;
    text-transform: uppercase;
    font-family: 'Courier New', Courier, monospace;
}

#straight-svg-text {
    font-size: 11px;
}

.live-figure-text-path {
    font-size: 72px !important;
    letter-spacing: 4px;
    font-weight: 900 !important;
}

#curved-svg-text {
    font-size: 32px;
    letter-spacing: 2px;
}

/* RIGHT: FORM CONTROL PANEL */
.figure-form-panel {
    background: #fffdfb;
    border: 1px solid #ebdcb9;
    border-radius: var(--diy-radius);
    padding: 24px;
    box-shadow: var(--diy-shadow);
}

.message-input-wrapper {
    margin-bottom: 24px;
}

.figure-message-input {
    width: 100%;
    height: 48px;
    padding: 0 15px;
    font-size: 15px;
    border: 1px solid var(--diy-border);
    border-radius: var(--diy-radius);
    color: var(--diy-text);
    outline: none;
    transition: border-color 0.2s ease;
    background: #fff;
}

.figure-message-input:focus {
    border-color: var(--diy-primary);
}

.symbols-counter {
    font-size: 12px;
    color: var(--diy-text-muted);
    margin-top: 8px;
}

.symbols-counter .remaining-chars {
    color: var(--diy-primary);
    font-weight: 700;
}

/* Purchase box styling */
.figure-purchase-box {
    border-top: 1px solid var(--diy-border);
    padding-top: 24px;
}

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

.price-display .label {
    font-size: 14px;
    color: var(--diy-text-muted);
}

.price-display .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--diy-primary);
}

/* Quantity and cart integrations */
.quantity-add-cart {
    display: flex;
    gap: 15px;
    align-items: center;
}



.add-to-cart-btn {
    flex-grow: 1;
    background: var(--diy-primary) !important;
    color: #fff !important;
    border: none !important;
    height: 48px;
    border-radius: var(--diy-radius) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    cursor: pointer;
    transition: background-color 0.2s ease !important;
}

.add-to-cart-btn:hover {
    background: var(--diy-primary-hover) !important;
}

/* RESPONSIVENESS */
@media (max-width: 768px) {
    /* Force Woodmart parent wrappers to behave */
    .content-layout-wrapper,
    .site-content,
    .main-page-wrapper {
        overflow-x: hidden !important;
    }

    .kakao-figure-builder-container {
        margin: 20px auto !important;
        padding: 0 12px !important;
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .figure-selector-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .figure-builder-workspace {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .figure-visualizer-panel {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .chocolate-shapes-wrapper {
        max-width: 100% !important;
    }

    .figure-form-panel {
        padding: 16px !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        float: none !important;
    }
}

@media (max-width: 480px) {
    .kakao-figure-builder-container {
        padding: 0 10px !important;
    }

    .figure-selector-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .builder-section-title {
        font-size: 16px;
    }

    .figure-form-panel {
        padding: 14px !important;
    }

    .quantity-add-cart {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .quantity-input-box {
        width: 100%;
    }

    .add-to-cart-btn {
        width: 100%;
    }
}
