@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ── Ventana principal ── */
.chat-popup {
    background: #ffffff;
    border: none;
    border-radius: 16px 16px 0 0;
    bottom: 0;
    display: none;
    height: 700px;
    position: fixed;
    right: 24px;
    width: min(96vw, 1500px);
    font-family: 'Inter', 'Open Sans', sans-serif;
    z-index: 1000;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 148, 217, 0.1);
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.chat-rh {
    position: absolute;
    z-index: 10;
}

.chat-rh:hover,
.chat-rh.resizing {
    background: rgba(0, 148, 217, 0.22);
}

.chat-rh--left {
    left: 0; top: 12px;
    width: 5px; height: calc(100% - 24px);
    cursor: ew-resize;
}

.chat-rh--top {
    top: 0; left: 12px;
    height: 5px; width: calc(100% - 24px);
    cursor: n-resize;
}

.chat-rh--topleft {
    top: 0; left: 0;
    width: 14px; height: 14px;
    cursor: nw-resize;
    border-radius: 16px 0 0 0;
}

.chat-rh--topright {
    top: 0; right: 0;
    width: 14px; height: 14px;
    cursor: ne-resize;
    border-radius: 0 16px 0 0;
}

.popup-box-on {
    display: flex !important;
}

/* ── Header ── */
.chat-popup .popup-head {
    background: linear-gradient(135deg, #0094d9 0%, #006fa8 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.popup-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.popup-head-left svg {
    flex-shrink: 0;
}

.popup-head-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    font-size: 12px;
    height: 30px;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.chat-header-button:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* ── Cuerpo del chat: sidebar (columna fija, visible por defecto) + columna de chat ── */
.chatia-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chatia-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fbfcfe;
    border-right: 1px solid #e2e7ee;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, opacity 0.15s ease, border-color 0.2s ease;
}

/* El botón de cabecera añade esta clase al contenedor .chatia-body para colapsar el
   sidebar a una tira fina con solo el icono "+" (como Claude) — nunca desaparece del
   todo, siempre queda un acceso rápido a "nueva conversación" a la izquierda. */
.chatia-body--sidebar-collapsed .chatia-sidebar {
    width: 44px;
}

.chatia-body--sidebar-collapsed .chatia-sidebar-header,
.chatia-body--sidebar-collapsed .chatia-sidebar-list,
.chatia-body--sidebar-collapsed .chatia-sidebar-new-btn-label {
    display: none;
}

.chatia-body--sidebar-collapsed .chatia-sidebar-new-btn {
    margin: 10px auto;
    padding: 0;
    width: 28px;
    height: 28px;
    justify-content: center;
}

.chatia-chat-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chatia-sidebar-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 10px;
    padding: 9px 12px;
    border: 1px solid #e2e7ee;
    border-radius: 8px;
    background: #ffffff;
    color: #0094d9;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.chatia-sidebar-new-btn:hover {
    background: #eaf5fc;
}

.chatia-sidebar-header {
    padding: 12px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #1f4f76;
    border-bottom: 1px solid #e8edf3;
    flex-shrink: 0;
}

.chatia-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.chatia-sidebar-empty {
    padding: 16px 10px;
    color: #8a94a3;
    font-size: 12px;
    text-align: center;
}

.chatia-conv-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12.5px;
    color: #2c3e50;
}

.chatia-conv-item:hover {
    background: #f4f8fc;
}

.chatia-conv-item--active {
    background: #eaf5fc;
}

.chatia-conv-item-titulo {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatia-conv-item-fecha {
    color: #8a94a3;
    font-size: 10.5px;
    flex-shrink: 0;
}

/* ── Área de mensajes ── */
.popup-messages {
    background: #f0f2f5;
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

#last_messages {
    display: flex;
    flex-direction: column;
}

/* ── Pantalla de bienvenida — nueva conversación / sin historial ── */
@keyframes chatiaFadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes chatiaWave {
    0%, 58%, 100% { transform: rotate(0deg); }
    6% { transform: rotate(18deg); }
    12% { transform: rotate(-10deg); }
    18% { transform: rotate(18deg); }
    24% { transform: rotate(-6deg); }
    30% { transform: rotate(0deg); }
}

.chatia-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: auto;
    padding: 32px 20px;
    max-width: 720px;
}

.chatia-welcome-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    animation: chatiaFadeUp 0.4s ease-out both;
}

.chatia-welcome-avatar svg {
    width: 32px;
    height: 32px;
}

.chatia-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #0967d2;
    background: #eaf5fc;
    border-radius: 999px;
    padding: 5px 12px;
    margin-bottom: 14px;
    animation: chatiaFadeUp 0.4s ease-out both;
    animation-delay: 0.08s;
}

