/**
 * Perfect 10 — High-Contrast Luxury Concierge Chatbot & Lead Capture Stylesheet.
 *
 * Uses crisp #ffffff white text on deep obsidian/gold panels with generous,
 * easy-to-read typography and rich source cards.
 */

.p10-chat {
    --p10-chat-bg: #12100d;
    --p10-chat-header-bg: linear-gradient(135deg, #1d1810 0%, #14110c 100%);
    --p10-chat-header-text: #ffffff;
    --p10-chat-bubble-bg: #1a1712;
    --p10-chat-bubble-text: #ffffff;
    --p10-chat-user-bg: linear-gradient(135deg, rgb(212 175 55 / 0.28), rgb(168 132 42 / 0.18));
    --p10-chat-user-text: #ffffff;
    --p10-chat-input-bg: #0c0b09;
    --p10-chat-input-text: #ffffff;
    --p10-chat-input-border: rgb(212 175 55 / 0.38);
    --p10-chat-radius: 8px;
    --p10-chat-font: clamp(0.98rem, 1vw, 1.04rem);
    --p10-chat-shadow: 0 28px 90px rgb(0 0 0 / 0.85);
    --p10-chat-border: rgb(212 175 55 / 0.34);
    --p10-chat-muted: #efefef;
    --p10-chat-accent: #f3d98b;
    --p10-chat-focus: #f3d98b;
    z-index: 1000;
}

.p10-chat--left {
    left: clamp(1rem, 2.4vw, 1.8rem);
    right: auto;
    align-items: flex-start;
}


/* Pill Launcher -------------------------------------------------------- */

.p10-chat .p10-chat__launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    height: 56px;
    padding: 0 1.35rem 0 1.05rem;
    border-radius: 100px;
    border: 1px solid rgb(212 175 55 / 0.55);
    background: linear-gradient(135deg, #241d12 0%, #110f0b 100%);
    color: #ffffff;
    box-shadow: 0 16px 40px rgb(0 0 0 / 0.72), 0 0 0 1px rgb(212 175 55 / 0.14) inset;
    cursor: pointer;
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.p10-chat .p10-chat__launcher::before {
    display: none;
}

.p10-chat .p10-chat__launcher:hover {
    transform: translateY(-3px);
    border-color: var(--p10-gold, #d4af37);
    color: var(--p10-chat-accent);
    box-shadow: 0 22px 48px rgb(0 0 0 / 0.85);
}

.p10-chat__launcher-pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade9b;
    box-shadow: 0 0 0 0 rgb(74 222 155 / 0.6);
    animation: p10-chat-live 2.2s infinite ease-out;
}

@keyframes p10-chat-live {
    0% {
        box-shadow: 0 0 0 0 rgb(74 222 155 / 0.65);
    }
    70% {
        box-shadow: 0 0 0 8px rgb(74 222 155 / 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgb(74 222 155 / 0);
    }
}

.p10-chat__launcher-icon {
    display: grid;
    place-items: center;
    color: var(--p10-gold, #d4af37);
}

.p10-chat__launcher-icon img {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 50%;
}

.p10-chat__launcher-label {
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #ffffff;
}


/* Dialog Window -------------------------------------------------------- */

.p10-chat-dialog {
    position: fixed;
    inset: auto clamp(1rem, 2.4vw, 1.8rem) calc(56px + clamp(1rem, 2.4vw, 1.8rem) + 0.85rem) auto;
    margin: 0;
    padding: 0;
    width: var(--p10-chat-w, 430px);
    max-width: calc(100vw - 1.5rem);
    height: var(--p10-chat-h, 680px);
    max-height: calc(100dvh - 6rem);
    overflow: hidden;
    border: 1px solid var(--p10-chat-border);
    border-radius: var(--p10-chat-radius);
    background: var(--p10-chat-bg);
    color: #ffffff;
    font-family: var(--p10-body, sans-serif);
    font-size: var(--p10-chat-font);
    box-shadow: var(--p10-chat-shadow);
    z-index: 1001;
}

.p10-chat--left .p10-chat-dialog {
    left: clamp(1rem, 2.4vw, 1.8rem);
    right: auto;
}

.p10-chat-dialog::backdrop {
    background: rgb(0 0 0 / 0.48);
    backdrop-filter: blur(3px);
}

.p10-chat-dialog[open] {
    display: flex;
    flex-direction: column;
}

.p10-chat-dialog.is-minimized {
    height: auto;
    max-height: none;
}

.p10-chat-dialog.is-minimized .p10-chat__panel {
    display: none;
}

.p10-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: var(--p10-chat-header-bg);
    color: #ffffff;
    border-bottom: 1px solid var(--p10-chat-border);
    flex: 0 0 auto;
}

.p10-chat__identity {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.p10-chat__mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgb(212 175 55 / 0.16);
    border: 1px solid rgb(212 175 55 / 0.42);
    color: var(--p10-gold, #d4af37);
    flex-shrink: 0;
}

.p10-chat__title {
    margin: 0;
    font-family: var(--p10-display, serif);
    font-size: 1.18rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
}

.p10-chat__subtitle {
    margin: 0.18rem 0 0;
    font-size: 0.84rem;
    color: #efefef;
    line-height: 1.35;
    display: none;
}

.p10-chat__header-actions {
    display: flex;
    gap: 0.4rem;
    flex: 0 0 auto;
}

.p10-chat .p10-chat__icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--p10-chat-border);
    border-radius: 50%;
    background: rgb(11 10 9 / 0.55);
    color: #ffffff;
    cursor: pointer;
}

.p10-chat .p10-chat__icon-btn:hover {
    border-color: var(--p10-chat-accent);
    color: var(--p10-chat-accent);
}


/* Panel & Status Bar --------------------------------------------------- */

.p10-chat__panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem 1rem 1rem;
    overflow: hidden;
}

.p10-chat-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
}

