/* ==========================================================
   WIDGET FLOTANTE DE SOPORTE — support.draikotune.com
   ========================================================== */

.dkt-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purpura-marca), var(--azul-acento));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 30px -6px rgba(123, 44, 191, 0.55);
    z-index: 999;
    transition: transform 0.2s ease;
}
.dkt-widget-btn:hover { transform: scale(1.06); }
.dkt-widget-btn .dkt-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #fff;
    display: none;
}
.dkt-widget-btn.has-unread .dkt-badge { display: block; }

.dkt-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 640px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}
.dkt-panel.is-open { display: flex; animation: dktPanelIn 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes dktPanelIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.dkt-panel-header {
    background: linear-gradient(135deg, var(--azul-oscuro), var(--purpura-marca));
    color: #fff;
    padding: 22px 20px 26px;
    position: relative;
    flex-shrink: 0;
}
.dkt-panel-header .dkt-brand { font-weight: 800; font-size: 15px; letter-spacing: 1px; }
.dkt-panel-close {
    position: absolute; top: 18px; right: 18px;
    background: none; border: none; color: #fff; opacity: 0.8;
    font-size: 18px; cursor: pointer; line-height: 1;
}
.dkt-panel-close:hover { opacity: 1; }
.dkt-panel-greeting { margin-top: 14px; font-size: 22px; font-weight: 700; line-height: 1.25; }

/* Encabezado compacto — cuando estás DENTRO de una conversación */
.dkt-panel-header.is-compact { padding: 12px 16px; background: #fff; color: var(--texto-negro); border-bottom: 1px solid rgba(0,0,0,0.06); box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.dkt-compact-header { display: flex; align-items: center; gap: 10px; }
.dkt-compact-back { background: none; border: none; color: var(--texto-gris); font-size: 14px; cursor: pointer; padding: 4px; flex-shrink: 0; }
.dkt-compact-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(123,44,191,0.85), rgba(0,168,232,0.85));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}
.dkt-compact-info { flex: 1; min-width: 0; }
.dkt-compact-name { font-weight: 600; font-size: 13.5px; }
.dkt-compact-sub { font-size: 11px; color: var(--texto-gris); }
.dkt-compact-close { position: static; color: var(--texto-gris); opacity: 0.7; }

.dkt-panel-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    background: var(--gris-fondo);
    opacity: 0;
    transform: translateY(4px);
}
.dkt-panel-body.dkt-fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.dkt-cta-box {
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 8px 20px -8px rgba(0,0,0,0.15);
    position: relative;
    z-index: 2;
    font-weight: 600;
    font-size: 14px;
    color: var(--texto-negro);
    border: none;
    width: 100%;
    text-align: left;
}
.dkt-cta-box:hover { background: #fafafa; }

.dkt-search-box {
    margin-top: 14px;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--borde-color);
}
.dkt-search-box input { border: none; outline: none; flex: 1; font-size: 16px; font-family: inherit; }
.dkt-search-box i { color: var(--texto-gris); }

.dkt-article-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 14px;
    border-radius: 10px;
    margin-top: 8px;
    text-decoration: none;
    color: var(--texto-negro);
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid var(--borde-color);
}
.dkt-article-item:hover { border-color: var(--azul-acento); }
.dkt-article-item i.dkt-chev { color: var(--texto-gris); font-size: 11px; }

.dkt-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--texto-gris);
    font-weight: 700;
    margin: 18px 0 6px 2px;
}

/* Navegación inferior */
.dkt-tabbar {
    display: flex;
    border-top: 1px solid var(--borde-color);
    background: #fff;
    flex-shrink: 0;
}
.dkt-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 4px 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--texto-gris);
    font-size: 10.5px;
    font-weight: 600;
}
.dkt-tab i { font-size: 17px; }
.dkt-tab.is-active { color: var(--purpura-marca); }

