/* ==========================================================================
   CSS DESIGN SYSTEM - REMOTE CODE REVIEWER (ORQUESTADOR SSH + CLAUDE)
   ========================================================================== */

:root {
    --bg-dark: #090d16;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.4);

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --accent: #818cf8;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;

    --sidebar-width: 320px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(11, 15, 25, 0.9);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
}

.brand-text h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.brand-text h2 span { color: var(--accent); }
.brand-text p { font-size: 0.75rem; color: var(--text-muted); }

/* CARDS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--primary); }

.status-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
}

.status-item { display: flex; justify-content: space-between; }
.status-item .label { color: var(--text-muted); }
.status-item .value { font-weight: 500; color: var(--text-main); }

.config-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* BUTTONS */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #fff; box-shadow: 0 4px 12px var(--primary-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--primary-glow); }
.btn-secondary { background: rgba(255, 255, 255, 0.08); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-glow); }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* INPUTS */
.input-group label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    gap: 8px;
}

.input-wrapper input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    width: 100%;
}

.filter-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.filter-tags li {
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-card { flex: 1; display: flex; flex-direction: column; min-height: 180px; }
.icon-btn { background: transparent; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; }
.icon-btn:hover { color: var(--danger); }
.history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.empty-msg { font-size: 0.78rem; color: var(--text-dim); text-align: center; padding: 20px 0; }

.history-item {
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover { background: rgba(99, 102, 241, 0.08); }
.history-item .time { font-size: 0.68rem; color: var(--text-dim); }
.history-item .query { font-size: 0.78rem; font-weight: 500; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* MAIN CONTENT */
.main-content { flex: 1; display: flex; flex-direction: column; height: 100vh; }
.top-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(10px);
}

.header-title h1 { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; }
.header-title p { font-size: 0.85rem; color: var(--text-muted); }

.feed-container { flex: 1; overflow-y: auto; padding: 30px; display: flex; flex-direction: column; gap: 20px; }

.welcome-banner {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 24px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.8));
    border: 1px solid var(--border-highlight);
}

.banner-icon {
    width: 50px; height: 50px; border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.15); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}

.banner-content h2 { font-family: var(--font-heading); font-size: 1.2rem; margin-bottom: 6px; }
.banner-content p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 16px; }

.prompt-presets { display: flex; flex-wrap: wrap; gap: 10px; }
.preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex; align-items: center; gap: 8px;
}

.preset-btn:hover { background: var(--primary); border-color: var(--primary); transform: translateY(-2px); }

/* CHAT FEED */
.review-entry { display: flex; flex-direction: column; gap: 14px; }
.user-question-box {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius-md) var(--radius-md) 2px var(--radius-md);
    max-width: 80%;
    font-size: 0.95rem;
}

.ai-response-box {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-md);
    width: 100%;
}

