/* Base styles */
:root {
    --primary-color: #0F52BA;
    --secondary-color: #1E2A3A;
    --light-bg: #f5f7fa;
    --dark-bg: #111827;
    --grey-bg: #1F2937;
    --light-grey-bg: #374151;
    --text-color: #2D3748;
    --text-light: #718096;
    --text-dark: #1A202C;
    --border-color: rgba(255, 255, 255, 0.2);
    --accent-color: #4299E1;
    --danger-color: #F56565;
    --success-color: #38A169;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --insights-panel-width: 280px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--light-bg);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.background{
    background-color: var(--light-grey-bg);
}

html {
    scrollbar-width: thin; /* Opciones: auto, thin, none */
    scrollbar-color: var(--light-grey-bg) var(--dark-bg); /* thumb y track respectivamente */
  }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--grey-bg);
    color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.collapse-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.collapse-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 16px;
    scrollbar-color: var(--light-grey-bg) var(--grey-bg); /* thumb y track respectivamente */
}

.container-mainmenu {
    display: flex;
  }
  /* Contenedor principal (donde se listan las carpetas o chats) */
  .main-content {
    flex: 1;
  }
  /* Sidebar a la derecha */
  .business-ideas-sidebar {
    width: 300px;
    background-color: var(--light-grey-bg);
    padding: 15px;
    margin-left: 20px;
    border-radius: 5px;
    color: white
  }
  .business-ideas-sidebar h3 {
    margin-top: 0;
  }
  .business-ideas-sidebar ul {
    list-style-type: disc;
    padding-left: 20px;
  }
  

.new-chat-btn, .new-folder-btn {
    height: 40px;
    width: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 0;
    padding: 0 16px;
    transition: background-color 0.2s;
}

.buttons-container {
    display: flex;             /* Para ponerlos en la misma línea */
    align-items: center;       /* Centra verticalmente */
    gap: 8px;                  /* Espacio entre botones */
    margin-bottom: 20px;
    margin-top: 20px;
  }

.new-chat-btn:hover, .new-folder-btn:hover {
    background-color: #1A63D9;
}

.sidebar.collapsed .new-chat-btn span,
.sidebar.collapsed .new-folder-btn span {
    display: none;
}

.new-folder-container {
    margin-top: auto;
    padding: 8px 0;
}

.search-container {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 13px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-sections {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    position: relative;
}

.count {
    margin-left: auto;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 10px;
}

.section-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 8px;
}

.section-list.collapsed {
    display: none;
}

.section-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
}

.section-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.section-item.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-link {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.edit-folder-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    background-color: transparent;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.edit-folder-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background-color: white;
}

/* Chat header */
.chat-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--grey-bg);
    color: white;
}

.chat-title {
    font-size: 16px;
    font-weight: 600;
    margin-right: 16px;
}

.model-selector {
    position: relative;
    margin-right: auto;
}

.model-btn {
    height: 32px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px;
    background-color: var(--primary-color);
    color: white;
}

.model-btn.active {
    background-color: var(--primary-color);
}

.model-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 160px;
    background-color: var(--light-grey-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    overflow: hidden;
    display: none;
    color: white;
}

.model-selector:hover .model-dropdown {
    display: block;
}

.model-option {
    width: 100%;
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    text-align: left;
    color: white;
}

.model-option:hover {
    background-color: var(--light-bg);
    color: black;
}

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

.upload-btn, .insights-btn {
    height: 32px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 6px;
    border-radius: var(--border-radius);
    font-size: 13px;
}

.upload-btn {
    background-color: var(--primary-color);
    color: white;
}

.insights-btn {
    border: 1px solid var(--border-color);
    background-color: white;
}

.upload-btn:hover {
    background-color: #1A63D9;
}

.insights-btn:hover {
    background-color: var(--light-bg);
}

.logout-btn {
    height: 32px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    margin-left: 8px;
    border-radius: var(--border-radius);
    font-size: 13px;
    background-color: var(--danger-color);
    color: white;
}

.logout-btn:hover {
    background-color: #E53E3E;
}

.alert {
    padding: 8px 12px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    font-size: 13px;
}

.alert-danger {
    background-color: #FED7D7;
    color: #9B2C2C;
    border: 1px solid #FEB2B2;
}

