/* ===================================
   AGENTES ESPIRITUALES - CSS PROFESIONAL
   Estilo inspirado en CodeStorm
   =================================== */

:root {
    --primary-gold: #C9A227;
    --primary-gold-light: #E8D48A;
    --primary-gold-dark: #8B7019;
    --bg-dark: #0D0D15;
    --bg-card: #161622;
    --bg-card-hover: #1E1E2E;
    --text-light: #F5F5F5;
    --text-muted: #A0A0B0;
    --text-dim: #6B6B7B;
    --border-subtle: rgba(201, 162, 39, 0.15);
    --shadow-glow: 0 0 30px rgba(201, 162, 39, 0.1);
    --transition-smooth: all 0.3s ease;
    --gradient-gold: linear-gradient(135deg, #C9A227, #E8D48A, #C9A227);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header Principal */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(22, 22, 34, 0.95), rgba(13, 13, 21, 0.9));
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.header-left, .header-right {
    width: 200px;
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

.header-center {
    text-align: center;
}

.main-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(201, 162, 39, 0.3);
}

.main-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.75rem;
    width: fit-content;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.config-btn {
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.config-btn:hover {
    background: var(--bg-card-hover);
    color: var(--primary-gold);
}

.participar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gradient-gold);
    border: none;
    border-radius: 20px;
    color: var(--bg-dark);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.participar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(201, 162, 39, 0.4);
}

/* Progress Bar */
.spiritual-progress-bar {
    background: rgba(22, 22, 34, 0.8);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: none;
}

.spiritual-progress-bar.active {
    display: block;
}

.progress-container {
    max-width: 800px;
    margin: 0 auto;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-phase {
    display: flex;
    align-items: center;
    gap: 8px;
}

.phase-dot {
    width: 6px;
    height: 6px;
    background: var(--primary-gold);
    border-radius: 50%;
    animation: pulse-dot 1s infinite;
}

#current-phase {
    font-size: 0.8rem;
    color: var(--primary-gold);
    font-weight: 500;
}

.progress-percentage {
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.progress-track {
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-gold);
    border-radius: 4px;
    transition: width 0.7s ease;
    position: relative;
}

.progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Main Layout */
.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 0;
    overflow: hidden;
}

/* Agents Sidebar */
.agents-sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agents-list {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

/* Agent Card */
.agent-card {
    background: linear-gradient(135deg, var(--bg-card-hover), var(--bg-card));
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.agent-card:hover {
    border-color: var(--primary-gold);
    box-shadow: var(--shadow-glow);
    transform: translateX(5px);
}

.agent-card.active {
    border-color: var(--primary-gold);
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.1), var(--bg-card));
}

.agent-card.thinking .agent-status-indicator {
    animation: pulse-glow 1s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px var(--primary-gold); }
    50% { box-shadow: 0 0 15px var(--primary-gold), 0 0 25px var(--primary-gold); }
}

.agent-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.agent-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-gold);
}

.agent-avatar-fallback {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid var(--primary-gold);
}

.agent-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--text-dim);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.agent-card.active .agent-status-indicator {
    background: #4CAF50;
}

.agent-info {
    flex: 1;
    min-width: 0;
}

.agent-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-gold);
    margin-bottom: 2px;
}

.agent-role {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 500;
}