/* Formulario de ticket */
.dkt-form-group { margin-bottom: 14px; }
.dkt-form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--texto-negro); margin-bottom: 6px; }
.dkt-form-group input[type="text"],
.dkt-form-group input[type="email"],
.dkt-form-group textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--borde-color);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.dkt-form-group input:focus, .dkt-form-group textarea:focus { border-color: var(--purpura-marca); }
.dkt-form-group textarea { resize: none; min-height: 100px; }
.dkt-char-count { text-align: right; font-size: 11px; color: var(--texto-gris); margin-top: 4px; }
.dkt-char-count.is-near-limit { color: #ef4444; }

.dkt-choice-row { display: flex; gap: 10px; }
.dkt-choice-btn {
    flex: 1;
    padding: 12px;
    border: 1.5px solid var(--borde-color);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    text-align: center;
}
.dkt-choice-btn.is-selected { border-color: var(--purpura-marca); background: rgba(123,44,191,0.06); color: var(--purpura-marca); }

.dkt-otp-inputs { display: flex; gap: 8px; justify-content: center; margin: 8px 0 4px; }
.dkt-otp-inputs input {
    width: 40px; height: 48px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    border: 1.5px solid var(--borde-color);
    border-radius: 10px;
}
.dkt-otp-inputs input:focus { border-color: var(--purpura-marca); outline: none; }

.dkt-btn-primary {
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    background: var(--purpura-marca);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 6px;
}
.dkt-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.dkt-btn-primary:hover:not(:disabled) { background: #6a24a8; }

.dkt-back-link { font-size: 12.5px; color: var(--texto-gris); cursor: pointer; margin-bottom: 12px; display: inline-flex; align-items: center; gap: 5px; }
.dkt-back-link:hover { color: var(--purpura-marca); }

.dkt-error-msg { background: #fef2f2; color: #dc2626; padding: 10px 13px; border-radius: 10px; font-size: 12.5px; margin-bottom: 12px; }

.dkt-suggestion-card {
    background: #fff;
    border: 1.5px solid var(--azul-acento);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 10px 0;
    font-size: 12.5px;
}
.dkt-suggestion-card a { color: var(--azul-acento); font-weight: 700; text-decoration: none; }

/* Lista de conversaciones (pestaña Mensajes) */
.dkt-conv-list {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.dkt-conv-row {
    display: flex;
    gap: 12px;
    padding: 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dkt-conv-row:last-child { border-bottom: none; }
.dkt-conv-row:hover { background: var(--gris-fondo); }
.dkt-conv-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(123,44,191,0.85), rgba(0,168,232,0.85));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}
.dkt-conv-body { flex: 1; min-width: 0; }
.dkt-conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dkt-conv-name { font-weight: 600; font-size: 13.5px; color: var(--texto-negro); }
.dkt-conv-time { font-size: 11px; color: var(--texto-gris); flex-shrink: 0; }
.dkt-conv-preview { font-size: 12.5px; color: var(--texto-gris); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Vista de conversación (thread) */
.dkt-thread-wrap { }

.dkt-msg-row { text-align: left; margin-bottom: 8px; }
.dkt-msg-row.row-user { text-align: right; }

.dkt-thread-msg { display: inline-block; max-width: 75%; padding: 8px 12px; border-radius: 16px; font-size: 13px; margin: 0; line-height: 1.4; white-space: pre-wrap; word-break: break-word; text-align: left; }
.dkt-thread-msg.from-agent { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.dkt-thread-msg.from-user { background: var(--purpura-marca); color: #fff; }
.dkt-thread-msg .dkt-msg-author { font-size: 10.5px; font-weight: 700; opacity: 0.65; margin-bottom: 3px; display: block; }

.dkt-system-card {
    display: inline-block;
    max-width: 88%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    border-radius: 16px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--texto-negro);
    text-align: left;
}
.dkt-system-card p { margin: 0; }

.dkt-joined-notice {
    text-align: center;
    font-size: 11px;
    color: var(--texto-gris);
    margin: 10px 0 8px;
}

/* Menú de bienvenida tipo bot (DragoBot) */
.dkt-bot-intro { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.dkt-bot-avatar-lg {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(123,44,191,0.9), rgba(0,168,232,0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}
.dkt-bot-bubble {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--texto-negro);
}
.dkt-bot-menu { display: flex; flex-direction: column; gap: 8px; }
.dkt-bot-option {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    text-align: left;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--texto-negro);
    cursor: pointer;
}
.dkt-bot-option:hover { background: var(--gris-fondo); }

.dkt-typing-dots { display: flex; align-items: center; gap: 4px; padding: 4px 2px; }
.dkt-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--texto-gris);
    opacity: 0.5;
    animation: dkt-typing-bounce 1.1s infinite ease-in-out;
}
.dkt-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.dkt-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dkt-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.dkt-ticket-number-tag {
    display: inline-block;
    background: rgba(123,44,191,0.08);
    color: var(--purpura-marca);
    font-weight: 700;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.3px;
}

.dkt-msg-caption {
    text-align: left;
    font-size: 11px;
    color: var(--texto-gris);
    margin: 3px 0 10px 2px;
}

.dkt-verified-badge {
    height: 13px;
    width: 13px;
    vertical-align: middle;
    display: inline-block;
    margin-left: 1px;
}

.dkt-date-notice {
    text-align: center;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--texto-gris);
    margin: 6px 0 14px;
}

.dkt-plain-notice {
    text-align: center;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--texto-gris);
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
    padding: 12px;
    margin: 14px 0 6px;
}

.dkt-sent-label {
    text-align: right;
    font-size: 10.5px;
    color: var(--texto-gris);
    margin-top: 2px;
}

.dkt-spinner-wrap { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 380px; }
.dkt-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--borde-color);
    border-top-color: var(--purpura-marca);
    border-radius: 50%;
    animation: dkt-spin 0.7s linear infinite;
}
@keyframes dkt-spin { to { transform: rotate(360deg); } }

