/* =========================================
   user_style.css - Myravox Clean UI
   Theme: Google Style (Azul, Morado, Blanco)
   ========================================= */

/* --- 1. VARIABLES GLOBALES --- */
:root {
    /* Fondos */
    --bg-app: #f0f2f5;          /* Fondo general gris muy suave */
    --bg-white: #ffffff;        /* Blanco puro */
    --bg-sidebar: #ffffff;      /* Sidebar blanco */
    --bg-hover: #f1f3f4;        /* Gris hover estándar */
    --bg-active: #e8f0fe;       /* Azul muy claro para items activos */

    /* Texto */
    --text-primary: #1f1f1f;    /* Casi negro */
    --text-secondary: #5f6368;  /* Gris Google */
    --text-light: #9aa0a6;      /* Gris claro */

    /* Colores de Marca */
    --brand-primary: #6200ea;   /* Morado Myravox */
    --brand-secondary: #4285f4; /* Azul Google */
    
    /* Colores de Usuario (compatibilidad) */
    --color-user-background: var(--bg-app);
    --color-user-text: var(--text-primary);
    --color-user-text-secondary: var(--text-secondary);
    --color-user-accent: var(--brand-secondary);
    --color-user-accent-hover: #3367d6;
    --color-user-border: #dadce0;
    --color-user-border-accent: var(--brand-secondary);
    --color-user-surface: #f8f9fa;

    /* Dimensiones */
    --sidebar-width: 260px;
    --sidebar-compact-width: 72px; /* Nuevo: Ancho colapsado */
    --header-height: 64px;
    --radius-card: 16px;
    --radius-btn: 24px;

    /* Fuentes */
    --font-user-primary: 'Roboto', 'Segoe UI', sans-serif;
    --font-user-headings: 'Orbitron', sans-serif;

    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 10px rgba(0,0,0,0.15);
    --shadow-dropdown: 0 2px 4px -1px rgba(0,0,0,0.2), 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12);

    /* Colores para Arquetipos */
    --archetype-asistente_personal: #34a853;
    --archetype-chatbot_conversacional: #4285f4;
    --archetype-analista_de_datos: #fbbc04;
    --archetype-escritor_creativo: #8e24aa;
    --archetype-traductor_ia: #00acc1;
    --archetype-generador_codigo: #5f6368;
    --archetype-personaje_rol: #ea4335;
    --archetype-tutor_virtual: #607d8b;
    
    /* Estados */
    --state-danger: #d93025;
    --state-success: #188038;
}


/* --- 2. ICONOS --- */
[class^="icon-"], [class*=" icon-"] {
    display: inline-block;
    font-family: 'TuFuenteDeIconos'; 
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    text-transform: none;
    white-space: nowrap;
    margin-right: 1px;
    vertical-align: -0.15em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Mapeo de iconos */
.icon-menu::before { content: "\2630"; }
.icon-bell::before { content: "\1F514"; }
.icon-circle-question-mark::before { content: "\003F"; }
.icon-workflow::before { content: "\238B"; }
.icon-bot::before { content: "\f120"; }
.icon-bot-solid::before { content: "\f543"; }
.icon-brain::before { content: "\f5dc"; }
.icon-brain-circuit::before { content: "\e0b8"; }
.icon-chip::before { content: "\f1db"; }
.icon-zap::before { content: "\f0e7"; }
.icon-circle-play::before { content: "\f144"; }
.icon-circle-plus::before { content: "\f055"; }
.icon-circle-arrow-left::before { content: "\f359"; }
.icon-pencil-line::before { content: "\f044"; }
.icon-trash-2::before { content: "\f2ed"; }
.icon-search-slash::before { content: "\e250"; }
.icon-layout-dashboard::before { content: "\f0e4"; }
.icon-user::before { content: "\f007"; }
.icon-shield::before { content: "\f132"; }
.icon-log-out::before { content: "\f08b"; }
.icon-chevron-down::before { content: "\f078"; }
.icon-calendar-plus::before { content: "\f271"; }
.icon-calendar-check::before { content: "\f274"; }
.icon-search::before { content: "\1F50D"; }
.icon-plus::before { content: "\002B"; }
.icon-send-horizontal::before { content: "\27A4"; }
.icon-square-x::before { content: "\274E"; }
.icon-wrench::before { content: "\1F527"; }
.icon-package::before { content: "\1F4E6"; }


/* --- 3. ESTRUCTURA MAESTRA (LAYOUT) --- */
body.user-body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-user-primary);
    margin: 0;
    overflow-x: hidden;
}

