/* ── Fudge Kitchen AI Chatbot — Dark Blue Theme ──────────────────────── */
:root {
    --fk-primary:   #131B68;
    --fk-dark:      #0c1250;
    --fk-accent:    #3b5998;
    --fk-light-bg:  #EEF0F8;
    --fk-orange:    #C8793A;
    --fk-border:    #dce0f0;
}

.fk-chatbot-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Montserrat, sans-serif;
}

/* ── Toggle button — circle, icon only ─────────────────────────────── */
.fk-chat-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--fk-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(19,27,104,0.45);
    transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
}
.fk-chat-toggle:hover  { background: var(--fk-dark); transform: scale(1.08) translateY(-2px); }
.fk-chat-toggle.active { background: #4a5568; box-shadow: 0 2px 10px rgba(0,0,0,0.25); }

/* Pulse ring when closed */
.fk-chat-toggle:not(.active)::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(19,27,104,0.3);
    animation: fk-pulse-ring 2.5s ease-out infinite;
}
@keyframes fk-pulse-ring {
    0%   { transform: scale(1); opacity: 0.8; }
    70%  { transform: scale(1.35); opacity: 0; }
    100% { opacity: 0; }
}

.fk-toggle-icon { display: flex; align-items: center; justify-content: center; }

/* ── Chat window ────────────────────────────────────────────────────── */
.fk-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 370px;
    height: 700px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 48px rgba(19,27,104,0.22), 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--fk-border);
    animation: fk-slide-up 0.25s ease-out;
}
@keyframes fk-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ─────────────────────────────────────────────────────────── */
.fk-chat-header {
    background: linear-gradient(135deg, var(--fk-primary) 0%, #1e2d8f 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.fk-chat-header-info { display: flex; align-items: center; gap: 10px; }
.fk-chat-avatar {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.fk-chat-header strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.fk-chat-header span   { font-size: 11px; opacity: 0.8; }
.fk-chat-header-close {
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; transition: background 0.15s; flex-shrink: 0;
}
.fk-chat-header-close:hover { background: rgba(255,255,255,0.28); }

/* ── Tabs ───────────────────────────────────────────────────────────── */
.fk-quick-actions {
    display: flex;
    padding: 8px 8px 0;
    gap: 4px;
    background: #f4f5fb;
    flex-shrink: 0;
    border-bottom: 2px solid var(--fk-border);
}
.fk-qa-btn {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 7px 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    color: #666;
    font-family: inherit;
    border-radius: 6px 6px 0 0;
}
.fk-qa-btn:hover  { color: var(--fk-primary); background: rgba(19,27,104,0.06); }
.fk-qa-btn.active { color: var(--fk-primary); border-bottom-color: var(--fk-primary); background: #fff; }

/* ── Mode panels ────────────────────────────────────────────────────── */
.fk-mode-panel { display: none; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
.fk-mode-panel.active { display: flex; }

/* ── Chat messages ──────────────────────────────────────────────────── */
.fk-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    background: #fafbff;
}
.fk-messages::-webkit-scrollbar { width: 4px; }
.fk-messages::-webkit-scrollbar-thumb { background: #c5cae9; border-radius: 4px; }

.fk-msg { display: flex; align-items: flex-end; gap: 6px; }
.fk-msg-user { justify-content: flex-end; }

.fk-msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
}
.fk-msg-bot .fk-msg-bubble {
    background: var(--fk-light-bg);
    color: #1a1a2e;
    border-radius: 4px 18px 18px 18px;
}
.fk-msg-user .fk-msg-bubble {
    background: var(--fk-primary);
    color: #fff;
    border-radius: 18px 4px 18px 18px;
}

/* Bot avatar dot */
.fk-msg-bot::before {
    content: '🍫';
    font-size: 18px;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 2px;
}

/* ── Typing indicator ───────────────────────────────────────────────── */
.fk-typing .fk-msg-bubble {
    display: flex; align-items: center; gap: 5px;
    padding: 12px 16px; background: var(--fk-light-bg);
}
.fk-typing span {
    display: inline-block;
    width: 7px; height: 7px;
    background: var(--fk-accent);
    border-radius: 50%;
    animation: fk-bounce 1.2s infinite;
}
.fk-typing span:nth-child(2) { animation-delay: 0.2s; }
.fk-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes fk-bounce {
    0%,80%,100% { transform: translateY(0); }
    40%          { transform: translateY(-7px); }
}

/* ── Input row ──────────────────────────────────────────────────────── */
.fk-input-row {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
    border-top: 1px solid var(--fk-border);
    background: #fff;
    flex-shrink: 0;
}
.fk-input-row input {
    flex: 1;
    padding: 9px 14px;
    border: 1.5px solid var(--fk-border);
    border-radius: 22px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    background: #f9faff;
    transition: border-color 0.15s;
}
.fk-input-row input:focus { border-color: var(--fk-primary); background: #fff; }
.fk-input-row button {
    background: var(--fk-primary);
    color: #fff;
    border: none;
    border-radius: 22px;
    padding: 9px 18px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    transition: background 0.15s;
    display: flex; align-items: center; gap: 5px;
}
.fk-input-row button:hover { background: var(--fk-dark); }

/* ── Form panels ────────────────────────────────────────────────────── */
.fk-form-panel {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fafbff;
}
.fk-form-panel h4    { margin: 0 0 6px; font-size: 15px; color: var(--fk-primary); font-weight: 800; }
.fk-form-panel label { font-size: 12px; color: #555; font-weight: 700; }
.fk-form-panel input,
.fk-form-panel select {
    padding: 9px 12px;
    border: 1.5px solid var(--fk-border);
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
}
.fk-form-panel input:focus,
.fk-form-panel select:focus { border-color: var(--fk-primary); }

.fk-btn-primary {
    background: var(--fk-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s;
}
.fk-btn-primary:hover  { background: var(--fk-dark); }
.fk-btn-primary:active { transform: scale(0.98); }

/* ── Results ────────────────────────────────────────────────────────── */
.fk-results  { margin-top: 8px; }
.fk-loading  { text-align: center; color: var(--fk-accent); font-size: 13px; padding: 20px; }
.fk-error    { color: #c0392b; font-size: 13px; background: #fff0f0; padding: 8px 10px; border-radius: 8px; }

/* ── Product cards ──────────────────────────────────────────────────── */
.fk-product-card {
    display: block;
    border: 1.5px solid var(--fk-border);
    border-radius: 12px;
    padding: 11px 13px;
    margin: 6px 0;
    text-decoration: none;
    color: #1a1a2e;
    transition: all 0.15s;
    background: #fff;
}
.fk-product-card:hover  { border-color: var(--fk-primary); background: #f0f2ff; box-shadow: 0 2px 10px rgba(19,27,104,0.1); }
.fk-product-card strong { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 3px; color: #1a1a2e; }
.fk-product-card .fk-price {
    display: inline-block;
    color: #fff;
    background: var(--fk-primary);
    font-weight: 700;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 5px;
}
.fk-product-card .fk-why {
    display: block;
    font-size: 12px;
    color: #444;
    margin-top: 4px;
    line-height: 1.45;
}
.fk-product-card .fk-qty-tip {
    display: block;
    font-size: 11.5px;
    color: var(--fk-accent);
    margin-top: 3px;
    font-style: italic;
}

/* Bot message product cards (inside chat bubble) */
.fk-msg-bot .fk-product-card { background: #fff; border-color: #c5cae9; }
.fk-msg-bot .fk-product-card:hover { border-color: var(--fk-primary); }

/* ── Product card with image layout ─────────────────────────────────── */
.fk-product-card { display: flex; align-items: center; gap: 10px; }
.fk-product-img {
    width: 52px; height: 52px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid var(--fk-border);
}
.fk-product-info { flex: 1; min-width: 0; }
.fk-product-info strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 3px; }

/* Sale price — green badge; original crossed out */
.fk-price.fk-sale {
    background: #e8f5e9; color: #2e7d32;
    border: 1px solid #a5d6a7;
}
.fk-price.fk-original {
    background: none; color: #999;
    text-decoration: line-through;
    font-size: 11px; padding: 2px 6px;
}

/* Out of stock badge */
.fk-out-of-stock {
    display: inline-block;
    font-size: 10.5px; color: #c0392b;
    background: #fff0f0; border: 1px solid #f5c6cb;
    border-radius: 10px; padding: 1px 7px; margin: 3px 0;
}

/* Gift wrap tip */
.fk-wrap-tip {
    display: block;
    font-size: 11.5px; color: #6a1b9a;
    margin-top: 3px; font-style: italic;
}

/* Bundle qty badge + subtotal */
.fk-qty-badge {
    display: inline-block;
    font-size: 11px; font-weight: 700;
    color: #fff; background: var(--fk-accent);
    border-radius: 10px; padding: 1px 7px; margin-left: 4px;
}
.fk-subtotal {
    display: block; font-size: 11.5px; color: #555; margin-top: 2px;
}

/* Bundle name heading */
.fk-bundle-name {
    font-weight: 800; font-size: 14px; color: var(--fk-primary);
    background: var(--fk-light-bg); padding: 7px 12px;
    border-radius: 8px; margin-bottom: 4px;
}

/* Search query understood tag */
.fk-query-tag {
    font-size: 11.5px; color: var(--fk-accent);
    background: #e8eaf6; border-left: 3px solid var(--fk-primary);
    padding: 5px 10px; border-radius: 0 8px 8px 0;
    margin-bottom: 6px; font-style: italic;
}

/* Budget used / remaining info bar */
.fk-budget-info {
    font-size: 12px; color: #555; background: #f0f4ff;
    padding: 6px 12px; border-radius: 8px; margin-top: 6px;
    text-align: center;
}

/* Add All to Cart button */
.fk-add-all-btn {
    display: block; width: 100%;
    background: var(--fk-primary); color: #fff;
    border: none; border-radius: 10px;
    padding: 11px; font-size: 13.5px; font-weight: 700;
    cursor: pointer; margin-top: 10px;
    font-family: inherit; transition: background 0.15s, transform 0.1s;
}
.fk-add-all-btn:hover   { background: var(--fk-dark); }
.fk-add-all-btn:active  { transform: scale(0.98); }
.fk-add-all-btn:disabled { background: #9fa8da; cursor: not-allowed; }

/* ── Intro message ──────────────────────────────────────────────────── */
.fk-intro-msg {
    background: linear-gradient(135deg, var(--fk-light-bg) 0%, #e8eaf6 100%);
    border-radius: 4px 18px 18px 18px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #1a1a2e;
    max-width: 85%;
}
.fk-intro-msg strong { color: var(--fk-primary); }

/* ── Occasion / result message block ────────────────────────────────── */
.fk-result-msg {
    font-size: 13px; color: #333; line-height: 1.55;
    background: var(--fk-light-bg); padding: 10px 13px;
    border-radius: 10px; margin-bottom: 6px;
}
.fk-special-service {
    font-size: 12px; color: var(--fk-accent);
    background: #e8eaf6; border-left: 3px solid var(--fk-primary);
    padding: 8px 10px; border-radius: 0 8px 8px 0;
    margin-top: 6px; font-style: italic;
}
.fk-bundle-total {
    font-weight: 800; font-size: 15px;
    color: var(--fk-primary); margin-top: 10px;
    padding: 8px 12px; background: var(--fk-light-bg);
    border-radius: 8px; text-align: center;
}
.fk-tip {
    font-size: 12px; color: #555;
    font-style: italic; margin-top: 5px;
    padding: 6px 10px; background: #fffbea;
    border-radius: 8px;
}

/* ── Cart widget ─────────────────────────────────────────────────────── */
.fk-cart-widget {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.fk-cart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--fk-border);
}
.fk-cart-row:last-of-type { border-bottom: none; }

.fk-cart-img {
    width: 44px; height: 44px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--fk-border);
    flex-shrink: 0;
}

.fk-cart-row-info {
    flex: 1;
    min-width: 0;
}
.fk-cart-row-info strong {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fk-cart-price {
    font-size: 12px;
    color: var(--fk-primary);
    font-weight: 700;
}

.fk-cart-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.fk-qty-btn {
    width: 26px; height: 26px;
    background: var(--fk-light-bg);
    border: 1.5px solid var(--fk-border);
    border-radius: 6px;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--fk-primary);
    font-weight: 700;
    transition: background 0.12s;
    padding: 0;
}
.fk-qty-btn:hover { background: #dde0f5; }

.fk-qty-num {
    min-width: 22px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
}

.fk-cart-del {
    width: 26px; height: 26px;
    background: #fff0f0;
    border: 1.5px solid #f5c6cb;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #c0392b;
    font-weight: 700;
    transition: background 0.12s;
    padding: 0;
    margin-left: 2px;
}
.fk-cart-del:hover { background: #ffe0e0; }

.fk-cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 2px 4px;
    font-size: 14px;
    font-weight: 800;
    color: var(--fk-primary);
    border-top: 2px solid var(--fk-border);
    margin-top: 4px;
}
.fk-cart-total-label { color: #555; font-weight: 600; font-size: 12px; }
.fk-cart-total-val   { color: var(--fk-primary); font-size: 15px; }

.fk-view-cart-link {
    display: block;
    text-align: center;
    margin-top: 8px;
    padding: 8px;
    background: var(--fk-primary);
    color: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s;
}
.fk-view-cart-link:hover { background: var(--fk-dark); color: #fff; }

/* ── Section title (wishlist / bestsellers / orders heading) ────────── */
.fk-section-title {
    font-size: 13px; font-weight: 800;
    color: var(--fk-primary);
    padding: 6px 2px 8px;
    border-bottom: 2px solid var(--fk-border);
    margin-bottom: 6px;
}

/* ── Orders widget ───────────────────────────────────────────────────── */
.fk-orders-widget { width: 100%; display: flex; flex-direction: column; gap: 8px; }

.fk-order-card {
    border: 1.5px solid var(--fk-border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    font-size: 12.5px;
    line-height: 1.6;
}

.fk-order-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.fk-order-num { font-weight: 800; color: var(--fk-primary); font-size: 13px; }

/* Status badges */
.fk-order-badge {
    font-size: 10.5px; font-weight: 700;
    padding: 2px 9px; border-radius: 20px;
    text-transform: capitalize;
}
.fk-badge-pending    { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.fk-badge-processing { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.fk-badge-shipped    { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.fk-badge-delivered  { background: #f3e5f5; color: #6a1b9a; border: 1px solid #ce93d8; }
.fk-badge-cancelled  { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }

.fk-order-meta  { color: #888; font-size: 11.5px; margin-bottom: 4px; }
.fk-order-items { color: #444; margin-bottom: 4px; }
.fk-order-total { font-weight: 700; color: var(--fk-primary); }

/* ── Footer ─────────────────────────────────────────────────────────── */
.fk-chat-footer {
    text-align: center;
    font-size: 10.5px;
    color: #aaa;
    padding: 6px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

/* ── Flavor Picker ───────────────────────────────────────────────────── */
.fk-flavor-picker {
    background: #fff8f0;
    border: 1.5px solid #f0cfa0;
    border-radius: 12px;
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.fk-flavor-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--fk-dark);
}
.fk-flavor-subtitle {
    font-size: 11.5px;
    color: #888;
    margin-top: -6px;
}
.fk-flavor-box-group {
    background: #fff;
    border: 1px solid #ecdfc8;
    border-radius: 9px;
    padding: 8px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fk-flavor-box-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--fk-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}
.fk-flavor-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fk-flavor-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--fk-primary);
    min-width: 40px;
    flex-shrink: 0;
}
.fk-flavor-sel {
    flex: 1;
    width: 100px;
    padding: 6px 8px;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    font-size: 12.5px;
    color: #333;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}
.fk-flavor-sel:focus  { border-color: var(--fk-primary); }
.fk-flavor-sel--error { border-color: #e53935 !important; background: #fff5f5; }
.fk-flavor-error {
    font-size: 11.5px;
    color: #e53935;
    background: #fff0f0;
    border-radius: 6px;
    padding: 5px 8px;
}
.fk-flavor-add-btn {
    margin-top: 2px;
    background: var(--fk-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    align-self: flex-start;
}
.fk-flavor-add-btn:hover    { background: var(--fk-dark); }
.fk-flavor-add-btn:active   { transform: scale(0.97); }
.fk-flavor-add-btn:disabled { background: #9fa8da; cursor: not-allowed; }

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 420px) {
    .fk-chat-window { width: calc(100vw - 16px); right: 8px; bottom: 88px; height: calc(100vh - 110px); }
    .fk-chatbot-container { bottom: 20px; right: 10px; }
}
