/* ==========================================================================
   BIBLIOTECA VIRTUAL INTELIGENTE UNAMIS - ESTILOS PRINCIPALES
   ========================================================================== */

/* Importación de tipografías modernas */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&family=Open+Sans:wght@300;400;600;700&display=swap');

/* Variables CSS y Definición de Temas */
:root {
    /* Tema Claro (Default) */
    --primary-color: #A30013;        /* Carmesí UNAMIS */
    --primary-hover: #80000F;
    --secondary-color: #1E3A8A;      /* Azul Real Astra */
    --secondary-hover: #172554;
    --accent-color: #D97706;         /* Dorado/Oro */
    --accent-hover: #B45309;
    
    --bg-main: #F8FAFC;              /* Gris muy claro */
    --bg-card: #FFFFFF;              /* Blanco */
    --bg-sidebar: #FFFFFF;
    --bg-chat-bot: #F1F5F9;
    
    --text-primary: #0F172A;         /* Slate 900 */
    --text-secondary: #475569;       /* Slate 600 */
    --text-light: #94A3B8;           /* Slate 400 */
    --text-white: #FFFFFF;
    
    --border-color: #E2E8F0;         /* Slate 200 */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-primary: 0 4px 14px 0 rgba(163, 0, 19, 0.35);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --backdrop-blur: blur(8px);
}

[data-theme="dark"] {
    /* Tema Oscuro */
    --bg-main: #0F172A;              /* Slate 900 */
    --bg-card: #1E293B;              /* Slate 800 */
    --bg-sidebar: #1E293B;
    --bg-chat-bot: #1E293B;
    
    --text-primary: #F8FAFC;         /* Slate 50 */
    --text-secondary: #CBD5E1;       /* Slate 300 */
    --text-light: #64748B;           /* Slate 500 */
    
    --border-color: #334155;         /* Slate 700 */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 4px 14px 0 rgba(163, 0, 19, 0.6);
}

/* Reset y Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

ul {
    list-style: none;
}

button {
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
}

/* Contenedor Principal (Layout de Rejilla) */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   HEADER Y LOGO
   ========================================================================== */
.main-header {
    background-color: var(--bg-card);
    border-bottom: 2px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.header-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--primary-color);
}

.brand-text span {
    font-size: 0.75rem;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    display: block;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Alternador de Tema */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 26px;
    position: relative;
    width: 50px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: var(--text-light);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

.slider:before {
    background-color: white;
    bottom: 3px;
    content: "";
    height: 20px;
    left: 3px;
    position: absolute;
    transition: .4s;
    width: 20px;
    border-radius: 50%;
    z-index: 2;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider .slider-icon {
    font-size: 12px;
    color: white;
    z-index: 1;
}

/* ==========================================================================
   NAVEGACIÓN POR PESTAÑAS (TABS)
   ========================================================================== */
.main-nav {
    display: flex;
    gap: 5px;
}

.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid transparent;
}

.nav-btn:hover {
    color: var(--primary-color);
    background-color: rgba(163, 0, 19, 0.05);
}

.nav-btn.active {
    color: var(--primary-color);
    background-color: rgba(163, 0, 19, 0.08);
    border-bottom: 2px solid var(--primary-color);
}

/* Menú hamburguesa móvil */
.menu-toggle {
    display: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.5rem;
    padding: 5px;
}

/* ==========================================================================
   CONTENIDO DE PESTAÑAS Y DISEÑO GENERAL
   ========================================================================== */
.main-content {
    flex: 1;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 24px;
    position: relative;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-panel.active {
    display: block;
}

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

/* ==========================================================================
   SECCIÓN INICIO (HERO & BUSCADOR)
   ========================================================================== */
.hero-section {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.05) 0%, rgba(163, 0, 19, 0.05) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color), var(--accent-color));
}

.hero-badge {
    display: inline-block;
    background: rgba(163, 0, 19, 0.1);
    color: var(--primary-color);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
}

.hero-section h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 30px auto;
}

/* Caja de Búsqueda Avanzada */
.search-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.search-box-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 6px 6px 6px 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.search-box-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(163, 0, 19, 0.15);
}

.search-icon-left {
    color: var(--text-light);
    margin-right: 12px;
    display: flex;
    align-items: center;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
}

.search-btn {
    background-color: var(--primary-color);
    color: var(--text-white);
    font-weight: 700;
    padding: 12px 30px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.search-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-primary);
}

.search-btn:active {
    transform: scale(0.98);
}