.app-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}


/* 3.1 Sidebar (Izquierda - Fijo) */
.user-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--color-user-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1000;
    transition: width 0.3s ease, transform 0.3s ease; /* Animación suave */
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    transition: padding 0.3s ease; /* Para modo compacto */
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: var(--font-user-headings);
    font-weight: 700;
    font-size: 1.4rem;
    background: -webkit-linear-gradient(0deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    overflow: hidden; /* Para ocultar texto en compacto */
    white-space: nowrap;
}
.brand-icon { color: var(--brand-primary); font-size: 1.5rem; -webkit-text-fill-color: initial; flex-shrink: 0; }

.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 12px;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-left: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

/* Navegación Sidebar */
.user-nav-list { list-style: none; padding: 0; margin: 0; }
.user-nav-list li { margin-bottom: 4px; }

.user-nav-list a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    border-radius: 50px;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap; /* Evitar saltos de línea en compacto */
}
.user-nav-list a i { 
    margin-right: 16px; 
    font-size: 1.3rem; 
    color: var(--text-secondary); 
    width: 24px; 
    text-align: center;
    flex-shrink: 0;
}

.user-nav-list a:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}
.user-nav-list li.active a {
    background-color: #e8f0fe;
    color: var(--brand-secondary);
}
.user-nav-list li.active a i { color: var(--brand-secondary); }

/* Utilidades texto menú */
.text-accent { color: var(--brand-secondary) !important; }
.text-danger { color: var(--state-danger) !important; }


/* --- AJUSTES SIDEBAR COMPACTO (Desktop) --- */
/* Botón de colapsar (Desktop) */
.sidebar-collapse-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    margin-left: auto; 
    display: none; /* Oculto en mobile */
    padding: 4px;
    border-radius: 4px;
}
.sidebar-collapse-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Lógica Visual Modo Compacto */
body.sidebar-compact .user-sidebar {
    width: var(--sidebar-compact-width); 
}
body.sidebar-compact .content-wrapper {
    margin-left: var(--sidebar-compact-width);
    width: calc(100% - var(--sidebar-compact-width));
}

/* Ocultar textos */
body.sidebar-compact .sidebar-brand a span, /* Nombre app */
body.sidebar-compact .user-nav-list a .nav-label, /* Texto items */
body.sidebar-compact .sidebar-section-title {
    display: none; 
    opacity: 0;
}

/* Ajustar alineación en compacto */
body.sidebar-compact .sidebar-brand {
    justify-content: center;
    padding: 0;
}
body.sidebar-compact .user-nav-list a {
    justify-content: center;
    padding: 0;
    height: 48px;
    width: 48px;
    margin: 0 auto 4px auto;
}
body.sidebar-compact .user-nav-list a i {
    margin-right: 0;
}

/* Rotar flecha colapso */
body.sidebar-compact .sidebar-collapse-btn {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    margin: 0;
    display: flex;
}

/* Mostrar botón colapso solo en pantallas grandes */
@media (min-width: 993px) {
    .sidebar-collapse-btn { display: block; }
}


/* 3.2 Content Wrapper (Derecha) */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease; /* Suavizar el cambio de ancho */
}

/* Header Superior */
.user-top-header {
    height: var(--header-height);
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--color-user-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.menu-toggle {
    display: none; /* Oculto en desktop */
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}
.menu-toggle:hover { background-color: var(--bg-hover); }

.header-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background-color: var(--bg-hover); }


/* --- 4. COMPONENTES DE UI --- */