/* Chat messages */
.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    overflow-y: auto;
    background-color: var(--dark-bg);
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
    white-space: pre-wrap;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-light);
    padding: 0 8px;
}

.message-content {
    padding: 12px;
    border-radius: 8px;
    background-color: var(--light-grey-bg);
    box-shadow: var(--shadow-sm);
    color: white;
}

.message.user .message-content {
    background-color: var(--primary-color);
    color: white;
}

/* Chat input */
.chat-input-container {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--dark-bg);
}

.message-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background-color: var(--light-grey-bg);
    color: white;
}

.message-input:focus {
    border-color: var(--accent-color);
}

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

.send-btn:hover {
    background-color: #1A63D9;
}

/* Insights panel vacío */
.insights-panel {
    width: var(--insights-panel-width);
    height: 100%;
    background-color: var(--grey-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

/* Estilo adicional para manejar la visualización colapsada */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-content,
.sidebar-collapsed .section-group {
    align-items: center;
}

.sidebar-collapsed .section-header span,
.sidebar-collapsed .edit-folder-btn,
.sidebar-collapsed .chat-link span,
.sidebar-collapsed .search-container {
    display: none;
}

.sidebar-collapsed .section-list {
    padding-left: 0;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}



.modal-content {
    width: 100%;
    max-width: 400px;
    background-color: var(--light-grey-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    color: white;
}

.modal-form {
    padding: 24px;
    background-color: var(--dark-bg);
    color: var(--light-grey-bg);
}

.modal-form h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: white;
}

.modal-form p {
    margin-bottom: 16px;
    color: var(--text-light);
}



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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    outline: none;
    background-color: var(--light-grey-bg);
    color: white;
}



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

.btn {
    height: 36px;
    padding: 0 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1A63D9;
}

.btn-secondary {
    background-color: var(--light-grey-bg);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--light-grey-bg);
}

.suggestion-btn {
    background-color: var(--grey-bg);
    color: white;
    border-radius: 15px;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #E53E3E;
}

/* Responsive styles */
@media (max-width: 1200px) {
    :root {
        --insights-panel-width: 240px;
    }
}

@media (max-width: 992px) {
    .insights-panel {
        display: none;
    }
    
    .sidebar.collapsed {
        width: 0;
        padding: 0;
    }
}

@media (max-width: 576px) {
    .header-actions {
        display: none;
    }
    
    .chat-title {
        margin-right: auto;
    }
    
    .message {
        max-width: 90%;
    }
}

/* Clase para ocultar elementos */
.hidden {
    display: none !important;
}

/* Cursor de puntero para las cabeceras de sección para indicar que son clickeables */
.section-header {
    cursor: pointer;
}

/* Indicador visual para mostrar que el folder puede expandirse/contraerse */
.section-header::after {
    content: '\f107'; /* Icono de flecha hacia abajo de Font Awesome */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.section-header.collapsed::after {
    transform: rotate(-90deg);
}

/* Animación suave para mostrar/ocultar los chats */
.section-list {
    max-height: 1000px;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
    opacity: 1;
    overflow: hidden;
}

.section-list.hidden {
    max-height: 0;
    opacity: 0;
}

/* Estilo para los botones de acción del folder */
.folder-actions {
    display: flex;
    margin-left: auto;
}

/* Type section styles */
.type-section {
    margin-bottom: 20px;
}

.type-header {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 8px;
}

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

/* Empty state messaging */
.empty-type-message {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    padding: 8px;
    font-style: italic;
    text-align: center;
}

/* Adjust spacing between sections */
.sidebar-sections {
    margin-bottom: 10px;
}

/* Responsive adjustment for type headers */
@media (max-width: 992px) {
    .type-header {
        font-size: 12px;
        padding: 8px;
    }
    
    .sidebar.collapsed .type-header {
        display: none;
    }
}

.graph-canvas {
    width: 700px;
}

.insights-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.insights-btn:hover {
    background-color: #357ac1;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.insights-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.insights-btn.loading {
    background-color: var(--primary-color);
    pointer-events: none;
}

.loading-spinner {
    margin-left: 10px;
}

.insights-panel {
    padding: 20px;
}
