/**
 * AgentIQ Chat Widget - AIQuinta Reference UI Styles
 */

:root {
    --agentiq-primary: #1a5eb8;
    --agentiq-primary-dark: #0b3d8c;
    --agentiq-text: #1a1a1a;
    --agentiq-text-muted: #555;
    --agentiq-border: #e0e0e0;
    --agentiq-bg: #fff;
    --agentiq-sidebar-bg: #ffffff;
}

/* ==========================================
   TRIGGER BUTTON — dark navy pill with label
   ========================================== */
.agentiq-chat-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9000;
    background: var(--agentiq-primary-dark);
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(11, 61, 140, 0.35);
    transition: transform .15s, box-shadow .15s;
}
.agentiq-chat-trigger:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(11, 61, 140, 0.45);
}

/* ==========================================
   BACKDROP + MODAL
   ========================================== */
.agentiq-chat-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9100;
    align-items: center;
    justify-content: center;
    padding: 2vh 2vw;
}
.agentiq-chat-backdrop.open {
    display: flex;
}

.agentiq-chat-modal {
    background: #fff;
    width: 96vw;
    max-width: 1600px;
    height: 94vh;
    max-height: 1000px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: agentiqSlideIn .22s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--agentiq-text);
}
@keyframes agentiqSlideIn {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   CLOSE BUTTON — dark × on white background
   ========================================== */
.agentiq-chat-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #888;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color .15s, background .15s;
    line-height: 1;
}
.agentiq-chat-close:hover {
    color: #333;
    background: #f0f0f0;
}

/* ==========================================
   WELCOME VIEW
   ========================================== */
.agentiq-welcome-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 52px 60px 36px;
    overflow-y: auto;
    flex: 1;
}

/* Brand */
.agentiq-brand {
    margin-bottom: 16px;
    text-align: center;
}
.agentiq-brand-logo {
    display: block;
    height: 70px;
    width: auto;
    max-width: 260px;
    object-fit: contain;
}
.agentiq-brand-text {
    font-size: 40px;
    font-weight: 800;
    background: linear-gradient(90deg, #1a5eb8 0%, #00b4d8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
}

/* Description */
.agentiq-brand-desc {
    font-size: 15px;
    font-weight: 600;
    color: var(--agentiq-text);
    text-align: center;
    max-width: 540px;
    line-height: 1.5;
    margin: 0 0 32px;
}

/* Search / Input bar */
.agentiq-search-wrap {
    width: 100%;
    max-width: 1000px;
    border: 1.5px solid #d0d7e8 !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center;
    padding: 8px 8px 8px 20px;
    margin-bottom: 32px;
    background: #f8faff !important;
    transition: border-color .2s, box-shadow .2s, background .2s;
    box-shadow: 0 2px 8px rgba(26, 94, 184, 0.06) !important;
}
.agentiq-search-wrap:focus-within {
    border-color: var(--agentiq-primary) !important;
    background: #fff !important;
    box-shadow: 0 2px 12px rgba(26, 94, 184, 0.13) !important;
}
/* Search input textarea — all theme borders nuked via #agentiq-chat-modal textarea above */
.agentiq-search-input,
#agentiq-chat-modal textarea.agentiq-search-input,
#agentiq-chat-modal .agentiq-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    font-size: 15px;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    color: var(--agentiq-text);
    background: transparent !important;
    font-family: inherit;
    line-height: 1.5;
    padding: 10px 0 !important;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
}
.agentiq-search-input::placeholder,
#agentiq-chat-modal textarea.agentiq-search-input::placeholder {
    color: #888;
}
.agentiq-search-send {
    background: var(--agentiq-primary);
    border: none;
    cursor: pointer;
    color: #fff;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s, transform .1s;
    flex-shrink: 0;
}
.agentiq-search-send:hover {
    background: var(--agentiq-primary-dark);
    transform: scale(1.06);
}