.search-suggestions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.suggestion-chip {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    cursor: pointer;
}

.suggestion-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==========================================================================
   PANEL LATERAL Y FILTROS POR SEDE / CARRERA
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    margin-top: 30px;
}

.filter-sidebar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* Selector estilizado (Dropdowns) */
.custom-select-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.custom-select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    appearance: none;
    cursor: pointer;
    transition: var(--transition);
}

.custom-select:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-card);
}

.custom-select-wrapper::after {
    content: '▼';
    font-size: 0.75rem;
    color: var(--text-secondary);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Lista de Carreras Dinámica */
.carreras-list {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.carreras-list::-webkit-scrollbar {
    width: 4px;
}

.carreras-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.carrera-item {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.carrera-item:hover {
    background-color: rgba(163, 0, 19, 0.03);
    color: var(--primary-color);
}

.carrera-item.active {
    background-color: rgba(163, 0, 19, 0.08);
    color: var(--primary-color);
    border-color: rgba(163, 0, 19, 0.15);
}

/* ==========================================================================
   RESULTADOS DE BÚSQUEDA (PAPERS OPENALEX)
   ========================================================================== */
.results-area-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.results-count-badge {
    font-size: 0.8rem;
    background-color: var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.results-loader {
    display: none;
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 50px 20px;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
}

.no-results-icon {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Tarjeta de Artículo Académico */
.paper-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.paper-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--border-color);
    transition: var(--transition);
}

.paper-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.paper-card:hover::before {
    background-color: var(--primary-color);
}

.paper-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 10px;
}

.paper-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
}

.paper-title a:hover {
    text-decoration: underline;
}

.bookmark-toggle-btn {
    background: transparent;
    color: var(--text-light);
    font-size: 1.2rem;
    padding: 4px;
}

.bookmark-toggle-btn:hover {
    color: var(--accent-color);
}

.bookmark-toggle-btn.saved {
    color: var(--accent-color);
}

.paper-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.meta-badge {
    background-color: var(--bg-main);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-badge.journal {
    color: var(--secondary-color);
    background-color: rgba(30, 58, 138, 0.06);
}

.meta-badge.oa {
    color: #16A34A; /* Verde */
    background-color: rgba(22, 163, 74, 0.08);
}

.paper-authors {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.paper-authors strong {
    color: var(--text-primary);
}

.paper-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.paper-citations-count {
    font-size: 0.8rem;
    color: var(--text-light);
}

.action-links {
    display: flex;
    gap: 12px;
}

.btn-download {
    background-color: rgba(22, 163, 74, 0.1);
    color: #16A34A;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-download:hover {
    background-color: #16A34A;
    color: white;
}

.btn-cite-trigger {
    background-color: var(--bg-main);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
}

.btn-cite-trigger:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* ==========================================================================
   SECCIÓN: RECOMENDACIÓN DE BIBLIOTECAS (DIRECTORIO)
   ========================================================================== */
.directory-intro {
    margin-bottom: 30px;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.library-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.library-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(163, 0, 19, 0.2);
}

.library-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.library-logo-placeholder {
    width: 50px;
    height: 50px;
    background-color: rgba(30, 58, 138, 0.08);
    color: var(--secondary-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
}

.library-card.red-brand .library-logo-placeholder {
    background-color: rgba(163, 0, 19, 0.08);
    color: var(--primary-color);
}

.library-title-group h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.library-scope {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.library-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
    flex: 1;
}

.library-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.tag {
    font-size: 0.7rem;
    font-weight: 700;
    background-color: var(--bg-main);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

.tag.primary {
    background-color: rgba(163, 0, 19, 0.05);
    color: var(--primary-color);
}

.library-tip {
    font-size: 0.75rem;
    background-color: rgba(217, 119, 6, 0.08);
    color: var(--accent-hover);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-color);
    margin-bottom: 18px;
    font-style: italic;
}

.library-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-visit {
    background-color: var(--secondary-color);
    color: var(--text-white);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-visit:hover {
    background-color: var(--secondary-hover);
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.2);
}

/* ==========================================================================
   SECCIÓN: GENERADOR DE CITAS (HERRAMIENTAS)
   ========================================================================== */
.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.tool-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}

.tool-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-card);
}

.cite-style-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.style-radio {
    display: none;
}

.style-label {
    flex: 1;
    text-align: center;
    padding: 10px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: var(--transition);
}

.style-radio:checked + .style-label {
    background-color: var(--primary-color);
    color: var(--text-white);
    border-color: var(--primary-color);
}

.btn-generate-cite {
    width: 100%;
    background-color: var(--primary-color);
    color: var(--text-white);
    font-weight: 700;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

.btn-generate-cite:hover {
    background-color: var(--primary-hover);
}

.citation-result-box {
    margin-top: 25px;
    padding: 20px;
    background-color: var(--bg-main);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: none;
}

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

.result-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-copy {
    background: transparent;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-copy:hover {
    color: var(--primary-hover);
}

.citation-text {
    font-size: 0.95rem;
    line-height: 1.5;
    word-break: break-word;
    color: var(--text-primary);
}

/* ==========================================================================
   SECCIÓN: MIS FAVORITOS
   ========================================================================== */
.favorites-intro {
    margin-bottom: 25px;
}

/* ==========================================================================
   BIBLIO-BOT (INTELLIGENT CHATWIDGET EN LA ESQUINA)
   ========================================================================== */
.chat-widget-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Botón flotante */
.chat-launcher-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(163, 0, 19, 0.4);
    font-size: 1.6rem;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-launcher-btn:hover {
    transform: scale(1.1);
    background-color: var(--primary-hover);
}

.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid var(--bg-main);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Panel de chat */
.chat-panel {
    display: none;
    width: 380px;
    height: 520px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 15px;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel.active {
    display: flex;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: var(--text-white);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 38px;
    height: 38px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.bot-status h4 {
    color: var(--text-white);
    font-size: 0.95rem;
    line-height: 1.2;
}

.bot-status span {
    font-size: 0.7rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bot-status span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #22C55E; /* Verde brillante */
    border-radius: 50%;
}

.chat-close-btn {
    background: transparent;
    color: white;
    font-size: 1.1rem;
    opacity: 0.8;
}

.chat-close-btn:hover {
    opacity: 1;
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--bg-chat-bot);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
}

/* Burbujas de mensaje */
.msg-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    box-shadow: var(--shadow-sm);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.msg-bubble.bot {
    background-color: var(--bg-card);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.msg-bubble.user {
    background-color: var(--primary-color);
    color: var(--text-white);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.bot-recommendation-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
}

.bot-rec-title {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.8rem;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.bot-rec-link {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 8px;
}

.bot-rec-link:hover {
    background-color: var(--secondary-hover);
    color: white;
}

/* Sugerencias de respuesta rápida */
.chat-quick-replies {
    padding: 10px 15px;
    background-color: var(--bg-chat-bot);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
}

.chat-quick-replies::-webkit-scrollbar {
    display: none; /* Ocultar barra */
}

.quick-reply-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.quick-reply-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Entrada de chat */
.chat-input-area {
    padding: 12px 15px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-text-input {
    flex: 1;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-full);
    outline: none;
    font-size: 0.85rem;
}

.chat-text-input:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-card);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.chat-send-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

/* ==========================================================================
   FOOTER INSTITUCIONAL
   ========================================================================== */
.main-footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 30px 24px;
    text-align: center;
    margin-top: 50px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.footer-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.main-footer p {
    margin-bottom: 5px;
}

.footer-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: var(--text-light);
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   ADAPTABILIDAD RESPONSIVE (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-sidebar {
        width: 100%;
        position: relative;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 10px 15px;
    }
    
    .brand-text h1 {
        font-size: 1.2rem;
    }
    
    .brand-text span {
        font-size: 0.65rem;
        letter-spacing: 1px;
    }
    
    /* Menú hamburguesa móvil */
    .menu-toggle {
        display: block;
    }
    
    .main-nav {
        display: none; /* Por defecto oculto en móvil */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-card);
        border-bottom: 2px solid var(--primary-color);
        box-shadow: var(--shadow-lg);
        flex-direction: column;
        padding: 15px;
        gap: 8px;
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: flex-start;
    }
    
    .hero-section h2 {
        font-size: 1.7rem;
    }
    
    .hero-section p {
        font-size: 0.95rem;
    }
    
    .search-box-wrapper {
        padding: 4px 4px 4px 16px;
    }
    
    .search-input {
        font-size: 0.95rem;
    }
    
    .search-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .directory-grid {
        grid-template-columns: 1fr;
    }
    
    .chat-panel {
        width: 320px;
        height: 460px;
        right: 15px;
        bottom: 15px;
    }
    
    .chat-widget-wrapper {
        right: 15px;
        bottom: 15px;
    }
}
