/* ─── Floating Button ─── */
#uji-bed-calc-btn {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
    line-height: 1;
}

#uji-bed-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

#uji-bed-calc-btn svg {
    flex-shrink: 0;
}

.uji-pos-left #uji-bed-calc-btn { left: 24px; }
.uji-pos-right #uji-bed-calc-btn { right: 24px; }

/* ─── Popup Overlay ─── */
#uji-bed-calc-popup {
    position: fixed;
    z-index: 100000;
    transition: opacity 0.3s, visibility 0.3s;
}

#uji-bed-calc-popup.uji-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.uji-pos-left #uji-bed-calc-popup { left: 24px; bottom: 80px; }
.uji-pos-right #uji-bed-calc-popup { right: 24px; bottom: 80px; }

/* ─── Popup Card ─── */
.uji-popup-inner {
    width: 340px;
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
    animation: ujiSlideUp 0.3s ease;
}

@keyframes ujiSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Header ─── */
.uji-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    background: #685c54;
    border-radius: 16px 16px 0 0;
}

.uji-popup-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

#uji-popup-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.2s;
}

#uji-popup-close:hover {
    opacity: 1;
}

/* ─── Body ─── */
.uji-popup-body {
    padding: 22px;
}

/* ─── Unit Toggle ─── */
.uji-unit-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0d5cf;
    background: #f7f2ef;
}

.uji-unit-btn {
    flex: 1;
    padding: 9px 0;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    color: #9a8577;
    font-family: inherit;
}

.uji-unit-btn.active {
    background: #685c54;
    color: #fff;
}

.uji-unit-btn:hover:not(.active) {
    background: #ebe3dd;
}

/* ─── Inputs ─── */
.uji-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.uji-input-row .uji-input-group {
    flex: 1;
}

.uji-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #6b5c52;
    margin-bottom: 6px;
}

.uji-unit-label {
    color: #a89585;
    font-weight: 400;
}

.uji-input-group input[type="number"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e0d5cf;
    border-radius: 8px;
    font-size: 15px;
    background: #faf8f6;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    -moz-appearance: textfield;
    color: #3d3228;
}

.uji-input-group input[type="number"]::-webkit-inner-spin-button,
.uji-input-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.uji-input-group input[type="number"]:focus {
    outline: none;
    border-color: #685c54;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(104, 92, 84, 0.1);
}

.uji-input-group input[type="number"].uji-input-error {
    border-color: #e05252;
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(224, 82, 82, 0.12);
    animation: ujiShake 0.35s ease;
}

@keyframes ujiShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-5px); }
    40%       { transform: translateX(5px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.uji-input-full {
    margin-bottom: 8px;
}

.uji-height-note {
    font-size: 12px;
    color: #a89585;
    margin: 4px 0 18px;
}

/* ─── Calculate Button ─── */
#uji-calculate-btn {
    display: block;
    width: 100%;
    padding: 13px;
    background: #685c54;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: inherit;
    letter-spacing: 0.5px;
}

#uji-calculate-btn:hover {
    background: #c06a44;
    box-shadow: 0 4px 12px rgba(104, 92, 84, 0.3);
}

/* ─── Result Area ─── */
#uji-result {
    margin-top: 18px;
    transition: opacity 0.2s ease;
}

#uji-result.uji-hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* ── Match result ── */
.uji-result-match {
    background: linear-gradient(135deg, #fdf6f0, #fef9f5);
    border: 1px solid #e8d5c4;
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
}

.uji-result-match .uji-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: #685c54;
    border-radius: 50%;
}

.uji-result-match .uji-result-icon svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.uji-result-match .uji-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #8b5a3c;
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ── Custom result ── */
.uji-result-custom {
    background: linear-gradient(135deg, #fef7ec, #fffaf2);
    border: 1px solid #f0d78c;
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
}

.uji-result-custom .uji-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: #e8a84c;
    border-radius: 50%;
}

.uji-result-custom .uji-result-icon svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.uji-result-custom .uji-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #8a6d00;
    margin-bottom: 4px;
}

.uji-result-custom .uji-result-price {
    display: inline-block;
    background: #685c54;
    color: #fff;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    margin: 8px 0;
}

.uji-result-custom .uji-result-sub {
    font-size: 13px;
    color: #7a6a5c;
    margin-top: 8px;
}

/* ── WhatsApp button ── */
.uji-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 24px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, box-shadow 0.2s;
}

.uji-whatsapp-btn:hover {
    background: #1fb855;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.uji-whatsapp-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ── Error result ── */
.uji-result-error {
    background: #fef0f0;
    border: 1px solid #f0b8b8;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    color: #c0392b;
    font-size: 14px;
}

/* ─── Mobile ─── */
@media (max-width: 480px) {
    .uji-pos-left #uji-bed-calc-popup,
    .uji-pos-right #uji-bed-calc-popup {
        left: 12px;
        right: 12px;
        bottom: 80px;
    }

    .uji-popup-inner {
        width: auto;
    }

    #uji-bed-calc-btn {
        left: 12px;
        right: auto;
        bottom: 16px;
    }

    .uji-pos-right #uji-bed-calc-btn {
        left: auto;
        right: 12px;
    }
}
