/* ================================================================
   ASK HABCO – LIGHT THEME (standalone chat)
   Extracted & adapted from Opynia V2 styles
   White / light background, dark text, Habco red + soft blue accents
   ================================================================ */

:root {
    --ah-bg: #f4f6f9;
    --ah-panel: #ffffff;
    --ah-elevated: #f8fafc;
    --ah-blue: #0a7bc2;
    --ah-blue-dim: rgba(10, 123, 194, 0.12);
    --ah-blue-glow: rgba(10, 123, 194, 0.18);
    --ah-red: #d60000;
    --ah-red-dim: #b00000;
    --ah-red-glow: rgba(214, 0, 0, 0.25);
    --ah-text: #1a1f26;
    --ah-text-sec: #4a5568;
    --ah-text-muted: #718096;
    --ah-border: rgba(0, 0, 0, 0.08);
    --ah-border-strong: rgba(0, 0, 0, 0.12);
}

/* ---------- Page shell ---------- */
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body.askhabco-page,
body.opynia-page {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: var(--ah-bg) !important;
    background-image: none !important;
    color: var(--ah-text);
    font-family: "Plain", Arial, sans-serif;
    font-weight: 300;
    font-size: 16px;
    line-height: 1.5;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

/* ---------- Main terminal window ---------- */
.chat-window {
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 100%;
    margin: 0 auto;
    background: var(--ah-panel) !important;
    border: 1px solid var(--ah-border-strong) !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 12px 28px rgba(0, 0, 0, 0.08) !important;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Subtle top highlight */
.chat-window::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 123, 194, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- Header ---------- */
.chat-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 12px !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    border-bottom: 1px solid var(--ah-border) !important;
}

.aiICONavi {
    flex-shrink: 0;
}

.aiICONavi img {
    width: 42px !important;
    height: 42px !important;
    border-radius: 10px;
    border: 1px solid rgba(10, 123, 194, 0.2);
    background: linear-gradient(135deg, rgba(10, 123, 194, 0.08), rgba(10, 123, 194, 0.03));
    padding: 4px;
    object-fit: contain;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-title {
    line-height: 1.3;
}

.chat-title strong {
    font-size: 17px !important;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--ah-text) !important;
}

/* Habco accent (was .opynia-red) */
.opynia-red,
.habco-accent,
.ia-accent {
    color: var(--ah-red) !important;
}

.beta-tag {
    font-size: 10px;
    color: var(--ah-text-muted);
    font-weight: 400;
    margin-left: 4px;
    letter-spacing: 0.3px;
}

.status-dot {
    display: inline-block;
    width: 7px !important;
    height: 7px !important;
    border-radius: 50%;
    background: #00c853 !important;
    box-shadow: 0 0 6px rgba(0, 200, 83, 0.45);
    margin-right: 5px;
    animation: ah-pulse 2s ease-in-out infinite;
}

@keyframes ah-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.85); }
}

.online-text {
    font-size: 11px !important;
    color: var(--ah-blue) !important;
    letter-spacing: 0.4px;
}

.ai-disclaimer {
    font-size: 10px !important;
    color: var(--ah-text-sec) !important;
    margin-top: 6px !important;
    line-height: 1.45 !important;
    max-width: 100% !important;
}

/* ---------- Messages area ---------- */
.chat-body {
    flex: 1;
    height: auto !important;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px 12px !important;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    z-index: 5;
    background: #fafbfc !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 123, 194, 0.25) transparent;
}

.chat-body::-webkit-scrollbar {
    width: 4px;
}
.chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(10, 123, 194, 0.25);
    border-radius: 4px;
}

/* ---------- AI messages ---------- */
.ai-message {
    max-width: 88% !important;
    align-self: flex-start;
    background: #ffffff !important;
    border: 1px solid rgba(10, 123, 194, 0.15) !important;
    border-radius: 10px !important;
    border-top-left-radius: 3px !important;
    padding: 12px 14px !important;
    color: var(--ah-text) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    position: relative;
    margin-bottom: 0 !important;
    margin-right: auto;
}

.ai-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--ah-blue), transparent);
    border-radius: 2px 0 0 2px;
    opacity: 0.7;
}

.ai-message strong {
    display: block;
    margin-bottom: 6px !important;
    font-size: 11px !important;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--ah-blue) !important;
}

.ai-message p {
    margin: 0 !important;
    color: var(--ah-text) !important;
    line-height: 1.5 !important;
    font-size: 14px !important;
}

/* ---------- User messages ---------- */
.user-message {
    max-width: 82% !important;
    align-self: flex-end;
    background: linear-gradient(145deg, #fff5f5, #ffefef) !important;
    border: 1px solid rgba(214, 0, 0, 0.18) !important;
    border-radius: 10px !important;
    border-top-right-radius: 3px !important;
    padding: 12px 14px !important;
    color: var(--ah-text) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    position: relative;
    margin-bottom: 0 !important;
    margin-left: auto;
}

.user-message::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--ah-red), transparent);
    border-radius: 0 2px 2px 0;
    opacity: 0.75;
}

.user-message strong {
    display: block;
    margin-bottom: 6px !important;
    font-size: 11px !important;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--ah-red) !important;
}