.chatia-welcome-wave {
    display: inline-block;
    font-size: 17px;
    transform-origin: 70% 70%;
    animation: chatiaWave 3.2s ease-in-out 0.5s infinite;
}

.chatia-welcome-title {
    font-size: 26px;
    font-weight: 700;
    color: #1f2d3d;
    margin-bottom: 6px;
    animation: chatiaFadeUp 0.4s ease-out both;
    animation-delay: 0.16s;
}

.chatia-welcome-name {
    color: #0967d2;
}

.chatia-welcome-subtitle {
    font-size: 14px;
    color: #6b7686;
    margin-bottom: 24px;
    min-height: 18px;
    animation: chatiaFadeUp 0.4s ease-out both;
    animation-delay: 0.24s;
}

.chatia-welcome-subtitle-cursor {
    display: inline-block;
    margin-left: 1px;
    color: #0094d9;
    animation: chatiaBlink 0.9s step-start infinite;
}

@keyframes chatiaBlink {
    50% { opacity: 0; }
}

.chatia-welcome-suggestions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 14px;
    width: 100%;
    animation: chatiaFadeUp 0.4s ease-out both;
    animation-delay: 0.32s;
}

.chatia-suggestion-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex: 1 1 170px;
    min-width: 160px;
    padding: 18px 14px 14px;
    border: 1px solid #eef1f5;
    border-bottom: 2px solid #7fc4ec;
    border-radius: 14px;
    background: #ffffff;
    color: #1f2d3d;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.chatia-suggestion-card:hover {
    transform: translateY(-3px);
}

.chatia-suggestion-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background: #eaf5fc;
    margin-bottom: 4px;
}

.chatia-suggestion-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #1f2d3d;
}

.chatia-suggestion-desc {
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
    margin-bottom: 10px;
}

.chatia-suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: #eaf5fc;
    color: #0967d2;
    white-space: nowrap;
    margin-top: auto;
}

.chatia-suggestion-btn-arrow {
    display: inline-flex;
    align-items: center;
    transition: transform 0.15s ease;
}

.chatia-suggestion-card:hover .chatia-suggestion-btn-arrow {
    transform: translateX(2px);
}

.chatia-suggestion-card--blue {
    border-bottom-color: #0094d9;
}

.chatia-suggestion-card--blue .chatia-suggestion-icon {
    background: #e0f0fc;
    color: #0967d2;
}

.chatia-suggestion-card--blue .chatia-suggestion-btn {
    background: #eaf5fc;
    color: #0967d2;
}

.chatia-suggestion-card--blue:hover {
    border-color: #0094d9;
    box-shadow: 0 0 0 1px rgba(0, 148, 217, 0.25), 0 3px 10px rgba(0, 148, 217, 0.14);
}

.chatia-suggestion-card--green {
    border-bottom-color: #22c55e;
}

.chatia-suggestion-card--green .chatia-suggestion-icon {
    background: #e0f7e9;
    color: #15803d;
}

.chatia-suggestion-card--green .chatia-suggestion-btn {
    background: #e6f7ec;
    color: #15803d;
}

.chatia-suggestion-card--green:hover {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25), 0 3px 10px rgba(34, 197, 94, 0.14);
}

.chatia-suggestion-card--orange {
    border-bottom-color: #f97316;
}

.chatia-suggestion-card--orange .chatia-suggestion-icon {
    background: #fde8d4;
    color: #c2410c;
}

.chatia-suggestion-card--orange .chatia-suggestion-btn {
    background: #fdecdd;
    color: #c2410c;
}

.chatia-suggestion-card--orange:hover {
    border-color: #f97316;
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.25), 0 3px 10px rgba(249, 115, 22, 0.14);
}

.popup-messages::-webkit-scrollbar {
    width: 4px;
}
.popup-messages::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 4px;
}

/* ── Mensajes ── */
.chatia-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
    margin-bottom: 12px;
}

.chatia-msg:last-child {
    margin-bottom: 0;
}

.chatia-msg--user {
    flex-direction: row-reverse;
}

.chatia-msg--ai {
    flex-direction: row;
}

.chatia-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 5px;
}

.chatia-avatar--bot {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}


.chatia-bubble {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}

.chatia-bubble--user {
    max-width: 82%;
    background: #0094d9;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chatia-bubble--ai {
    max-width: 94%;
    background: #ffffff;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.chatia-msg-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.chatia-ticket-panel {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0 4px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #eaf5fc;
    border: 1px solid #cfe8f7;
}