.agent-description {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.agent-thinking {
    display: none;
    position: absolute;
    bottom: 8px;
    right: 8px;
}

.agent-card.thinking .agent-thinking {
    display: flex;
}

.thinking-dots {
    display: flex;
    gap: 3px;
}

.thinking-dots span {
    width: 5px;
    height: 5px;
    background: var(--primary-gold);
    border-radius: 50%;
    animation: thinking-bounce 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes thinking-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Activity Log */
.activity-log {
    padding: 15px;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
    max-height: 200px;
    overflow-y: auto;
}

.activity-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.activity-entries {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.activity-entry {
    font-size: 0.7rem;
    padding: 6px 8px;
    background: var(--bg-dark);
    border-radius: 6px;
    border-left: 2px solid var(--primary-gold);
}

.activity-entry .agent-tag {
    color: var(--primary-gold);
    font-weight: 600;
}

.activity-entry .step-tag {
    color: #60A5FA;
}

.activity-placeholder {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    padding: 15px;
}

/* Center Panel */
.center-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-dark);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.welcome-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* Message Card */
.message-card {
    display: flex;
    gap: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 12px;
    background: var(--bg-card);
    border-left: 4px solid var(--primary-gold);
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-card.elias { border-left-color: #D4AF37; }
.message-card.pablo { border-left-color: #8B6914; }
.message-card.juan { border-left-color: #5D3A7A; }
.message-card.constructor { border-left-color: #2E8B57; }

.message-avatar {
    flex-shrink: 0;
}

.message-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.message-body {
    flex: 1;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.message-sender {
    font-weight: 600;
    font-size: 0.85rem;
}

.message-card.elias .message-sender { color: #D4AF37; }
.message-card.pablo .message-sender { color: #8B6914; }
.message-card.juan .message-sender { color: #5D3A7A; }
.message-card.constructor .message-sender { color: #2E8B57; }

.message-role {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-left: auto;
}

.message-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-light);
}

/* Canvas Panel */
.canvas-panel {
    height: 280px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-subtle);
}

.canvas-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-gold);
}

.canvas-actions {
    display: flex;
    gap: 8px;
}

.canvas-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-btn:hover {
    background: var(--bg-card-hover);
    color: var(--primary-gold);
    border-color: var(--primary-gold);
}

.canvas-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-placeholder {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Reflexión Preview (estilo pergamino) */
.reflexion-preview {
    background: #FFFEF5;
    border: 8px solid;
    border-image: linear-gradient(135deg, #C9A227, #E8D48A, #C9A227, #8B7019) 1;
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Georgia', serif;
}

.reflexion-title {
    color: #5D4E37;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #C9A227;
}

.reflexion-content {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.8;
    text-align: justify;
}

.reflexion-verse {
    margin: 15px 0;
    padding: 10px 15px;
    background: rgba(93, 58, 122, 0.08);
    border-left: 3px solid #5D3A7A;
    font-style: italic;
}

.reflexion-verse .ref {
    color: #8B7019;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

/* Input Container */
.input-container {
    padding: 15px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-container textarea {
    flex: 1;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    resize: none;
    transition: var(--transition-smooth);
}

.input-container textarea:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.2);
}

.input-container textarea::placeholder {
    color: var(--text-dim);
}

.send-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gradient-gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 25px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(201, 162, 39, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Versicles Panel */
.versicles-panel {
    background: var(--bg-card);
    border-left: 1px solid var(--border-subtle);
    padding: 15px;
    overflow-y: auto;
}

.versicles-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-gold);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.versicles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.versicles-placeholder {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    padding: 30px 15px;
}

.versicle-card {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 12px;
    border-left: 3px solid #5D3A7A;
}

.versicle-ref {
    font-size: 0.75rem;
    color: var(--primary-gold);
    font-weight: 600;
    margin-bottom: 6px;
}

.versicle-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    font-style: italic;
}

/* Mini Loading Widget - Floating in corner, not blocking chat */
.mini-loading-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 15px 20px;
    z-index: 999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    gap: 15px;
    min-width: 280px;
    backdrop-filter: blur(10px);
}

.mini-loading-widget.active {
    display: flex;
}

.mini-loading-title {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
}

.mini-agents-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.mini-agent-item {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    opacity: 0.4;
    transition: var(--transition-smooth);
}

.mini-agent-item.active {
    opacity: 1;
}

.mini-agent-item.active::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid var(--primary-gold);
    border-radius: 50%;
    animation: mini-pulse-ring 1.5s infinite;
}

@keyframes mini-pulse-ring {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

.mini-agent-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-agent-emoji {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--bg-dark);
}

.mini-status-text {
    font-size: 0.75rem;
    color: var(--primary-gold);
    font-weight: 500;
    text-align: center;
}

.mini-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: var(--gradient-gold);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-gold);
}

/* Intervention Modal */
.intervention-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.intervention-modal.active {
    display: flex;
}

.intervention-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 25px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.intervention-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    color: var(--primary-gold);
    margin-bottom: 20px;
    text-align: center;
}

.intervention-agents {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.intervention-agent-btn {
    padding: 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.intervention-agent-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary-gold);
}

.intervention-agent-btn.selected {
    background: rgba(201, 162, 39, 0.15);
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.intervention-agent-btn img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.intervention-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    resize: none;
    margin-bottom: 15px;
}

.intervention-textarea:focus {
    outline: none;
    border-color: var(--primary-gold);
}

.intervention-info {
    font-size: 0.7rem;
    color: var(--text-dim);
    background: var(--bg-dark);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.intervention-info strong {
    color: var(--primary-gold);
}

.intervention-buttons {
    display: flex;
    gap: 10px;
}

.intervention-btn {
    flex: 1;
    padding: 12px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.intervention-btn.cancel {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

.intervention-btn.cancel:hover {
    background: var(--bg-card-hover);
}

.intervention-btn.send {
    background: var(--gradient-gold);
    border: none;
    color: var(--bg-dark);
}

.intervention-btn.send:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(201, 162, 39, 0.4);
}

.intervention-btn.send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Versicle Approval Card */
.versicle-approval-card {
    background: linear-gradient(135deg, rgba(139, 105, 20, 0.2), rgba(139, 105, 20, 0.1));
    border: 2px solid #8B6914;
    border-radius: 15px;
    padding: 20px;
    margin: 10px 0;
}

.versicle-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(139, 105, 20, 0.3);
}

.versicle-card-emoji {
    font-size: 1.5rem;
}

.versicle-card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #C9A227;
}

.versicle-card-message {
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.6;
}

.versicle-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.versicle-item {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #8B6914;
    padding: 12px 15px;
    border-radius: 0 8px 8px 0;
}

.versicle-ref {
    font-weight: 600;
    color: #C9A227;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.versicle-text {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.5;
}

.versicle-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.versicle-approve-btn {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #8B6914, #C9A227);
    border: none;
    border-radius: 25px;
    color: var(--bg-dark);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.versicle-approve-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(201, 162, 39, 0.4);
}

.versicle-suggest-btn {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid #8B6914;
    border-radius: 25px;
    color: #C9A227;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.versicle-suggest-btn:hover {
    background: rgba(139, 105, 20, 0.2);
}

.versicle-suggest-form {
    margin-top: 15px;
}

.versicle-suggest-form textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    resize: none;
    margin-bottom: 10px;
}

.versicle-suggest-form textarea:focus {
    outline: none;
    border-color: #8B6914;
}

.versicle-submit-btn {
    padding: 10px 20px;
    background: #8B6914;
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.versicle-submit-btn:hover {
    background: #C9A227;
}

.versicle-approval-card.approved {
    opacity: 0.7;
    pointer-events: none;
}

.versicle-approval-card.suggested {
    opacity: 0.7;
    pointer-events: none;
}

/* Fullscreen Modal */
.fullscreen-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.fullscreen-modal.active {
    display: flex;
}

.fullscreen-content {
    position: relative;
    width: 90%;
    height: 90%;
    background: #FFFEF5;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.fullscreen-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    z-index: 10;
    transition: var(--transition-smooth);
}

.fullscreen-close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.fullscreen-action-btn {
    position: absolute;
    top: 15px;
    right: 70px;
    background: rgba(139, 105, 20, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    z-index: 10;
    transition: var(--transition-smooth);
}

.fullscreen-action-btn:hover {
    background: rgba(201, 162, 39, 0.9);
}

.fullscreen-action-btn:nth-of-type(1) {
    right: 120px;
}

.fullscreen-action-btn:nth-of-type(2) {
    right: 70px;
}

.fullscreen-inner {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 40px;
}

.fullscreen-inner .reflexion-preview {
    max-width: 100%;
    margin: 0 auto;
}

/* Large message card */
.message-card.large-card {
    max-width: 90%;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .agents-sidebar, .versicles-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 1.2rem;
    }

    .main-subtitle {
        font-size: 0.65rem;
    }

    .canvas-panel {
        height: 200px;
    }

    .intervention-agents {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════
   MODAL DE CHAT CONVERSACIONAL CON AGENTES
   ═══════════════════════════════════════════════════════ */

.chat-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.chat-modal.active {
    display: flex;
}

.chat-modal-container {
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-radius: 18px;
    box-shadow: 0 0 60px rgba(201, 162, 39, 0.15), 0 20px 60px rgba(0,0,0,0.6);
    overflow: hidden;
}

/* Header */
.chat-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.08), transparent);
    flex-shrink: 0;
}
.chat-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-gold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.chat-modal-icon { font-size: 1.2rem; }
.chat-modal-close {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center;
}
.chat-modal-close:hover {
    background: rgba(244, 67, 54, 0.2);
    border-color: #F44336;
    color: #F44336;
}

/* Selector de agentes */
.chat-agent-selectors {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.chat-selector-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.chat-agent-toggles {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.agent-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: var(--bg-card-hover);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 72px;
    position: relative;
}
.agent-toggle img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
}
.agent-toggle-emoji { font-size: 1.2rem; display: none; }
.agent-toggle img + .agent-toggle-emoji { display: none; }
.agent-toggle-name {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
}
.agent-toggle-sub {
    font-size: 0.58rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
}

.agent-toggle[data-agent="elias"].active  { border-color: #D4AF37; box-shadow: 0 0 12px rgba(212,175,55,0.3); }
.agent-toggle[data-agent="pablo"].active  { border-color: #8B6914; box-shadow: 0 0 12px rgba(139,105,20,0.3); }
.agent-toggle[data-agent="juan"].active   { border-color: #5D3A7A; box-shadow: 0 0 12px rgba(93,58,122,0.3); }
.agent-toggle.all-toggle.active { border-color: var(--primary-gold); box-shadow: 0 0 12px rgba(201,162,39,0.35); }

.agent-toggle[data-agent="elias"].active .agent-toggle-name { color: #D4AF37; }
.agent-toggle[data-agent="pablo"].active .agent-toggle-name { color: #C9A060; }
.agent-toggle[data-agent="juan"].active  .agent-toggle-name { color: #9B7FC0; }
.agent-toggle.all-toggle.active .agent-toggle-name          { color: var(--primary-gold); }

.agent-toggle:hover { background: rgba(201,162,39,0.08); transform: translateY(-2px); }

/* Mensajes */
.chat-modal-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 280px;
    max-height: 420px;
    scroll-behavior: smooth;
}
.chat-modal-messages::-webkit-scrollbar { width: 4px; }
.chat-modal-messages::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }

.chat-welcome-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.7;
    padding: 24px 16px;
    border: 1px dashed var(--border-subtle);
    border-radius: 12px;
    background: rgba(201,162,39,0.03);
}

/* Burbujas */
.chat-bubble {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: fadeInUp 0.3s ease;
    max-width: 90%;
}
.chat-bubble-user {
    flex-direction: row-reverse;
    align-self: flex-end;
}
.chat-bubble-agent {
    align-self: flex-start;
}

.chat-bubble-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.chat-bubble-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-avatar {
    background: rgba(201, 162, 39, 0.15);
    border-color: rgba(201, 162, 39, 0.4);
}

.chat-bubble-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: calc(100% - 50px);
}

.chat-bubble-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.chat-bubble-name {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.chat-bubble-role {
    font-size: 0.65rem;
    color: var(--text-dim);
}
.chat-bubble-time {
    font-size: 0.62rem;
    color: var(--text-dim);
    margin-left: auto;
}

.chat-bubble-text {
    background: var(--bg-card-hover);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-light);
    border-left: 3px solid var(--agent-color, var(--border-subtle));
}
.chat-bubble-user .chat-bubble-text {
    background: rgba(201, 162, 39, 0.12);
    border-left: none;
    border-right: 3px solid var(--primary-gold);
    text-align: right;
}

/* Indicador de escritura */
.chat-typing .chat-bubble-text {
    padding: 12px 16px;
    min-width: 60px;
}
.chat-typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}
.chat-typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.2s ease-in-out infinite both;
}
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* Área de input */
.chat-modal-input-area {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
    align-items: flex-end;
}
#chat-modal-input {
    flex: 1;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-light);
    padding: 10px 14px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s ease;
    line-height: 1.5;
}
#chat-modal-input:focus {
    outline: none;
    border-color: rgba(201, 162, 39, 0.5);
}
#chat-modal-input::placeholder { color: var(--text-dim); }