.dkt-reply-box { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--borde-color); background: #fff; flex-shrink: 0; align-items: flex-end; }

.dkt-image-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gris-fondo);
    border: 1px solid var(--borde-color);
    color: var(--texto-gris);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dkt-image-btn:hover { background: var(--borde-color); }

.dkt-image-uploader { position: relative; flex-shrink: 0; }
.dkt-image-dropzone-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 240px;
    background: #fff;
    border: 1px solid var(--borde-color);
    border-radius: 14px;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
    padding: 10px;
    display: none;
    z-index: 25;
}
.dkt-image-uploader.is-open .dkt-image-dropzone-panel { display: block; }
.dkt-image-dropzone {
    border: 1.5px dashed var(--borde-color);
    border-radius: 10px;
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.dkt-image-dropzone:hover, .dkt-image-dropzone.is-dragover {
    border-color: var(--purpura-marca);
    background: rgba(123, 44, 191, 0.05);
}
.dkt-image-dropzone i { font-size: 20px; color: var(--texto-gris); margin-bottom: 6px; display: block; }
.dkt-image-dropzone p { font-size: 12px; color: var(--texto-negro); margin: 0 0 5px; line-height: 1.4; }
.dkt-image-dropzone-hint { font-size: 9.5px; color: var(--texto-gris); display: block; }

.dkt-image-preview-row { display: none; gap: 8px; padding: 0 12px 8px; flex-wrap: wrap; background: #fff; border-top: 1px solid var(--borde-color); padding-top: 10px; }
.dkt-image-preview { position: relative; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; }
.dkt-image-loading { background: var(--gris-fondo); display: flex; align-items: center; justify-content: center; }
.dkt-mini-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--borde-color);
    border-top-color: var(--purpura-marca);
    border-radius: 50%;
    animation: dkt-spin 0.7s linear infinite;
}
.dkt-mini-spinner-light { border-color: rgba(255,255,255,0.3); border-top-color: #fff; margin: 0 auto; }

.dkt-toast {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    transform: translateY(-16px) scale(0.96);
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(28, 28, 30, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.1px;
    box-shadow: 0 10px 30px -8px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dkt-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.dkt-toast::before {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--purpura-marca);
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>') center / contain no-repeat;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>') center / contain no-repeat;
}
.dkt-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.dkt-image-preview button {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.dkt-msg-images { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.dkt-msg-images img { max-width: 160px; max-height: 160px; border-radius: 10px; display: block; object-fit: cover; cursor: pointer; }

.dkt-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}
.dkt-lightbox.is-open { display: flex; }
.dkt-lightbox-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.dkt-lightbox-stage img { max-width: 92%; max-height: 92%; object-fit: contain; transition: transform 0.1s ease-out; touch-action: none; user-select: none; }
.dkt-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    z-index: 1;
}
.dkt-reply-box textarea { flex: 1; border: 1px solid var(--borde-color); border-radius: 10px; padding: 9px 12px; font-size: 16px; font-family: inherit; resize: none; height: 40px; outline: none; }
#dktSendReply { background: var(--purpura-marca); color: #fff; border: none; border-radius: 10px; width: 40px; height: 40px; flex-shrink: 0; cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center; }

@media (max-width: 480px) {
    .dkt-panel { width: 100vw; height: 100vh; max-height: 100vh; bottom: 0; right: 0; border-radius: 0; }
    .dkt-widget-btn { bottom: 16px; right: 16px; }
}