.chatia-ticket-hint {
    font-size: 11px;
    font-weight: 600;
    color: #0094d9;
}

.chatia-open-ticket-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 12px;
    background: #0094d9;
    font-size: 11.5px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    transition: background 0.15s;
}

.chatia-open-ticket-link:hover {
    background: #0080be;
    text-decoration: none;
}

.chatia-msg--pending .chatia-bubble--user {
    opacity: 0.88;
}

.chatia-text-block {
    margin-bottom: 10px;
}

.chatia-text-block:last-child {
    margin-bottom: 0;
}

.chatia-table-wrap {
    overflow-x: auto;
    margin: 4px 0 8px;
    border: 1px solid #e2e7ee;
    border-radius: 10px;
    background: #fbfcfe;
}

.chatia-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 360px;
    font-size: 12px;
    line-height: 1.35;
}

.chatia-table th,
.chatia-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #e8edf3;
    border-right: 1px solid #e8edf3;
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
}

.chatia-table th:last-child,
.chatia-table td:last-child {
    border-right: none;
}

.chatia-table th {
    background: #eef5fb;
    color: #1f4f76;
    font-weight: 600;
    text-align: center;
}

.chatia-table td {
    text-align: left;
}

.chatia-table tbody tr:last-child td {
    border-bottom: none;
}

.chatia-table tbody tr:hover td {
    background: #f4f8fc;
}

/* ── Markdown en respuesta IA ── */
.chatia-bubble--ai h1,
.chatia-bubble--ai h2,
.chatia-bubble--ai h3,
.chatia-bubble--ai h4 {
    margin: 10px 0 6px;
    color: #163f60;
    line-height: 1.3;
}

.chatia-bubble--ai h1 { font-size: 16px; }
.chatia-bubble--ai h2 { font-size: 15px; }
.chatia-bubble--ai h3 { font-size: 14px; }
.chatia-bubble--ai h4 { font-size: 13px; }

.chatia-bubble--ai ul,
.chatia-bubble--ai ol {
    margin: 8px 0 10px;
    padding-left: 18px;
}

.chatia-bubble--ai li {
    margin: 4px 0;
}

.chatia-bubble--ai a {
    color: #0b6ea7;
    text-decoration: underline;
    word-break: break-word;
}

.chatia-bubble--ai blockquote {
    margin: 6px 0;
    padding: 5px 8px;
    border-left: 2px solid #b8d9ef;
    background: #f4f9fd;
    color: #33566f;
    font-size: 12px;
}

.chatia-bubble--ai code {
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 12px;
    background: #eef3f8;
    color: #254257;
    padding: 1px 5px;
    border-radius: 4px;
}

.chatia-bubble--ai pre {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #0f1720;
    color: #d8e8f4;
    overflow-x: auto;
}

.chatia-bubble--ai pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 12px;
}

/* ── Scroll to bottom ── */
.chatia-scroll-btn {
    position: absolute;
    bottom: 78px;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    padding: 6px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 148, 217, 0.28);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
    font-size: 12px;
    font-family: inherit;
    color: #0080be;
    white-space: nowrap;
}

.chatia-scroll-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.chatia-scroll-btn:hover {
    background: rgba(0, 148, 217, 0.12);
    border-color: rgba(0, 148, 217, 0.5);
}

.chatia-scroll-btn svg {
    flex-shrink: 0;
}

/* ── Indicador de carga ── */
.chatia-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 14px;
}

.chatia-typing span {
    width: 7px;
    height: 7px;
    background: #0094d9;
    border-radius: 50%;
    display: inline-block;
    animation: chatia-bounce 1.2s infinite ease-in-out;
}
.chatia-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatia-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatia-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* ── Footer / Input ── */
.popup-messages-footer {
    background: #ffffff;
    border-top: 1px solid #e8eaed;
    padding: 12px 16px;
    flex-shrink: 0;
}

.chatia-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chatia-input-row textarea {
    flex: 1;
    border: 1px solid #dde1e7;
    border-radius: 20px;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.4;
    min-height: 38px;
    max-height: 90px;
    padding: 8px 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    color: #2c3e50;
    background: #f7f8fa;
}

.chatia-input-row textarea:focus {
    border-color: #0094d9;
    background: #fff;
}

.chatia-send-btn {
    background: #0094d9;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
    padding: 0;
}