#chat-modal-send {
    background: var(--gradient-gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
#chat-modal-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.4);
}
#chat-modal-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.send-icon { font-size: 1rem; }

/* ── Botones de acción en el input ── */
.chat-input-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

/* Botón DEBATIR */
.debate-btn {
    background: transparent;
    border: 1px solid rgba(201, 162, 39, 0.4);
    color: var(--primary-gold);
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.debate-btn:hover:not(:disabled) {
    background: rgba(201, 162, 39, 0.12);
    border-color: var(--primary-gold);
    box-shadow: 0 0 12px rgba(201, 162, 39, 0.25);
}
.debate-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Barra de debate activo ── */
.debate-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.1), rgba(93, 58, 122, 0.1));
    border-top: 1px solid rgba(201, 162, 39, 0.25);
    border-bottom: 1px solid rgba(201, 162, 39, 0.25);
    flex-shrink: 0;
    animation: fadeIn 0.3s ease;
}
.debate-bar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--primary-gold);
    font-weight: 600;
}
.debate-icon { font-size: 1rem; }
.debate-stop-btn {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.4);
    color: #F44336;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.debate-stop-btn:hover {
    background: rgba(244, 67, 54, 0.3);
}

/* ── Divider de debate ── */
.debate-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.debate-divider::before,
.debate-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}
.debate-divider.debate-end { color: rgba(201,162,39,0.5); }

/* ── Countdown pill ── */
.debate-countdown-pill {
    align-self: center;
    background: rgba(201, 162, 39, 0.07);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    animation: fadeIn 0.3s ease;
}
.debate-countdown-pill strong {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-gold);
    font-variant-numeric: tabular-nums;
}

/* ── Burbujas de debate con badge de citación ── */
.debate-bubble .chat-bubble-text {
    border-left-color: var(--agent-color);
    background: rgba(255,255,255,0.03);
}
.debate-citation {
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-bottom: 5px;
    font-style: italic;
    letter-spacing: 0.02em;
}
.debate-citation span {
    font-style: normal;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Responsive */
@media (max-width: 600px) {
    .chat-modal-container { max-height: 95vh; border-radius: 14px 14px 0 0; }
    .chat-agent-toggles { gap: 7px; }
    .agent-toggle { min-width: 60px; padding: 7px 10px; }
    .agent-toggle img { width: 28px; height: 28px; }
    .chat-modal-messages { min-height: 220px; max-height: 340px; }
    .chat-input-actions { flex-direction: row; }
}