/* DDC Land website chat assistant (assets/js/ddc-chat.js). */

.ddc-chat-launcher {
    border: 0;
    cursor: pointer;
    font-family: var(--font-heading);
    background: var(--primary-color);
    box-shadow: 0 15px 30px rgba(0, 59, 3, 0.3);
}
.ddc-chat-launcher:hover {
    background: var(--primary-light);
    box-shadow: 0 20px 40px rgba(0, 59, 3, 0.35);
}
.ddc-chat-launcher .ddc-chat-launcher__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #7CFC72;
    box-shadow: 0 0 0 3px rgba(124, 252, 114, 0.3);
}
html.ddc-chat-open .ddc-chat-launcher { opacity: 0 !important; pointer-events: none; }

.ddc-chat {
    --chat-green: var(--primary-color, #003B03);
    --chat-green-2: var(--primary-light, #24a21b);
    --chat-bg: #ffffff;
    --chat-soft: #f3f5f4;
    --chat-line: #e3e8e5;
    --chat-text: #1d1d1f;
    --chat-muted: #6e6e73;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10000;
    width: 390px;
    height: min(640px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    border-radius: 22px;
    box-shadow: 0 30px 70px -10px rgba(0, 38, 2, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    font-family: var(--font-body, 'Lato', sans-serif);
    color: var(--chat-text);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.ddc-chat.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .22s ease, transform .22s ease;
}

/* Header: curved green band, as on the Camella reference. */
.ddc-chat__header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 14px 26px 18px;
    background: linear-gradient(135deg, var(--chat-green) 0%, #0b5a0e 100%);
    color: #fff;
    border-radius: 0 0 50% 50% / 0 0 18px 18px;
    flex-shrink: 0;
}
.ddc-chat__avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.ddc-chat__avatar img { width: 38px; height: auto; }
.ddc-chat__title { flex: 1; min-width: 0; line-height: 1.2; }
.ddc-chat__title strong { display: block; font-family: var(--font-heading, 'Montserrat', sans-serif); font-size: 1.1rem; }
.ddc-chat__title span { font-size: 0.82rem; opacity: 0.9; }
.ddc-chat__title span i { font-size: 0.5rem; color: #7CFC72; vertical-align: middle; margin-right: 3px; }
.ddc-chat__icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background .2s;
}
.ddc-chat__icon:hover { background: rgba(255, 255, 255, 0.25); }

.ddc-chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 8px;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}
.ddc-chat__messages { margin-top: auto; }

.ddc-msg { display: flex; flex-direction: column; margin-bottom: 8px; }
.ddc-msg__name { font-size: 0.78rem; color: var(--chat-muted); margin: 6px 0 4px 4px; }
.ddc-msg__bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.93rem;
    line-height: 1.45;
    word-wrap: break-word;
}
.ddc-msg--bot .ddc-msg__bubble { background: var(--chat-soft); border-top-left-radius: 6px; align-self: flex-start; }
.ddc-msg--user .ddc-msg__bubble { background: var(--chat-green); color: #fff; border-top-right-radius: 6px; align-self: flex-end; }
.ddc-msg__bubble--card { max-width: 95%; padding: 0; background: #fff !important; border: 1px solid var(--chat-line); overflow: hidden; }

.ddc-typing .ddc-msg__bubble { display: inline-flex; gap: 4px; padding: 13px 16px; }
.ddc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa59d; animation: ddcDot 1.2s infinite ease-in-out; }
.ddc-typing span:nth-child(2) { animation-delay: .15s; }
.ddc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ddcDot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

/* Cards (project sheet, review summary, documents) */
.ddc-card { padding: 14px 16px; font-size: 0.88rem; }
.ddc-card__title { font-family: var(--font-heading, 'Montserrat', sans-serif); font-weight: 700; color: var(--chat-green); font-size: 0.98rem; }
.ddc-card__loc { color: var(--chat-muted); font-size: 0.8rem; margin-top: 2px; }
.ddc-card__label { margin: 12px 0 6px; font-weight: 700; font-size: 0.75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-color, #b37e1f); }
.ddc-card ul { margin: 0; padding-left: 18px; }
.ddc-card li { margin: 2px 0; }
.ddc-card__docs { list-style: none; padding: 0 !important; }
.ddc-card__docs a { color: var(--chat-green); font-weight: 600; text-decoration: none; }
.ddc-card__docs a:hover { text-decoration: underline; }
.ddc-card table { width: 100%; border-collapse: collapse; }
.ddc-card__models td { padding: 6px 0; border-bottom: 1px dashed var(--chat-line); }
.ddc-card__models td:last-child { text-align: right; font-weight: 700; color: var(--chat-green); white-space: nowrap; padding-left: 10px; }
.ddc-card__review th { text-align: left; font-weight: 600; color: var(--chat-muted); padding: 6px 10px 6px 0; vertical-align: top; width: 42%; font-size: 0.8rem; }
.ddc-card__review td { padding: 6px 0; font-weight: 600; }
.ddc-card__review tr + tr th, .ddc-card__review tr + tr td { border-top: 1px solid var(--chat-line); }
.ddc-card__review { margin-top: 8px; }
.ddc-card__link {
    display: inline-block;
    margin-top: 12px;
    font-weight: 700;
    color: var(--chat-green);
    text-decoration: none;
}
.ddc-card__note { margin-top: 10px; font-size: 0.74rem; color: var(--chat-muted); font-style: italic; }

/* Quick replies: right-aligned outline pills */
.ddc-chat__controls { padding: 4px 0 6px; }
.ddc-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 6px 0; }
.ddc-chip {
    border: 1.5px solid #c9d3cc;
    background: #fff;
    color: var(--chat-text);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all .18s ease;
}
.ddc-chip:hover { border-color: var(--chat-green); color: var(--chat-green); background: rgba(0, 59, 3, 0.04); }
.ddc-chip--primary { border-color: var(--chat-green); color: var(--chat-green); font-weight: 700; }
.ddc-chip--primary:hover { background: var(--chat-green); color: #fff; }
.ddc-chip--subtle { border-style: dashed; color: var(--chat-muted); font-size: 0.82rem; padding: 6px 13px; }

.ddc-inline { display: flex; gap: 8px; justify-content: flex-end; margin: 6px 0; }
.ddc-inline__input {
    flex: 1;
    max-width: 230px;
    border: 1.5px solid #c9d3cc;
    border-radius: 12px;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.9rem;
    background: #fff;
    color: var(--chat-text);
    min-width: 0;
}
.ddc-inline__input:focus { outline: none; border-color: var(--chat-green); }

/* Composer */
.ddc-chat__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--chat-line);
    flex-shrink: 0;
}
.ddc-chat__composer textarea {
    flex: 1;
    resize: none;
    border: 1.5px solid var(--chat-line);
    border-radius: 20px;
    padding: 9px 14px;
    font: inherit;
    font-size: 0.93rem;
    line-height: 1.35;
    max-height: 110px;
    background: var(--chat-soft);
    color: var(--chat-text);
}
.ddc-chat__composer textarea:focus { outline: none; border-color: var(--chat-green); background: #fff; }
.ddc-chat__composer textarea:disabled { opacity: .6; }
.ddc-chat__composer button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: var(--chat-green);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}
.ddc-chat__composer button:disabled { background: #b8c4bb; cursor: default; }
.ddc-chat__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.ddc-chat__foot { text-align: center; font-size: 0.74rem; color: var(--chat-muted); padding: 0 12px 10px; flex-shrink: 0; }
.ddc-chat__foot a { color: var(--chat-green); font-weight: 600; }

/* Phones: full screen, like the Camella mobile chat. */
@media (max-width: 600px) {
    .ddc-chat {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
    }
    .ddc-chat__body { padding: 12px 16px 6px; }
    .ddc-chat__composer textarea { font-size: 16px; } /* stops iOS zoom-on-focus */
    .ddc-inline__input { font-size: 16px; }
    html.ddc-chat-open, html.ddc-chat-open body { overflow: hidden; }
}
