/* ══════════════════════════════════════════════════════════════════
   css/consultas-panel.css
   Estilos para el módulo CONSULTAS MASIVAS:
   - Botones de consulta en el sidebar
   - Modal de envío de consulta
   - Panel flotante minimizable de respuestas
   ══════════════════════════════════════════════════════════════════ */

/* ─── Botones en sidebar ──────────────────────────────────────── */
.cq-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: #1565c0;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
    transition: background 0.18s, box-shadow 0.18s;
    text-align: left;
}
.cq-btn:hover { background: #1976d2; box-shadow: 0 2px 8px rgba(21,101,192,.35); }
.cq-btn.cq-btn--general  { background: #6a1e99; }
.cq-btn.cq-btn--general:hover  { background: #7b21b5; }
.cq-btn.cq-btn--proveedor { background: #e65100; }
.cq-btn.cq-btn--proveedor:hover { background: #f4511e; }
.cq-btn.cq-btn--envio     { background: #00695c; }
.cq-btn.cq-btn--envio:hover     { background: #00796b; }
.cq-btn:disabled { opacity: .5; cursor: not-allowed; }

.cq-section-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    color: #546e7a;
    text-transform: uppercase;
    margin: 10px 0 5px;
    padding: 0 2px;
}

/* ─── Geo-selection overlay ───────────────────────────────────── */
#cq-geo-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(21,101,192,.14);
    z-index: 2100;
    pointer-events: none;
}
#cq-geo-overlay.active { display: block; }
#cq-geo-toast {
    display: none;
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(21,101,192,.93);
    color: #fff;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    z-index: 2200;
    box-shadow: 0 4px 18px rgba(0,0,0,.25);
    pointer-events: none;
    white-space: nowrap;
}
#cq-geo-toast.active { display: block; }

/* ─── Modal de envío ──────────────────────────────────────────── */
#cq-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
#cq-modal-overlay.active {
    display: flex;
}
#cq-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.28);
    width: min(480px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
#cq-modal-header {
    background: linear-gradient(135deg, #1565c0 0%, #0d3b8c 100%);
    color: #fff;
    padding: 18px 20px 14px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
#cq-modal-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    flex: 1;
}
#cq-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color .15s;
}
#cq-modal-close:hover { color: #fff; }
#cq-modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#cq-modal-body label {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 4px;
    display: block;
}
#cq-modal-body select,
#cq-modal-body textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    resize: vertical;
    color: #1f2937;
    transition: border-color .15s;
}
#cq-modal-body select:focus,
#cq-modal-body textarea:focus { outline: none; border-color: #1565c0; }
#cq-modal-preview {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 8px 12px;
}
#cq-modal-preview strong { color: #1565c0; }
#cq-modal-footer {
    padding: 12px 20px 18px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.cq-modal-cancel {
    padding: 9px 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.cq-modal-cancel:hover { background: #f9fafb; }
.cq-modal-submit {
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    background: #1565c0;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.cq-modal-submit:hover:not(:disabled) { background: #1976d2; }
.cq-modal-submit:disabled { opacity: .55; cursor: not-allowed; }
#cq-modal-error {
    color: #c0392b;
    font-size: 12px;
    text-align: center;
    min-height: 16px;
}
.cq-char-count {
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
    margin-top: 2px;
}

/* ─── Panel flotante de consultas ─────────────────────────────── */
#cq-panel {
    position: fixed;
    bottom: 80px;
    right: 18px;
    width: min(380px, 96vw);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .2s;
}
#cq-panel.cq-minimized {
    transform: translateY(calc(100% + 80px));
    opacity: 0;
    pointer-events: none;
}
#cq-panel-toggle-btn {
    position: fixed;
    bottom: 80px;
    right: 18px;
    z-index: 2600;
    background: #1565c0;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(21,101,192,.38);
    display: none;
    align-items: center;
    gap: 6px;
    transition: background .15s, box-shadow .15s;
}
#cq-panel-toggle-btn.visible { display: flex; }
#cq-panel-toggle-btn:hover { background: #1976d2; }
#cq-panel-badge {
    background: #e53935;
    color: #fff;
    border-radius: 50px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 800;
    min-width: 20px;
    text-align: center;
}
#cq-panel-header {
    background: linear-gradient(135deg, #1565c0 0%, #0d3b8c 100%);
    color: #fff;
    padding: 13px 16px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
#cq-panel-title {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
}
.cq-panel-hdr-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    font-size: 17px;
    cursor: pointer;
    padding: 0 3px;
    line-height: 1;
    transition: color .15s;
}
.cq-panel-hdr-btn:hover { color: #fff; }
#cq-panel-tabs {
    display: flex;
    border-bottom: 1.5px solid #e5e7eb;
}
.cq-tab {
    flex: 1;
    padding: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    transition: color .15s, border-bottom .15s;
    border-bottom: 2.5px solid transparent;
}
.cq-tab.active { color: #1565c0; border-bottom-color: #1565c0; }
#cq-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
}
#cq-panel-body::-webkit-scrollbar { width: 5px; }
#cq-panel-body::-webkit-scrollbar-track { background: #f1f1f1; }
#cq-panel-body::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }

/* ─── Ítem de consulta en el panel ───────────────────────────── */
.cq-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .15s;
}
.cq-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.cq-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    background: #f8fafc;
}
.cq-item-tipo {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 50px;
    background: #1565c0;
    color: #fff;
}
.cq-item-tipo.tipo-general  { background: #6a1e99; }
.cq-item-tipo.tipo-global_proveedor { background: #e65100; }
.cq-item-tipo.tipo-envio    { background: #00695c; }
.cq-item-date {
    font-size: 11px;
    color: #9ca3af;
    margin-left: auto;
}
.cq-item-texto {
    padding: 7px 11px 5px;
    font-size: 12px;
    color: #374151;
    font-style: italic;
}
.cq-item-stats {
    padding: 5px 11px 9px;
    font-size: 11px;
    color: #6b7280;
    display: flex;
    gap: 10px;
}
.cq-item-stats span { display: flex; align-items: center; gap: 3px; }

/* ─── Detalle del hilo de una consulta ───────────────────────── */
#cq-thread-view {
    display: none;
}
#cq-thread-view.active { display: block; }
.cq-back-btn {
    background: none;
    border: none;
    color: #1565c0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}
.cq-thread-consulta {
    background: #eff6ff;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: #1e3a5f;
}
.cq-thread-consulta strong { display: block; font-size: 11px; color: #3b82f6; margin-bottom: 4px; }
.cq-resp-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid #1565c0;
}
.cq-resp-biz {
    font-size: 11px;
    font-weight: 700;
    color: #1565c0;
    white-space: nowrap;
}
.cq-resp-text {
    font-size: 12px;
    color: #374151;
    flex: 1;
}
.cq-resp-date {
    font-size: 10px;
    color: #9ca3af;
    align-self: flex-end;
}
.cq-reply-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cq-reply-form textarea {
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    resize: none;
    height: 60px;
    transition: border-color .15s;
}
.cq-reply-form textarea:focus { outline: none; border-color: #1565c0; }
.cq-reply-send {
    align-self: flex-end;
    padding: 7px 14px;
    border: none;
    border-radius: 7px;
    background: #1565c0;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.cq-reply-send:hover { background: #1976d2; }
.cq-empty {
    text-align: center;
    padding: 24px 10px;
    color: #9ca3af;
    font-size: 13px;
}