.chatia-send-btn:hover  { background: #0080be; }
.chatia-send-btn:active { transform: scale(0.93); }
.chatia-send-btn:disabled { background: #b0cfe8; cursor: default; }

.chatia-powered {
    font-size: 10px;
    color: #aab0bb;
    text-align: center;
    margin-top: 6px;
}

.chatia-powered a {
    color: #0094d9;
    text-decoration: none;
}

/* ── Documentos adjuntos — cards ── */
.chatia-doc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0 8px;
}

.chatia-doc-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    background: #f4f8fc;
    border: 1px solid #cde0ef;
    border-radius: 9px;
    text-decoration: none !important;
    color: #163f60 !important;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.chatia-doc-card:hover {
    background: #e3f0fb;
    border-color: #0094d9;
    box-shadow: 0 2px 8px rgba(0, 148, 217, 0.15);
    text-decoration: none !important;
    color: #0a3050 !important;
}

.chatia-doc-icon-inline {
    width: 22px;
    height: 27px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 7px;
    flex-shrink: 0;
}

.chatia-doc-icon {
    width: 26px;
    height: 32px;  /* mantiene proporción 75:92 del SVG */
    flex-shrink: 0;
    display: block;
}

.chatia-doc-name {
    flex: 1;
    word-break: break-word;
    line-height: 1.35;
}

/* ── Formulario de ticket de soporte ── */
.chatia-ticket-msg {
    align-items: flex-start;
}

.chatia-ticket-form {
    position: relative; /* ancla .chatia-ticket-overlay al bloque completo */
    max-width: 94%;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e7ee;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    font-size: 13px;
}

.chatia-ticket-form-title {
    font-weight: 600;
    color: #1f4f76;
    margin-bottom: 10px;
    font-size: 13.5px;
}

.chatia-ticket-label {
    display: block;
    color: #5c6b7a;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 10px 0 4px;
}

.chatia-ticket-label:first-of-type {
    margin-top: 0;
}

.chatia-ticket-asunto,
.chatia-ticket-descripcion {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid #e2e7ee;
    border-radius: 8px;
    background: #fbfcfe;
    color: #2c3e50;
    font-size: 13px;
    font-family: inherit;
}

.chatia-ticket-asunto:focus,
.chatia-ticket-descripcion:focus {
    outline: none;
    border-color: #0094d9;
    background: #fff;
}

.chatia-ticket-descripcion {
    resize: vertical;
    min-height: 70px;
    line-height: 1.45;
}

.chatia-ticket-dropzone {
    box-sizing: border-box;
    width: 100%;
    padding: 12px;
    border: 1.5px dashed #cfd7e0;
    border-radius: 8px;
    background: #fbfcfe;
    color: #8a94a3;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.chatia-ticket-dropzone:hover,
.chatia-ticket-dropzone--over {
    border-color: #0094d9;
    background: #eaf5fc;
}

.chatia-ticket-filelist {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chatia-ticket-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 10px;
    background: #eef1f5;
    color: #2c3e50;
    font-size: 11px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatia-ticket-file-remove {
    cursor: pointer;
    font-weight: 700;
    color: #8a94a3;
}

.chatia-ticket-file-remove:hover {
    color: #c0392b;
}

.chatia-ticket-error {
    color: #c0392b;
    font-size: 12px;
    margin-top: 8px;
}

.chatia-ticket-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.chatia-ticket-cancel,
.chatia-ticket-submit {
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chatia-ticket-cancel {
    background: #eef1f5;
    color: #5c6b7a;
}

.chatia-ticket-cancel:hover { background: #e2e7ee; }

.chatia-ticket-submit {
    background: #0094d9;
    color: #fff;
}

.chatia-ticket-submit:hover { background: #0080be; }

.chatia-ticket-cancel:disabled,
.chatia-ticket-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.chatia-ticket-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    opacity: 0;
    animation: chatiaTicketOverlayIn 0.18s ease forwards;
}

@keyframes chatiaTicketOverlayIn {
    to { opacity: 1; }
}

.chatia-ticket-overlay-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(0, 148, 217, 0.18);
    border-top-color: #0094d9;
    border-radius: 50%;
    animation: chatiaTicketSpin 0.7s linear infinite;
}

@keyframes chatiaTicketSpin {
    to { transform: rotate(360deg); }
}

.chatia-ticket-overlay-text {
    font-size: 13px;
    font-weight: 600;
    color: #1f4f76;
}

.chatia-ticket-overlay-subtext {
    font-size: 11.5px;
    color: #64748b;
}

@media (max-width: 1024px) {
    .chat-popup {
        width: min(98vw, 1100px);
        height: 82vh;
        right: 4px;
    }
}

@media (max-width: 768px) {
    .chat-popup {
        width: 100vw;
        height: 88vh;
        right: 0;
        border-radius: 12px 12px 0 0;
    }

    .chatia-bubble--ai {
        max-width: 100%;
    }

    .chatia-table {
        min-width: 380px;
    }
}
