/* ==========================================================================
   YAKIN JANI AI — Async Chat Widget Styles (Maroon & Ivory Theme)
   ========================================================================== */

.yj-chat-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9980;
    width: 72px;
    height: 72px;
    border-radius: 50% 50% 18% 50%;
    background: linear-gradient(145deg, #660c32 0%, var(--maroon, #7a1f2b) 100%);
    border: 3px solid rgba(255, 255, 255, 0.32);
    box-shadow: 0 10px 26px rgba(85, 19, 29, 0.38), 0 2px 6px rgba(0, 0, 0, 0.18);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: var(--ff, "Mukta", system-ui, sans-serif);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.yj-chat-fab:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 14px 30px rgba(85, 19, 29, 0.45);
}
.yj-chat-fab:focus-visible {
    outline: 3px solid var(--saffron, #e0701a);
    outline-offset: 3px;
}
.yj-chat-fab svg {
    width: 28px;
    height: 28px;
    display: block;
}
.yj-chat-fab span {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
}
.yj-chat-fab.is-open {
    transform: scale(0.92);
}

.yj-chat-panel {
    position: fixed;
    right: 22px;
    bottom: 104px;
    z-index: 9985;
    width: min(410px, calc(100vw - 24px));
    height: min(620px, calc(100vh - 130px));
    background: var(--paper, #fffdf8);
    color: var(--ink, #231815);
    border: 1px solid rgba(122, 31, 43, 0.2);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(35, 24, 21, 0.24);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--ff, "Mukta", system-ui, sans-serif);
}
.yj-chat-panel.is-open {
    display: flex;
    animation: yjChatSlideUp 0.18s ease-out;
}
@keyframes yjChatSlideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="dark"] .yj-chat-panel {
    background: #1b1514;
    color: #f4ece3;
    border-color: rgba(212, 166, 86, 0.28);
}

.yj-chat-head {
    background: linear-gradient(135deg, #660c32 0%, var(--maroon-d, #55131d) 100%);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.yj-chat-title-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.yj-chat-title {
    font-family: var(--ff-h, "Fraunces", Georgia, serif);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}
.yj-chat-sub {
    font-size: 11.5px;
    opacity: 0.88;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yj-chat-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.yj-chat-lang {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
}
.yj-chat-lang option {
    color: #231815;
    background: #fff;
}
.yj-chat-close {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.yj-chat-close:hover {
    background: rgba(255, 255, 255, 0.26);
}

.yj-chat-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--ivory, #fbf6ec);
    border-bottom: 1px solid rgba(122, 31, 43, 0.14);
}
[data-theme="dark"] .yj-chat-tabs {
    background: #241b19;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}
.yj-chat-tab {
    border: 0;
    background: transparent;
    padding: 9px 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: inherit;
    opacity: 0.72;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.yj-chat-tab.is-active {
    opacity: 1;
    color: var(--maroon, #7a1f2b);
    border-bottom-color: var(--saffron, #e0701a);
    background: rgba(224, 112, 26, 0.06);
}
[data-theme="dark"] .yj-chat-tab.is-active {
    color: #f3c46b;
}

.yj-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.yj-msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.48;
    word-wrap: break-word;
}
.yj-msg.is-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #660c32 0%, var(--maroon, #7a1f2b) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.yj-msg.is-bot {
    align-self: flex-start;
    background: var(--ivory, #fbf6ec);
    border: 1px solid rgba(122, 31, 43, 0.12);
    border-bottom-left-radius: 4px;
}
[data-theme="dark"] .yj-msg.is-bot {
    background: #271f1d;
    border-color: rgba(255, 255, 255, 0.1);
}
.yj-msg a {
    color: var(--maroon, #7a1f2b);
    font-weight: 600;
    text-decoration: underline;
}
[data-theme="dark"] .yj-msg a {
    color: #f3c46b;
}

.yj-cites {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px dashed rgba(122, 31, 43, 0.18);
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.yj-cite-pill {
    font-size: 11.5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(122, 31, 43, 0.08);
    color: var(--maroon, #7a1f2b);
    text-decoration: none !important;
}
[data-theme="dark"] .yj-cite-pill {
    background: rgba(243, 196, 107, 0.15);
    color: #f3c46b;
}

.yj-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.yj-chip {
    background: #fff;
    border: 1px solid rgba(122, 31, 43, 0.24);
    color: var(--maroon, #7a1f2b);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12.5px;
    cursor: pointer;
    text-align: left;
}
.yj-chip:hover {
    background: rgba(122, 31, 43, 0.08);
}
[data-theme="dark"] .yj-chip {
    background: #2f2422;
    color: #f4ece3;
    border-color: rgba(243, 196, 107, 0.3);
}

.yj-kundli-card {
    background: #fff;
    border: 1px solid rgba(180, 142, 69, 0.45);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
}
[data-theme="dark"] .yj-kundli-card {
    background: #221a18;
    border-color: rgba(243, 196, 107, 0.35);
}
.yj-kundli-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 8px 0;
}
.yj-kundli-kv {
    background: var(--ivory, #fbf6ec);
    padding: 5px 7px;
    border-radius: 8px;
}
[data-theme="dark"] .yj-kundli-kv {
    background: #2c221f;
}
.yj-kundli-kv small {
    display: block;
    font-size: 11px;
    opacity: 0.72;
}
.yj-kundli-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.yj-btn-sm {
    border: 1px solid rgba(122, 31, 43, 0.3);
    background: transparent;
    color: var(--maroon, #7a1f2b);
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.yj-btn-sm.is-primary {
    background: var(--maroon, #7a1f2b);
    color: #fff;
    border-color: var(--maroon, #7a1f2b);
}
[data-theme="dark"] .yj-btn-sm {
    color: #f3c46b;
    border-color: rgba(243, 196, 107, 0.4);
}
[data-theme="dark"] .yj-btn-sm.is-primary {
    color: #fff;
}

.yj-chat-handoff {
    padding: 6px 12px;
    background: var(--ivory, #fbf6ec);
    border-top: 1px solid rgba(122, 31, 43, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    gap: 8px;
}
[data-theme="dark"] .yj-chat-handoff {
    background: #231b19;
    border-top-color: rgba(255, 255, 255, 0.08);
}
.yj-chat-handoff a {
    color: var(--maroon, #7a1f2b);
    font-weight: 700;
    text-decoration: none;
}
[data-theme="dark"] .yj-chat-handoff a {
    color: #f3c46b;
}

.yj-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(122, 31, 43, 0.14);
    background: var(--paper, #fffdf8);
}
[data-theme="dark"] .yj-chat-form {
    background: #1b1514;
    border-top-color: rgba(255, 255, 255, 0.1);
}
.yj-chat-input {
    flex: 1;
    border: 1px solid rgba(122, 31, 43, 0.25);
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #231815;
    min-width: 0;
}
[data-theme="dark"] .yj-chat-input {
    background: #271f1d;
    color: #f4ece3;
    border-color: rgba(255, 255, 255, 0.2);
}
.yj-chat-send {
    background: var(--maroon, #7a1f2b);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 0 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.yj-chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .yj-chat-fab {
        right: 14px;
        bottom: 76px;
        width: 64px;
        height: 64px;
    }
    .yj-chat-fab svg {
        width: 24px;
        height: 24px;
    }
    .yj-chat-fab span {
        font-size: 12px;
    }
    .yj-chat-panel {
        right: 8px;
        left: 8px;
        width: auto;
        bottom: 72px;
        height: min(76vh, 560px);
    }
}