.user-message p {
    margin: 0 !important;
    color: var(--ah-text) !important;
    line-height: 1.5 !important;
    font-size: 14px !important;
}

/* ---------- Markdown / tables / links inside AI messages ---------- */
.ai-message a {
    color: #0a7bc2 !important;
    text-decoration: none !important;
}
.ai-message a:hover {
    color: #065a8f !important;
    text-decoration: underline !important;
}
.ai-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 12.5px;
}
.ai-message th {
    background: rgba(10, 123, 194, 0.08);
    font-weight: 600;
    color: var(--ah-blue);
}
.ai-message th,
.ai-message td {
    border: 1px solid rgba(10, 123, 194, 0.12);
    padding: 7px 9px;
    text-align: left;
}
.ai-message code {
    background: rgba(10, 123, 194, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.ai-message hr {
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin: 12px 0;
}
.ai-message blockquote {
    border-left: 3px solid var(--ah-blue);
    padding-left: 12px;
    color: var(--ah-text-sec);
    margin: 8px 0;
}

/* ---------- Input area ---------- */
.chat-input {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 14px !important;
    background: #ffffff !important;
    border-top: 1px solid var(--ah-border) !important;
}

.chat-input input,
#chatInput {
    flex: 1;
    background: #f4f6f9 !important;
    color: var(--ah-text) !important;
    border: 1px solid var(--ah-border-strong) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 14.5px !important;
    font-family: inherit !important;
    outline: none !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    min-width: 0;
}

.chat-input input::placeholder,
#chatInput::placeholder {
    color: var(--ah-text-muted) !important;
}

.chat-input input:focus,
#chatInput:focus {
    border-color: rgba(10, 123, 194, 0.45) !important;
    box-shadow:
        0 0 0 1px rgba(10, 123, 194, 0.1),
        0 0 12px rgba(10, 123, 194, 0.1) !important;
    background: #fff !important;
}

/* ---------- Send button (Habco red) ---------- */
.send-btn,
#sendBtn {
    width: 44px !important;
    height: 44px !important;
    flex-shrink: 0;
    border-radius: 11px !important;
    border: none !important;
    background: linear-gradient(145deg, var(--ah-red), var(--ah-red-dim)) !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow:
        0 2px 8px var(--ah-red-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

/* Pure CSS paper-plane icon */
.send-btn::after,
#sendBtn::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
    pointer-events: none;
}

.send-btn:hover,
#sendBtn:hover {
    transform: scale(1.05);
    box-shadow:
        0 4px 14px var(--ah-red-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

.send-btn:active,
#sendBtn:active {
    transform: scale(0.96);
}

.send-btn:disabled,
#sendBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Hide any leftover content JS may inject into the button */
.send-btn svg,
#sendBtn svg,
.send-btn > *,
#sendBtn > * {
    display: none !important;
}

/* ---------- Footer note ---------- */
.chat-footer-note,
.chat-window > p {
    text-align: center;
    font-size: 10px;
    color: var(--ah-text-muted);
    padding: 6px 12px 10px;
    margin: 0;
    background: #fff;
    border-top: none;
    letter-spacing: 0.3px;
}

/* ---------- Mobile ---------- */
@media (max-width: 520px) {
    body.askhabco-page,
    body.opynia-page {
        align-items: stretch;
        justify-content: stretch;
    }

    .chat-window {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }

    .chat-header {
        padding: 12px 12px 10px !important;
    }

    .aiICONavi img {
        width: 38px !important;
        height: 38px !important;
    }

    .chat-body {
        padding: 12px 10px 10px !important;
    }

    .ai-message,
    .user-message {
        max-width: 92% !important;
        font-size: 13.5px;
    }

    .chat-input {
        padding: 10px 10px 12px !important;
    }

    .send-btn,
    #sendBtn {
        width: 42px !important;
        height: 42px !important;
    }
}

/* Desktop refinement when used standalone */
@media (min-width: 521px) {
    body.askhabco-page,
    body.opynia-page {
        padding: 20px;
        background: #eef1f5 !important;
    }
}


/* HABCO quick-action buttons (match site CTA style) */
.habco-quick-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
}
.habco-qa-btn,
.habco-qa-sub{
  appearance:none;
  -webkit-appearance:none;
  border:0;
  cursor:pointer;
  font-family:Arial,Helvetica,sans-serif;
  font-size:11px;
  font-weight:700;
  letter-spacing:.02em;
  height:34px;
  padding:0 14px;
  border-radius:4px;
  background:#df1b23;
  color:#fff;
  box-shadow:0 5px 12px rgba(223,27,35,.15);
  transition:transform .25s ease, box-shadow .25s ease, background .2s ease;
}
.habco-qa-btn:hover,
.habco-qa-sub:hover{
  background:#b51219;
  transform:translateY(-1px);
  box-shadow:0 8px 16px rgba(223,27,35,.2);
}
.habco-qa-sub-list{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
  margin-top:12px;
  max-width:280px;
}
.habco-qa-sub{
  width:100%;
  text-align:left;
}
@media (max-width:480px){
  .habco-qa-btn{ font-size:10px; height:32px; padding:0 10px; }
}
