/* ============================================================
   Serficon IA — Estilos adicionales v1.1
   Añadir al final de app.css
   ============================================================ */

/* ── Selector de prompt ─────────────────────────────────────── */
#prompt-select {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition);
    max-width: 180px;
}

#prompt-select:hover { border-color: var(--border-hover); }
#prompt-select:focus { border-color: var(--accent); }
#prompt-select option { background: var(--bg-secondary); color: var(--text-primary); }

#btn-edit-prompts {
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-muted);
    border-radius: var(--radius-xs);
    transition: all var(--transition);
}
#btn-edit-prompts:hover { background: var(--bg-hover); color: var(--text-secondary); }

/* ── Modal de prompts ───────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    padding: 6px 10px;
    color: var(--text-muted);
    font-size: 18px;
    border-radius: var(--radius-xs);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Prompt items en el editor */
.prompt-item {
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: border-color var(--transition);
}

.prompt-item.default { border-color: var(--accent); }

.prompt-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.prompt-item-header strong {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.prompt-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 10px;
}

.prompt-item-actions {
    display: flex;
    gap: 4px;
}

.prompt-item-actions button {
    padding: 4px 8px;
    font-size: 13px;
    border-radius: 4px;
    transition: background var(--transition);
}
.prompt-item-actions button:hover { background: var(--bg-hover); }

.prompt-item-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Formulario de prompt */
.prompt-form {
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.prompt-form h3 {
    font-size: 15px;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.prompt-form .form-group { margin-bottom: 14px; }

.prompt-form textarea {
    width: 100%;
    min-height: 160px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}
.prompt-form textarea:focus { border-color: var(--accent); outline: none; }

.prompt-form input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}
.prompt-form input[type="text"]:focus { border-color: var(--accent); outline: none; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.prompt-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-xs);
    font-weight: 500;
}

.btn-accent {
    background: var(--accent);
    color: #0d1b2a;
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-ghost {
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); }

.btn-new-prompt {
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    transition: all var(--transition);
    margin-top: 8px;
}
.btn-new-prompt:hover { border-color: var(--accent); color: var(--accent); }

/* ── Thinking / Razonamiento ────────────────────────────────── */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255,167,38,0.08);
    border: 1px solid rgba(255,167,38,0.2);
    border-radius: var(--radius-sm);
    color: var(--warning);
    font-size: 13px;
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.thinking-preview {
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    max-height: 120px;
    overflow: hidden;
    white-space: pre-wrap;
}

.thinking-block {
    margin-bottom: 16px;
    border: 1px solid rgba(255,167,38,0.15);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.thinking-block summary {
    padding: 10px 14px;
    background: rgba(255,167,38,0.06);
    color: var(--warning);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.thinking-block summary:hover { background: rgba(255,167,38,0.1); }

.thinking-content {
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    background: var(--bg-input);
    margin: 0;
    border: none;
}

/* Badge de razonamiento en mensajes */
.message-model.reasoning {
    background: rgba(255,167,38,0.1);
    color: var(--warning);
    border: 1px solid rgba(255,167,38,0.2);
}

/* ── Responsive fixes ───────────────────────────────────────── */
@media (max-width: 768px) {
    #prompt-select { max-width: 120px; }
    .modal-card { max-height: 90vh; margin: 12px; }
    .header-selectors { flex-wrap: wrap; gap: 8px; }
}

/* ── Botón reintentar ───────────────────────────────────────── */
.btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    margin-top: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}
.message.user:hover .btn-retry { opacity: 1; }
.btn-retry:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* ── Thinking timer y estados ───────────────────────────────── */
.thinking-timer {
    font-family: var(--font-mono);
    font-weight: 600;
    margin-left: 4px;
}
.thinking-done {
    padding: 10px 14px;
    background: rgba(102,187,106,0.08);
    border: 1px solid rgba(102,187,106,0.2);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-size: 13px;
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════
   MODO VERIFICAR
   ══════════════════════════════════════════════════════════════ */

/* Botón toggle en la input area */
#btn-verify-mode {
    position: relative;
    color: var(--text-muted);
    transition: all 0.2s;
}
#btn-verify-mode:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}
#btn-verify-mode.active {
    color: #66bb6a;
    background: rgba(102,187,106,0.12);
}
#btn-verify-mode.active::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: #66bb6a;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(102,187,106,0.8);
    animation: verify-pulse 2s infinite;
}

@keyframes verify-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Badge "Verificado" en las respuestas */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: rgba(102,187,106,0.12);
    color: #66bb6a;
    border: 1px solid rgba(102,187,106,0.3);
    border-radius: 10px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .verified-badge {
        font-size: 10px;
        padding: 1px 6px;
    }
}
