@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");
@import url("https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css");

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #10b981;
  --secondary-hover: #059669;
  --text-color: #374151;
  --text-light: #6b7280;
  --background-color: #f9fafb;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --error-color: #ef4444;
  --success-color: #10b981;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: "Inter", sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  background-color: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary-color);
}

.logo i {
  font-size: 24px;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

main {
  flex: 1;
  padding: 40px 0;
  width: 100%;
}

.auth-container {
  max-width: 450px;
  margin: 0 auto;
  background-color: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h2 {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 10px;
}

.auth-header p {
  color: var(--text-light);
}

footer {
  background-color: var(--card-bg);
  padding: 20px 0;
  text-align: center;
  margin-top: auto;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

footer p {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  color: var(--text-color);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 40px;
}

/* Buttons */
.btn {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  text-decoration: none;
}

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

.btn-block {
  display: block;
  width: 100%;
}

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

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

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

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

.btn-sm {
  padding: 8px 15px;
  font-size: 0.9rem;
}

/* Messages */
.message {
  padding: 12px 15px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.message-error {
  background-color: #fee2e2;
  color: var(--error-color);
  border: 1px solid #fecaca;
}

.message-success {
  background-color: #d1fae5;
  color: var(--success-color);
  border: 1px solid #a7f3d0;
}

/* Links */
.link {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

.link:hover {
  text-decoration: underline;
}

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

/* Home page */
.hero {
  text-align: center;
  padding: 60px 20px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: var(--primary-color);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 30px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.btn-group {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Dashboard */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 25px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 25px;
}

.tab {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-weight: 500;
}

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

.tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-content {
  display: none;
}

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

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  color: var(--primary-color);
  background-color: #f8fafc;
}

tr:hover {
  background-color: #f8fafc;
}

/* Chatbot */
.chatbot {
  height: 400px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background-color: #f8fafc;
  border-radius: var(--radius);
  margin-bottom: 15px;
}

.chat-message {
  margin-bottom: 15px;
  max-width: 80%;
  padding: 12px 15px;
  border-radius: 18px;
  position: relative;
  line-height: 1.5;
}

.user-message {
  background-color: var(--primary-color);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 5px;
}

.bot-message {
  background-color: #e5e7eb;
  color: var(--text-color);
  margin-right: auto;
  border-bottom-left-radius: 5px;
}

.chat-input {
  display: flex;
  gap: 10px;
}

.chat-input input {
  flex: 1;
}

/* Filter form */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  align-items: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 15px;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
    white-space: nowrap;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-form .form-group {
    width: 100%;
  }
}

.flash-message-container {
  padding: 15px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.3s ease-in-out;
  position: relative;
}

.flash-message-container i {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.flash-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  border-left: 4px solid var(--success-color);
}

.flash-error {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
  border-left: 4px solid var(--error-color);
}

.flash-info {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-left: 4px solid #3b82f6;
}

.flash-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-left: 4px solid #f59e0b;
}

.flash-message-container .close-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: currentColor;
  cursor: pointer;
  opacity: 0.7;
  font-size: 1rem;
  padding: 5px;
}

.flash-message-container .close-btn:hover {
  opacity: 1;
}

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

/* Estilos para la navegación y el hero */

/* Botones de navegación */
.nav-buttons {
  display: flex;
  gap: 10px;
}

/* Hero container con layout de dos columnas */
.hero-container {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 60px 0;
}

.hero-content {
  flex: 1;
}

.hero-content h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: var(--primary-color);
  line-height: 1.2;
}

.hero-content p {
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 30px;
}

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

.image-placeholder {
  width: 100%;
  height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-container {
    flex-direction: column;
    padding: 40px 0;
  }

  .hero-content {
    text-align: center;
  }

  .hero-image {
    width: 100%;
  }

  .image-placeholder {
    height: 500px;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
  }

  .nav-buttons {
    width: 100%;
    justify-content: center;
  }
}

/* Estilos para el logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary-color);
  height: 50px; /* Altura fija para el logo */
}

.logo-svg {
  width: 100px;
  height: 100px;
  /* El color se aplicará automáticamente si el SVG tiene fill="currentColor" */
  color: var(--primary-color);
}

/* Estilos para corregir la alineación de los botones de filtro */

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  align-items: flex-end; /* Alinea los elementos al final */
}

.filter-form .form-group {
  margin-bottom: 0; /* Elimina el margen inferior para mejor alineación */
  flex-grow: 0;
}

.filter-form .btn {
  height: 45px; /* Altura fija para los botones para alinear con el input */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Asegurarse de que el input de fecha tenga la altura correcta */
.filter-form input[type="date"] {
  height: 45px;
}

/* En frontend/css/style.css */

/* Estilos para elementos generados por Markdown */
.chat-message p {
    margin-top: 0;
    margin-bottom: 0.5em; /* Espacio entre párrafos dentro de un mensaje */
}
.chat-message p:last-child {
    margin-bottom: 0;
}

.chat-message ul {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 20px; /* Indentación estándar para listas */
}
.chat-message li {
    margin-bottom: 0.25em;
}

.chat-message pre {
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto; /* Scroll horizontal para bloques de código largos */
    margin: 0.5em 0;
}
.chat-message code { /* Para código en línea y dentro de <pre> */
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    background-color: #f0f0f0; /* Sutil fondo para código en línea */
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}
.chat-message pre code { /* Resetear padding para código dentro de pre */
    padding: 0;
    background-color: transparent;
    font-size: inherit; /* Heredar tamaño de <pre> */
}

.chat-message h1, .chat-message h2, .chat-message h3 {
    margin-top: 0.8em;
    margin-bottom: 0.4em;
    line-height: 1.2;
}
.chat-message h1 { font-size: 1.5em; }
.chat-message h2 { font-size: 1.3em; }
.chat-message h3 { font-size: 1.1em; }

/* Recordar que .bot-message ya tiene sus propios estilos de fondo */
.bot-message code, .bot-message pre {
    background-color: #dcdcdc; /* Un poco más oscuro si el fondo del bot-message es claro */
}
.bot-message a {
    color: #0056b3; /* O el color de enlace que prefieras */
    text-decoration: underline;
}
.bot-message a:hover {
    text-decoration: none;
}