/* User Dropdown */
.user-profile-menu { position: relative; margin-left: 8px; }
.user-profile-trigger {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; padding: 4px 8px 4px 4px;
    border-radius: 30px; transition: background 0.2s;
}
.user-profile-trigger:hover { background-color: var(--bg-hover); }

.user-avatar-header {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover; border: 1px solid var(--color-user-border);
}
.user-name-header {
    font-size: 0.9rem; font-weight: 500; color: var(--text-primary);
    display: flex; align-items: center; gap: 5px;
}

.dropdown-menu {
    position: absolute; top: 120%; right: 0; width: 240px;
    background: var(--bg-white); border: 1px solid var(--color-user-border);
    box-shadow: var(--shadow-dropdown); border-radius: 8px;
    padding: 8px 0; 
    display: none; /* Oculto por defecto */
    z-index: 2000; flex-direction: column;
}

/* Estado Abierto del Dropdown */
.user-profile-menu.open .dropdown-menu { 
    display: flex; 
}

.dropdown-header-info { padding: 12px 20px; display: flex; flex-direction: column; }
.dropdown-header-info strong { font-size: 0.95rem; }
.dropdown-header-info small { color: var(--text-secondary); font-size: 0.85rem; }

.dropdown-menu hr { border: 0; border-top: 1px solid var(--color-user-border); margin: 4px 0; }
.dropdown-menu a {
    padding: 10px 20px; text-decoration: none; color: var(--text-primary);
    font-size: 0.9rem; display: flex; align-items: center; gap: 10px;
}
.dropdown-menu a:hover { background-color: var(--bg-hover); }
.text-danger { color: #d93025 !important; }


/* Botones */
.btn-primary {
    background-color: var(--brand-secondary); color: #fff;
    padding: 10px 24px; border-radius: 6px; border: none; cursor: pointer;
}
.btn-secondary-outline {
    background: transparent; border: 1px solid var(--color-user-border);
    color: var(--text-secondary); padding: 10px 24px; border-radius: 6px; cursor: pointer;
}
.btn-glow {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}
.btn-glow:hover {
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}
.btn-small { font-size: 0.85rem; padding: 8px 16px; }


/* --- 5. VISTAS ESPECÍFICAS --- */

/* Área Principal */
.user-main-area {
    flex: 1; padding: 32px;
    background-color: #ffffff;
}

/* --- PANTALLA: LISTADO DE AGENTES --- */

/* Barra de Acciones Principal */
.main-actions-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: nowrap;
}

.search-filter-group {
    display: flex;
    flex: 1;
    gap: 16px;
    align-items: center;
    min-width: 0;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 2;
    min-width: 200px;
}
.search-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-secondary); pointer-events: none;
}
.search-input-large {
    width: 100%; padding: 12px 16px 12px 48px; border-radius: 28px;
    border: 1px solid var(--color-user-border); font-size: 1rem;
    background: var(--bg-white); box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, border-color 0.2s;
    height: 48px;
}
.search-input-large:focus {
    outline: none; box-shadow: 0 1px 6px rgba(66,133,244,0.3);
    border-color: var(--brand-secondary);
}
.btn-icon-search {
    position: absolute; right: 0; top: 0; height: 100%; padding: 0 12px;
    background: transparent; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 1.2rem;
}

.filter-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 200px;
}
.filter-select {
    width: 100%; height: 48px; padding: 0 36px 0 16px;
    border-radius: 24px; border: 1px solid var(--color-user-border);
    background-color: var(--bg-white); color: var(--text-primary);
    font-size: 0.9rem; appearance: none; -webkit-appearance: none;
    cursor: pointer; white-space: nowrap; text-overflow: ellipsis;
    transition: border-color 0.2s;
}
.filter-select:focus { outline: none; border-color: var(--brand-secondary); }
.filter-icon {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-secondary); pointer-events: none;
}