.p10-chat-provider {
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #b9f0d2;
}

.p10-chat-bar__phone {
    display: none;
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--p10-chat-accent);
    text-decoration: none;
}


/* Conversation Log & Messages ------------------------------------------ */

.p10-chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.25rem 0.1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--p10-chat-border) transparent;
}

.p10-chat-message {
    max-width: 94%;
    padding: 0.8rem 0.95rem;
    border-radius: 8px;
    background: var(--p10-chat-bubble-bg);
    color: #ffffff;
    border: 1px solid rgb(255 255 255 / 0.12);
    font-size: 0.96rem;
    line-height: 1.62;
    overflow-wrap: anywhere;
}

.p10-chat-message__author {
    display: block;
    margin-bottom: 0.3rem;
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--p10-chat-accent);
}

.p10-chat-message__text {
    margin: 0 !important;
    color: #ffffff;
    font-size: .80rem;
}

.p10-chat-message--user {
    align-self: flex-end;
    background: var(--p10-chat-user-bg);
    color: #ffffff;
    border-color: rgb(212 175 55 / 0.45);
}


/* Rich Scanned Website Source Cards inside Chat ------------------------ */

.p10-chat-sources {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.p10-chat-source {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgb(212 175 55 / 0.32);
    background: rgb(11 10 9 / 0.76);
    color: #ffffff !important;
    text-decoration: none !important;
    transition: border-color 180ms ease, background 180ms ease;
}

.p10-chat-source:hover {
    border-color: var(--p10-gold, #d4af37);
    background: rgb(212 175 55 / 0.12);
}

.p10-chat-source__img {
    width: 46px;
    height: 58px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgb(212 175 55 / 0.3);
}

.p10-chat-source__body {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.p10-chat-source__badge {
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--p10-chat-accent);
}

.p10-chat-source__title {
    margin: 0 !important;
    font-family: var(--p10-display, serif) !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    color: #ffffff !important;
}

.p10-chat-source__desc {
    font-size: 0.84rem;
    line-height: 1.45;
    color: #eaeaea;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* Lead CTA & Action Chips inside Bubbles ------------------------------- */

.p10-chat-lead-cta {
    margin-top: 0.8rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgb(255 255 255 / 0.12);
}

.p10-chat-lead-cta__text {
    margin: 0 0 0.5rem !important;
    font-size: 0.88rem;
    color: #f4f4f4;
}

.p10-chat-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.p10-chat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem !important;
    margin: 0 !important;
    border-radius: 100px !important;
    border: 1px solid rgb(212 175 55 / 0.45) !important;
    background: rgb(11 10 9 / 0.8) !important;
    color: #ffffff !important;
    font-family: var(--p10-ui, sans-serif) !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.08em;
    text-decoration: none !important;
    cursor: pointer;
}

.p10-chat-chip:hover {
    border-color: var(--p10-gold, #d4af37) !important;
    color: var(--p10-chat-accent) !important;
}

.p10-chat-chip--gold {
    background: linear-gradient(135deg, #f3e0a2, #d4af37 50%, #a8842a) !important;
    border-color: transparent !important;
    color: #0b0a09 !important;
    font-weight: 700 !important;
}

.p10-chat-chip--gold:hover {
    color: #0b0a09 !important;
    filter: brightness(1.06);
}


/* Typing indicator ----------------------------------------------------- */

.p10-chat__typing {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--p10-chat-border);
    border-radius: 8px;
    background: var(--p10-chat-bubble-bg);
}

.p10-chat__typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--p10-chat-accent);
    animation: p10-chat-dot 1.1s infinite ease-in-out;
}

.p10-chat__typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.p10-chat__typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes p10-chat-dot {
    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}


/* Quick Suggestions ---------------------------------------------------- */

.p10-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 0 0 auto;
}

