/* ===== Farmin rule-based chatbot widget ===== */
.fchat, .fchat * { box-sizing: border-box; }
.fchat {
    --fc-green: #245B3A;
    --fc-deep: #173F2A;
    --fc-leaf: #65A832;
    --fc-lime: #B7D957;
    --fc-mint: #DDEED2;
    --fc-cream: #F6F1E7;
    font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, sans-serif;
}

/* ---- launcher button ---- */
.fchat-launcher {
    position: fixed;
    right: 24px; bottom: 24px;
    width: 62px; height: 62px;
    border: none;
    border-radius: 50%;
    background: var(--fc-green);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(23, 63, 42, .38);
    z-index: 9998;
    transition: transform .2s ease, background .2s ease;
}
.fchat-launcher:hover { transform: translateY(-3px); background: var(--fc-deep); }
.fchat-launcher i { font-size: 30px; line-height: 1; }
.fchat-launcher .fchat-badge {
    position: absolute;
    top: -3px; right: -3px;
    min-width: 20px; height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #e0483d;
    color: #fff;
    font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}
.fchat-launcher .fchat-icon-close { display: none; }
.fchat.is-open .fchat-launcher .fchat-icon-open { display: none; }
.fchat.is-open .fchat-launcher .fchat-icon-close { display: block; }
.fchat.is-open .fchat-launcher .fchat-badge { display: none; }

/* ---- panel ---- */
.fchat-panel {
    position: fixed;
    right: 24px; bottom: 100px;
    width: 372px;
    height: 560px;
    max-height: calc(100vh - 130px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(16px) scale(.98);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}
.fchat.is-open .fchat-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ---- header ---- */
.fchat-header {
    background: linear-gradient(135deg, var(--fc-green), var(--fc-deep));
    color: #fff;
    padding: 20px 20px 18px;
    position: relative;
}
.fchat-header .fchat-h-top { display: flex; align-items: center; gap: 10px; }
.fchat-header .fchat-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
    object-fit: contain;
}
.fchat-header h3 { font-size: 17px; font-weight: 700; }
.fchat-header .fchat-status { font-size: 12px; opacity: .85; margin-top: 2px; }
.fchat-header .fchat-status::before {
    content: ''; display: inline-block;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--fc-lime); margin-right: 5px;
    vertical-align: middle;
}
.fchat-header .fchat-close {
    position: absolute;
    top: 16px; right: 14px;
    background: none; border: none; color: #fff;
    font-size: 24px; cursor: pointer; opacity: .85;
    line-height: 1;
}
.fchat-header .fchat-close:hover { opacity: 1; }
.fchat-header .fchat-intro { font-size: 13px; line-height: 1.5; margin-top: 12px; opacity: .95; }

/* ---- messages ---- */
.fchat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 8px;
    background: #f5f6f4;
}
.fchat-row { display: flex; margin-bottom: 12px; align-items: flex-end; gap: 8px; }
.fchat-row.bot { justify-content: flex-start; }
.fchat-row.user { justify-content: flex-end; }
.fchat-row .fchat-mini {
    width: 28px; height: 28px; border-radius: 8px;
    background: #fff; padding: 3px; object-fit: contain;
    box-shadow: 0 1px 3px rgba(0,0,0,.1); flex-shrink: 0;
}
.fchat-bubble {
    max-width: 78%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-line;
    word-break: break-word;
}
.fchat-row.bot .fchat-bubble {
    background: #fff;
    color: #222;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.fchat-row.user .fchat-bubble {
    background: var(--fc-green);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.fchat-bubble b { font-weight: 700; }

/* ---- product card ---- */
.fchat-card {
    background: #fff;
    border: 1px solid #e7e7e2;
    border-radius: 14px;
    overflow: hidden;
    max-width: 84%;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.fchat-card img { width: 100%; height: 132px; object-fit: cover; display: block; }
.fchat-card .fchat-card-body { padding: 12px 14px 14px; }
.fchat-card .fchat-card-cat {
    display: inline-block;
    font-size: 11px; font-weight: 700;
    color: var(--fc-leaf);
    background: var(--fc-mint);
    padding: 2px 8px; border-radius: 20px;
    margin-bottom: 6px;
}
.fchat-card h4 { font-size: 15px; font-weight: 700; color: #1a1a1a; }
.fchat-card .fchat-card-desc { font-size: 12.5px; color: #555; line-height: 1.5; margin-top: 6px; }
.fchat-card .fchat-card-spec { font-size: 11.5px; color: #888; margin-top: 8px; }

/* ---- quick replies ---- */
.fchat-quicks {
    display: flex; flex-wrap: wrap; gap: 7px;
    padding: 2px 4px 14px 44px;
}
.fchat-quick {
    background: #fff;
    border: 1.5px solid var(--fc-green);
    color: var(--fc-green);
    font-size: 13px; font-weight: 600;
    padding: 8px 13px;
    border-radius: 20px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.fchat-quick:hover { background: var(--fc-green); color: #fff; }
.fchat-quick.solid { background: var(--fc-lime); border-color: var(--fc-lime); color: var(--fc-deep); }
.fchat-quick.solid:hover { background: var(--fc-leaf); border-color: var(--fc-leaf); color: #fff; }

/* ---- typing ---- */
.fchat-typing { display: flex; gap: 4px; padding: 4px 2px; }
.fchat-typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: #b8bdb6; animation: fchat-blink 1.2s infinite ease-in-out;
}
.fchat-typing span:nth-child(2) { animation-delay: .2s; }
.fchat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes fchat-blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

/* ---- input ---- */
.fchat-foot {
    border-top: 1px solid #ececec;
    padding: 10px 12px;
    background: #fff;
}
.fchat-inputbar { display: flex; gap: 8px; align-items: center; }
.fchat-inputbar input {
    flex: 1;
    border: 1px solid #dcdcd6;
    border-radius: 22px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.fchat-inputbar input:focus { border-color: var(--fc-green); }
.fchat-send {
    width: 40px; height: 40px; flex-shrink: 0;
    border: none; border-radius: 50%;
    background: var(--fc-green); color: #fff;
    cursor: pointer; font-size: 19px;
    display: flex; align-items: center; justify-content: center;
}
.fchat-send:hover { background: var(--fc-deep); }
.fchat-disclaimer { font-size: 11px; color: #aaa; text-align: center; margin-top: 7px; }

/* ---- mobile ---- */
@media (max-width: 480px) {
    .fchat-panel {
        right: 0; bottom: 0; left: 0;
        width: 100%; height: 88vh; max-height: 88vh;
        border-radius: 18px 18px 0 0;
    }
    .fchat-launcher { right: 16px; bottom: 16px; }
}