/* Botón Crear Agente (Responsive) */
.btn-create-responsive {
    height: 48px;
    padding: 0 24px;
    display: flex; align-items: center; justify-content: center;
    gap: 8px; white-space: nowrap; flex-shrink: 0;
    width: auto !important;
    min-width: 48px !important;
    margin-bottom: 1px !important;
    background-color: var(--brand-secondary); color: #fff;
    border: none; border-radius: 24px; font-weight: 500;
    text-decoration: none; transition: box-shadow 0.2s;
}
.btn-create-responsive:hover {
    box-shadow: 0 1px 2px 0 rgba(66,133,244,0.3), 0 2px 6px 2px rgba(66,133,244,0.15);
    background-color: #3367d6;
}

/* Tabs Secundarios */
.view-tabs-container {
    margin-bottom: 32px;
    border-bottom: 1px solid var(--color-user-border);
}
.view-tabs {
    display: flex; gap: 24px; margin-bottom: -1px; overflow-x: auto;
}
.view-tab {
    padding: 12px 4px; color: var(--text-secondary); text-decoration: none;
    font-weight: 500; border-bottom: 3px solid transparent; transition: color 0.2s;
}
.view-tab.active { color: var(--brand-secondary); border-bottom-color: var(--brand-secondary); }


/* Grid de Agentes */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px; margin-bottom: 40px;
}

.agent-card-visual {
    background-color: #ffffff; border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm); border: 1px solid var(--color-user-border);
    display: flex; flex-direction: column; height: 260px;
    padding: 20px 15px; position: relative;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer; overflow: hidden;
}
.agent-card-visual:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-md);
    border-color: var(--color-user-accent);
}

.agent-card-header {
    padding: 0; display: flex; flex-direction: column;
    align-items: center; text-align: center;
}
.agent-visual-avatar {
    width: 72px; height: 72px;
    border-radius: 50%; object-fit: cover; margin-bottom: 12px;
    border: 3px solid var(--color-user-surface); background-color: #e8f0fe;
}
.agent-visual-name {
    font-size: 1.05rem; font-weight: 600; color: var(--color-user-text);
    margin: 0 0 6px 0; line-height: 1.3;
}

.agent-owner-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background-color: var(--bg-app);
    padding: 2px 8px;
    border-radius: 12px;
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border-color);
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agent-owner-label i {
    font-size: 0.8rem;
    color: var(--brand-secondary);
}