/* Trending Section */
.agentiq-trending-section {
    width: 100%;
    max-width: 1000px;
}
.agentiq-trending-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--agentiq-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}
.agentiq-trending-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-bottom: 4px;
    cursor: grab;
    user-select: none;
}
.agentiq-trending-scroll:active {
    cursor: grabbing;
}
.agentiq-trending-scroll::-webkit-scrollbar {
    display: none;
}
.agentiq-trending-cards {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    width: max-content;
}
.agentiq-trending-card {
    flex-shrink: 0;
    width: 178px;
    padding: 14px 16px;
    border: 1px solid var(--agentiq-border);
    border-radius: 6px;
    background: #fff;
    text-align: left;
    font-size: 13px;
    color: var(--agentiq-text);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    white-space: normal;
    line-height: 1.4;
    font-family: inherit;
}
.agentiq-trending-card:hover {
    border-color: var(--agentiq-primary);
    box-shadow: 0 2px 8px rgba(26, 94, 184, 0.1);
}

/* Scroll progress indicator */
.agentiq-scroll-track {
    height: 3px;
    background: #e8e8e8;
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}
.agentiq-scroll-thumb {
    height: 100%;
    background: var(--agentiq-primary);
    border-radius: 2px;
    width: 40%;
    transition: margin-left .1s;
}

/* ==========================================
   CONVERSATION VIEW
   ========================================== */
.agentiq-conv-view {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.agentiq-sidebar {
    width: 240px;
    background: var(--agentiq-sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    flex-shrink: 0;
    gap: 12px;
}
.agentiq-sidebar-brand {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--agentiq-border);
}
.agentiq-sidebar-logo {
    display: block;
    height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}
.agentiq-sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--agentiq-text);
    line-height: 1.3;
}
.agentiq-new-chat {
    background: none;
    border: 1px solid var(--agentiq-border);
    border-radius: 6px;
    color: var(--agentiq-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background .15s, border-color .15s;
    margin-top: auto;
}
.agentiq-new-chat:hover {
    background: rgba(26, 94, 184, 0.06);
    border-color: var(--agentiq-primary);
}

/* Main Panel */
.agentiq-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

/* Messages container */
.agentiq-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px 36px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================
   USER MESSAGE — avatar + plain text
   ========================================== */
.agentiq-user-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.agentiq-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}
.agentiq-user-text {
    font-size: 15px;
    color: var(--agentiq-text);
    line-height: 1.5;
    padding-top: 6px;
}

/* ==========================================
   BOT MESSAGE — disclaimer + document style
   ========================================== */
.agentiq-bot-message {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 100%;
}
.agentiq-bot-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #eef3ff;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #444;
    line-height: 1.4;
}
.agentiq-bot-disclaimer-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--agentiq-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.agentiq-bot-content {
    font-size: 14px;
    font-weight: 400 !important;
    color: var(--agentiq-text);
    line-height: 1.7;
}
.agentiq-bot-content h1,
.agentiq-bot-content h2,
.agentiq-bot-content h3,
.agentiq-bot-content h4 {
    font-weight: 700 !important;
    color: #111;
    margin: 18px 0 6px;
}
.agentiq-bot-content h1 { font-size: 18px; }
.agentiq-bot-content h2 { font-size: 16px; }
.agentiq-bot-content h3 { font-size: 15px; }
.agentiq-bot-content h4 { font-size: 14px; }
.agentiq-bot-content p {
    margin: 8px 0;
    font-weight: 400 !important;
}
.agentiq-bot-content ul,
.agentiq-bot-content ol {
    padding-left: 22px;
    margin: 8px 0;
}
.agentiq-bot-content li {
    margin: 5px 0;
    font-weight: 400 !important;
}
.agentiq-bot-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 400 !important;
}
.agentiq-bot-content pre {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 12px 0;
}
.agentiq-bot-content pre code {
    background: none;
    padding: 0;
}
.agentiq-bot-content strong,
.agentiq-bot-content b {
    font-weight: 700 !important;
    color: #111;
}
.agentiq-bot-content a {
    color: var(--agentiq-primary);
    text-decoration: none;
}
.agentiq-bot-content a:hover {
    text-decoration: underline;
}
.agentiq-bot-content blockquote {
    border-left: 3px solid var(--agentiq-primary);
    margin: 10px 0;
    padding: 4px 14px;
    color: #555;
    font-weight: 400 !important;
}