.ai-response-header { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.ai-response-header i { color: var(--accent); font-size: 1.2rem; }

.markdown-body h1, .markdown-body h2, .markdown-body h3 { font-family: var(--font-heading); color: var(--text-main); margin-top: 18px; margin-bottom: 10px; }
.markdown-body h2 { font-size: 1.15rem; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.markdown-body h3 { font-size: 1rem; color: var(--accent); }
.markdown-body p { margin-bottom: 12px; font-size: 0.92rem; color: #cbd5e1; }
.markdown-body ul, .markdown-body ol { margin-left: 20px; margin-bottom: 12px; }
.markdown-body code { font-family: var(--font-mono); background: rgba(0,0,0,0.4); padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }
.markdown-body pre { background: #050811; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; margin: 14px 0; border: 1px solid var(--border-color); }

/* LOADER */
.loader-container { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 20px; background: rgba(15, 23, 42, 0.8); border: 1px solid var(--border-highlight); border-radius: var(--radius-md); margin: 0 30px; }
.loader-container.hidden { display: none; }
.loader-spinner { width: 32px; height: 32px; border: 3px solid rgba(99, 102, 241, 0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* STREAMING — Indicador de escritura (puntos animados) y cursor parpadeante */
.typing-dots span {
    animation: typing-blink 1.2s infinite;
    opacity: 0;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.25s; }
.typing-dots span:nth-child(3) { animation-delay: 0.5s; }

@keyframes typing-blink {
    0%, 60%, 100% { opacity: 0; }
    30%            { opacity: 1; }
}

.cursor-blink {
    display: inline-block;
    color: var(--accent);
    font-weight: 300;
    animation: cursor-pulse 0.7s steps(1) infinite;
    margin-left: 1px;
    line-height: 1;
}
@keyframes cursor-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.0); }
    50%       { box-shadow: 0 0 0 5px rgba(245,158,11,0.15); }
}


/* INPUT CONTAINER */
.input-container { padding: 20px 30px; background: rgba(11, 15, 25, 0.8); border-top: 1px solid var(--border-color); }
.chat-input-box { display: flex; gap: 12px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px 14px; }
.chat-input-box textarea { flex: 1; background: transparent; border: none; outline: none; color: var(--text-main); font-family: var(--font-sans); font-size: 0.92rem; resize: none; }
.send-btn { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #fff; border: none; border-radius: var(--radius-sm); padding: 0 20px; font-weight: 600; font-size: 0.88rem; cursor: pointer; display: flex; align-items: center; gap: 8px; }

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    background: #0f172a;
    border: 1px solid var(--border-highlight);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.modal-header h2 { font-family: var(--font-heading); font-size: 1.15rem; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.modal-header h2 i { color: var(--accent); }
.close-modal-btn { background: transparent; border: none; color: var(--text-dim); font-size: 1.5rem; cursor: pointer; }

.modal-body { padding: 16px 0; display: flex; flex-direction: column; gap: 20px; }
.form-section h3 { font-size: 0.9rem; color: var(--accent); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group.full-width { grid-column: span 2; }
.form-group label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.form-group input, .form-group select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.85rem;
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); outline: none; }

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

.modal-alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}
.modal-alert.success { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.modal-alert.error { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* ==========================================================================
   QUICK PROMPT BUTTONS — PREMIUM DESIGN
   ========================================================================== */

.quick-prompts-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 4px 12px 4px;
}

.quick-prompt-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    border: none;
    border-radius: 30px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                filter 0.25s ease;
    /* Shimmer layer */
    isolation: isolate;
}

/* Shimmer effect pseudo-element */
.quick-prompt-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.18) 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    transition: transform 0.5s ease;
    z-index: 1;
    border-radius: inherit;
}

.quick-prompt-btn:hover::before {
    transform: translateX(100%);
}

.quick-prompt-btn i,
.quick-prompt-btn span {
    position: relative;
    z-index: 2;
}

.quick-prompt-btn:hover {
    transform: translateY(-3px) scale(1.04);
    filter: brightness(1.15);
}

.quick-prompt-btn:active {
    transform: translateY(0) scale(0.97);
    filter: brightness(0.95);
}

/* ── Botón 1: Informe General — Violeta/Indigo ── */
.quick-prompt-btn:nth-child(1) {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255,255,255,0.15);
}
.quick-prompt-btn:nth-child(1):hover {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.6),
                inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ── Botón 2: Auditoría de Seguridad — Rojo/Rosa ── */
.quick-prompt-btn:nth-child(2) {
    background: linear-gradient(135deg, #f43f5e, #dc2626);
    color: #fff;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4),
                inset 0 1px 0 rgba(255,255,255,0.15);
}
.quick-prompt-btn:nth-child(2):hover {
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.6),
                inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ── Botón 3: Cacería de Bugs — Ambar/Naranja ── */
.quick-prompt-btn:nth-child(3) {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1a1a;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4),
                inset 0 1px 0 rgba(255,255,255,0.2);
}
.quick-prompt-btn:nth-child(3):hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.6),
                inset 0 1px 0 rgba(255,255,255,0.25);
}

/* ── Botón 4: Optimizar Rendimiento — Verde Esmeralda ── */
.quick-prompt-btn:nth-child(4) {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4),
                inset 0 1px 0 rgba(255,255,255,0.15);
}
.quick-prompt-btn:nth-child(4):hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.6),
                inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Checkbox label en el modal */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ==========================================================================
   PROVIDER BADGE — Indicador dinámico de proveedor activo
   ========================================================================== */

#api-key-section {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
    transition: all 0.3s ease;
}

.provider-openai {
    background: rgba(16, 163, 127, 0.12);
    color: #10a37f;
    border: 1px solid rgba(16, 163, 127, 0.3);
}

.provider-anthropic {
    background: rgba(210, 127, 71, 0.12);
    color: #d97706;
    border: 1px solid rgba(210, 127, 71, 0.3);
}