.status-badge-agent {
    padding: 2px 8px; border-radius: 12px; font-size: 0.7rem;
    font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block;
}
.status-active { background-color: #e6f4ea; color: #1e8e3e; }
.status-inactive, .status-deleted { background-color: #f1f3f4; color: #5f6368; }
.status-training { background-color: #e8f0fe; color: #1967d2; }

.agent-card-body {
    padding: 10px 5px; text-align: center; flex-grow: 1;
}
.agent-description {
    font-size: 0.85rem; color: var(--color-user-text-secondary);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; margin: 0;
}

.agent-card-footer {
    padding-top: 15px; background-color: transparent;
    border-top: 1px solid #f1f3f4; display: flex;
    justify-content: space-between; align-items: center;
    margin-top: auto;
}

.archetype-tag {
    font-size: 0.75rem; padding: 3px 8px; border-radius: 16px;
    background-color: #ffffff; color: var(--color-user-text-secondary);
    border: 1px solid var(--color-user-border); font-weight: 500;
    display: flex; align-items: center; gap: 4px;
}
.archetype-tag i { font-size: 0.9rem; margin-right: 0; }

.agent-actions { display: flex; gap: 4px; }
.btn-icon-action {
    background: #fff; border: 1px solid var(--color-user-border);
    color: var(--color-user-text-secondary); width: 28px; height: 28px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease;
}
.btn-icon-action:hover {
    border-color: var(--color-user-accent); color: var(--color-user-accent);
    background-color: #e8f0fe;
}
.btn-delete-action:hover {
    border-color: #d93025; color: #d93025; background-color: #fce8e6;
}

/* Tarjeta Crear Nuevo */
.create-agent-card {
    border: 2px dashed var(--color-user-border); background: transparent;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 260px; border-radius: 16px; cursor: pointer; text-decoration: none;
}
.create-agent-card:hover {
    border-color: var(--brand-secondary); background-color: rgba(66,133,244,0.04);
}
.create-icon-circle {
    width: 56px; height: 56px; border-radius: 50%; background: var(--bg-white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.create-icon-circle i { font-size: 1.8rem; color: var(--brand-secondary); }
.create-agent-card h3 { font-size: 1rem; color: var(--text-secondary); font-weight: 500; }


/* --- VISTA: DETALLE DE AGENTE --- */

.agent-detail-section { padding-bottom: 40px; }

/* Cabecera Sección Detalle */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px; padding-bottom: 20px;
    border-bottom: 1px solid var(--color-user-border); flex-wrap: wrap; gap: 20px;
}
.section-header h1 {
    font-family: var(--font-user-headings); color: var(--text-primary);
    font-size: 1.8rem; margin: 0; display: flex; align-items: center; font-weight: 600;
}
.archetype-icon-large i {
    font-size: 1.4em; margin-right: 15px; color: var(--brand-secondary);
    background: #e8f0fe; padding: 8px; border-radius: 12px;
}
.header-actions { display: flex; gap: 12px; }

/* Layout Detalle */
.agent-detail-layout { display: flex; gap: 32px; margin-top: 20px; }
.agent-detail-main { flex: 3; display: flex; flex-direction: column; gap: 24px; }
.agent-detail-sidebar { flex: 1; min-width: 300px; }

/* Tarjetas Detalle */
.detail-card, .futuristic-card, .sidebar-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm); border: 1px solid var(--color-user-border);
    padding: 30px;
}
.sidebar-card { position: sticky; top: 90px; }

.card-title-futuristic {
    font-family: var(--font-user-headings); font-size: 1.2rem; color: var(--text-primary);
    margin-top: 0; margin-bottom: 24px; padding-bottom: 12px;
    border-bottom: 1px solid var(--color-user-surface); font-weight: 600;
    display: flex; align-items: center; gap: 10px;
}

/* Info Grid Detalle */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.info-block { display: flex; flex-direction: column; }
.info-block.column-span-2 { grid-column: 1 / -1; }

.info-label-futuristic {
    font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600; margin-bottom: 8px;
}
.info-value-futuristic {
    font-size: 1rem; color: var(--text-primary); font-weight: 400; line-height: 1.6;
}
.description-text {
    color: var(--text-secondary); background-color: #f9f9f9;
    padding: 15px; border-radius: 8px; border-left: 4px solid var(--brand-secondary);
}

/* Sidebar Detalle */
.agent-avatar-large-container { display: flex; justify-content: center; margin-bottom: 20px; }
.agent-avatar-large-detail {
    width: 140px; height: 140px; border-radius: 50%; object-fit: cover;
    border: 4px solid #e8f0fe; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.default-avatar-large-detail {
    width: 140px; height: 140px; border-radius: 50%; background-color: #e8f0fe;
    color: var(--brand-secondary); display: flex; align-items: center; justify-content: center;
    font-size: 4rem; border: 4px solid #ffffff; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.sidebar-card-title {
    text-align: center; font-size: 1.4rem; font-weight: 700;
    color: var(--text-primary); margin-bottom: 15px;
}
.sidebar-info {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 8px;
}
.sidebar-actions { margin-top: 25px; display: flex; flex-direction: column; gap: 10px; }
.btn-full { width: 100%; justify-content: center; }

/* Tools Container */
.agent-tools-container {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px;
}
.tool-card {
    background-color: var(--bg-white); border: 1px solid var(--color-user-border);
    border-radius: 12px; padding: 20px; display: flex; flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-secondary); }
.tool-card h4 {
    display: flex; align-items: center; gap: 10px; margin: 0 0 10px 0;
    font-size: 1.1rem; color: var(--text-primary);
}
.tool-card h4 i {
    color: var(--brand-secondary); background-color: #e8f0fe;
    padding: 6px; border-radius: 6px;
}
.tool-card p {
    font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 20px; flex-grow: 1;
}


/* --- FORMULARIOS GENÉRICOS (Agente/Herramienta) --- */
.futuristic-form-card .form-row { display: flex; gap: 24px; margin-bottom: 24px; }
.futuristic-form-card .column-half { flex: 1; }
.futuristic-form-card .column-full { flex: 1 1 100%; }

.futuristic-group label {
    display: block; margin-bottom: 8px; color: var(--text-secondary);
    font-size: 0.9rem; font-weight: 500;
}
.required-asterisk { color: var(--state-danger); margin-left: 2px; }
.futuristic-group input, .futuristic-group select, .futuristic-group textarea {
    width: 100%; padding: 12px 15px; background-color: #ffffff;
    border: 1px solid var(--color-user-border); border-radius: 4px;
    color: var(--text-primary); font-size: 1rem;
}
.futuristic-group input:focus, .futuristic-group select:focus {
    outline: none; border-color: var(--brand-secondary);
    box-shadow: 0 0 0 2px rgba(66,133,244,0.2);
}
.field-hint { font-size: 0.8rem; color: var(--text-secondary); display: block; margin-top: 6px; }
.form-actions-futuristic {
    margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--color-user-border); text-align: right;
}
.form-actions-futuristic .btn { margin-left: 12px; }