/* ── Tables ─────────────────────────────────────────────────── */
.agentiq-bot-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 13px;
    font-weight: 400 !important;
}
.agentiq-bot-content thead tr {
    background: #f0f4ff;
}
.agentiq-bot-content th {
    text-align: left;
    padding: 9px 14px;
    font-weight: 600 !important;
    color: #333;
    border: 1px solid #dde4f0;
    white-space: nowrap;
}
.agentiq-bot-content td {
    padding: 8px 14px;
    border: 1px solid #e8ecf4;
    vertical-align: top;
    font-weight: 400 !important;
    line-height: 1.5;
}
.agentiq-bot-content tbody tr:nth-child(even) {
    background: #f8f9fc;
}
.agentiq-bot-content tbody tr:hover {
    background: #eef3ff;
}

/* Typing indicator */
.agentiq-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 6px 0;
}
.agentiq-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #bbb;
    animation: agentiqTypingBounce 1.1s infinite;
}
.agentiq-typing-dot:nth-child(2) { animation-delay: .16s; }
.agentiq-typing-dot:nth-child(3) { animation-delay: .32s; }
@keyframes agentiqTypingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-7px); }
}

/* ==========================================
   SUGGESTION QUESTIONS (after bot reply)
   ========================================== */
.agentiq-suggestions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 14px;
}
.agentiq-suggestion-btn {
    background: #f0f4ff;
    border: 1px solid #c8d8f8;
    border-radius: 6px;
    padding: 9px 14px;
    text-align: left;
    font-size: 13px;
    color: var(--agentiq-primary);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
    transition: background .15s, border-color .15s;
}
.agentiq-suggestion-btn:hover {
    background: #e0ebff;
    border-color: var(--agentiq-primary);
}
.agentiq-suggestion-btn::before {
    content: '↳ ';
    opacity: 0.6;
}

/* Response timing pill */
.agentiq-response-time {
    font-size: 11px;
    color: #aaa;
    margin-top: 10px;
    display: inline-block;
}

/* ==========================================
   CONVERSATION INPUT AREA
   ========================================== */
.agentiq-conv-input-area {
    padding: 14px 28px 18px;
    border-top: 1px solid var(--agentiq-border);
    background: #fff;
    flex-shrink: 0;
}
.agentiq-conv-input-box {
    border: 1.5px solid #d0d7e8 !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center;
    padding: 10px 10px 10px 20px;
    background: #f8faff !important;
    transition: border-color .2s, box-shadow .2s, background .2s;
    box-shadow: 0 2px 8px rgba(26, 94, 184, 0.06) !important;
}
.agentiq-conv-input-box:focus-within {
    border-color: var(--agentiq-primary) !important;
    background: #fff !important;
    box-shadow: 0 2px 12px rgba(26, 94, 184, 0.13) !important;
}
/* Nuclear override: kill any theme border on textareas inside modal */
#agentiq-chat-modal textarea {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    border-radius: 0 !important;
    background: transparent !important;
}
.agentiq-conv-input,
#agentiq-chat-modal textarea.agentiq-conv-input,
#agentiq-chat-modal .agentiq-conv-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    font-size: 14px;
    resize: none;
    min-height: 36px;
    max-height: 120px;
    color: var(--agentiq-text);
    background: transparent !important;
    font-family: inherit;
    line-height: 1.5;
    padding: 8px 0 !important;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
    margin-bottom: 5px !important;
    margin-top: 5px;
    border-style: none !important;
}
.agentiq-conv-input::placeholder,
#agentiq-chat-modal textarea.agentiq-conv-input::placeholder {
    color: #888;
}
.agentiq-conv-send {
    background: var(--agentiq-primary);
    border: none;
    cursor: pointer;
    color: #fff;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s, transform .1s;
    flex-shrink: 0;
}
.agentiq-conv-send:hover {
    background: var(--agentiq-primary-dark);
    transform: scale(1.06);
}
.agentiq-footer-disclaimer {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin: 8px 0 0;
    line-height: 1.4;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .agentiq-chat-modal {
        width: 100vw;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    .agentiq-welcome-view {
        padding: 36px 24px 28px;
    }
    .agentiq-sidebar {
        display: none;
    }
    .agentiq-chat-messages {
        padding: 16px 20px;
    }
    .agentiq-conv-input-area {
        padding: 10px 16px 14px;
    }
    .agentiq-trending-card {
        width: 155px;
    }
}