.p10-chat-suggestions:empty {
    display: none;
}

.p10-chat .p10-chat__suggestion {
    padding: 0.46rem 0.78rem;
    border: 1px solid rgb(212 175 55 / 0.34);
    border-radius: 100px;
    background: rgb(20 18 14 / 0.92);
    color: #ffffff;
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.p10-chat .p10-chat__suggestion:hover {
    border-color: var(--p10-gold, #d4af37);
    color: var(--p10-chat-accent);
}


/* Status & Input Form -------------------------------------------------- */

.p10-chat__status {
    margin: 0;
    min-height: 1.1em;
    font-size: 0.82rem;
    color: #efefef;
}

.p10-chat__status:empty {
    display: none;
}

.p10-chat__status.is-error {
    color: #ff9c87;
}

.p10-chat__form {
    margin: 0;
    flex: 0 0 auto;
}

.p10-chat-input {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.p10-chat-input input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.72rem 0.9rem;
    border: 1px solid var(--p10-chat-input-border);
    border-radius: 6px;
    background: var(--p10-chat-input-bg);
    color: #ffffff;
    font: inherit;
    font-size: 0.76rem!important;
}

.p10-chat-input input::placeholder {
    color: rgb(255 255 255 / 0.65);
}

.p10-chat-input input:focus {
    outline: none;
    border-color: var(--p10-gold, #d4af37);
}

.p10-chat .p10-chat__send {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 1.05rem;
    border: 0;
    border-radius: 6px;
    background: linear-gradient(135deg, #f3e0a2, #d4af37 50%, #a8842a);
    color: #0b0a09;
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
}


/* Footer Tool Buttons -------------------------------------------------- */

.p10-chat-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 0 0 auto;
}

.p10-chat-tools button {
    padding: 0.38rem 0.68rem;
    border: 1px solid rgb(255 255 255 / 0.2);
    border-radius: 5px;
    background: rgb(11 10 9 / 0.75);
    color: #ffffff;
    font-family: var(--p10-ui, sans-serif);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
}

.p10-chat-tools button:hover {
    border-color: var(--p10-gold, #d4af37);
    color: var(--p10-chat-accent);
}

.p10-chat-tools button.p10-chat-tools__primary {
    border-color: rgb(212 175 55 / 0.55);
    color: var(--p10-chat-accent);
}

@media (max-width: 640px) {
    .p10-chat-dialog {
        inset: 0;
        width: 100vw;
        max-width: none;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
    }
}