/* --- CHAT MODAL --- */
.chat-modal-overlay { background: rgba(0,0,0,0.6); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; display: flex; justify-content: center; align-items: center; }
.chat-modal-container { background: #ffffff; width: 90%; max-width: 480px; height: 80vh; border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 24px 38px 3px rgba(0,0,0,0.14); }
.chat-modal-header { padding: 16px; border-bottom: 1px solid var(--color-user-border); display: flex; justify-content: space-between; align-items: center; }
.chat-modal-body { flex: 1; padding: 16px; overflow-y: auto; background: #ffffff; }
.chat-modal-footer { padding: 16px; border-top: 1px solid var(--color-user-border); background: #fff; border-radius: 0 0 12px 12px; }

.chat-message.user p {
    background: var(--brand-secondary); color: #fff;
    border-radius: 18px 18px 4px 18px; padding: 10px 14px;
    margin-bottom: 8px; max-width: 80%; margin-left: auto;
}
.chat-message.assistant p {
    background: #f1f3f4; color: var(--text-primary);
    border-radius: 18px 18px 18px 4px; padding: 10px 14px;
    margin-bottom: 8px; max-width: 80%;
}

#chatMessageInput { background: #f8f9fa; border: 1px solid transparent; border-radius: 24px; padding: 12px 20px; width: 100%; }
.btn-send-chat { background: var(--brand-secondary); color: #fff; width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer; }

/* --- 12. MODO APP-IN-APP (FULLSCREEN) --- */

.app-mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-app); /* Fondo gris suave detrás */
    z-index: 9999; /* Por encima de todo, incluso del sidebar móvil */
    display: flex;
    flex-direction: column; /* Apilar header y body verticalmente */
}

.app-mode-header {
    height: 60px;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0; /* Evitar que se encoja */
}

.app-mode-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-mode-title {
    margin: 0;
    font-family: var(--font-user-headings); /* Orbitron para consistencia de marca */
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.btn-icon-nav {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-icon-nav:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}
.btn-icon-nav i {
    font-size: 1.5rem;
}

.app-mode-body {
    flex: 1; /* Ocupa el resto de la altura */
    width: 100%;
    position: relative;
    background-color: #fff;
}

#appModeFrame {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

/* --- Estilos para Botón Compartir y Modal Embed --- */

/* Ajuste para el botón de compartir en la barra superior */
.btn-share-embed {
    margin-left: 10px;
    color: var(--brand-secondary); /* Destacarlo en azul */
    background-color: #f0f4ff;
    width: 36px; height: 36px;
}
.btn-share-embed:hover {
    background-color: var(--brand-secondary);
    color: #fff;
}

/* Overlay del Modal Embed (Z-Index mayor que app-mode-overlay que es 9999) */
.embed-modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Encima del iframe */
    backdrop-filter: blur(2px);
}

.embed-modal-card {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: 1px solid var(--color-user-border);
    animation: fadeIn 0.2s ease-out;
}

.embed-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-user-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.embed-modal-header h4 {
    margin: 0;
    font-family: var(--font-user-headings);
    color: var(--text-primary);
}

.embed-modal-body {
    padding: 20px;
}
.embed-modal-body p {
    margin-top: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Contenedor del código */
.code-snippet-container {
    position: relative;
    border: 1px solid var(--color-user-border);
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 0;
    margin-top: 10px;
    display: flex;
}

#embedCodeText {
    width: 100%;
    height: 100px;
    border: none;
    background: transparent;
    padding: 12px;
    resize: none;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #333;
    outline: none;
}

.btn-copy-code {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #fff;
    border: 1px solid var(--color-user-border);
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.btn-copy-code:hover {
    background: var(--bg-active);
    color: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

.copy-feedback {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    color: var(--state-success);
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: 600;
}
.copy-feedback.show { opacity: 1; }

/* --- FOOTER --- */
.user-main-footer {
    text-align: center; padding: 30px; font-size: 0.85rem;
    color: var(--text-light);
    border-top: 1px solid var(--color-user-border);
    background-color: #ffffff; margin-top: auto;
    width: 100%;
}


/* --- 6. RESPONSIVE / MEDIA QUERIES --- */
@media (min-width: 1600px) {
    .agents-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 992px) {
    .menu-toggle { 
        display: block; 
        border: none; 
        background: none; 
        font-size: 1.5rem; 
        margin-right: 16px;
        z-index: 1100;
    }
    .sidebar-overlay { 
        display: none; 
        position: fixed; 
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%; 
        background: rgba(0,0,0,0.5); 
        z-index: 999; 
    }
    .sidebar-overlay.active { display: block; }
    .sidebar-collapse-btn {
        display: none !important; /* Ocultar botón de colapso desktop en móvil */
    }
    .user-sidebar { 
        left: -280px; 
        box-shadow: 4px 0 12px rgba(0,0,0,0.1);
        transition: transform 0.3s ease;
        z-index: 1050;        
    }
    .user-sidebar.open { transform: translateX(280px); }
    
    .content-wrapper { margin-left: 0; width: 100%; }
    .user-main-header { padding: 0 16px; }
    .user-main-area { padding: 16px; }
    .user-name-header { display: none; }

    .agent-detail-layout { flex-direction: column; }
    .agent-detail-sidebar { min-width: auto; order: -1; }
    .sidebar-card { position: static; text-align: center; align-items: center; }
    
    /* Ajuste Toolbar Tablet */
    .main-actions-toolbar { gap: 12px; }
    .btn-create-responsive { width: 48px; padding: 0; border-radius: 50%; } 
    .btn-create-responsive .btn-label { display: none; }
    .btn-create-responsive i { margin: 0; font-size: 1.4rem; }
    .filter-wrapper { width: auto; min-width: 50px; }
    
    .tabs-actions-container { flex-direction: column-reverse; align-items: stretch; gap: 15px; border-bottom: none; }
    .tabs-actions-container .btn { width: 100%; }
    .view-tabs { width: 100%; border-bottom: 1px solid var(--color-user-border); padding-bottom: 5px; }
}

@media (max-width: 600px) {
    /* Reestructurar Toolbar */
    .main-actions-toolbar {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas: "search button" "filter filter";
        gap: 10px;
    }
    .search-filter-group { display: contents; }
    .search-input-wrapper { grid-area: search; }
    .btn-create-responsive { grid-area: button; margin: 0; }
    .filter-wrapper { grid-area: filter; width: 100%; }

    .agents-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .agent-card-visual, .create-agent-card { height: 240px; padding: 15px 10px; }
    .agent-visual-avatar { width: 60px; height: 60px; }
    .agent-visual-name { font-size: 1rem; }
    .agent-card-footer { flex-direction: column; gap: 8px; align-items: stretch; }
    .agent-actions { justify-content: center; }
    
    .section-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .header-actions { width: 100%; justify-content: space-between; }
    .header-actions .btn { flex: 1; }
}