/* CSS Design System - Portal de Documentación Hageo */

:root {
  /* Paleta de Colores */
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --panel-bg: rgba(17, 25, 40, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-gold: #F8C945;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
  --gold-gradient: linear-gradient(135deg, #F8C945 0%, #f5a623 100%);
  --gold-glow: rgba(248, 201, 69, 0.3);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Tipografía */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset de estilos */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Fondo de imagen de pantalla completa para el login */
#login-view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('../img/home.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px;
  box-sizing: border-box;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease;
}

#login-view.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Overlay oscuro semitransparente sobre la imagen para legibilidad */
#login-view::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
      rgba(9, 13, 22, 0.72) 0%,
      rgba(15, 23, 42, 0.60) 100%);
  z-index: 0;
  pointer-events: none;
}

/* El formulario de login centrado y sobre el overlay */
#login-view .login-card {
  position: relative;
  z-index: 1;
  max-width: 460px;
  width: 100%;
  margin: auto;
  /* Glassmorphism pronunciado sobre imagen */
  background: rgba(9, 13, 22, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Fondo decorativo con luces difusas (Glow Circles) - solo visible en dashboard */
.background-decor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.glow-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-indigo);
  top: -100px;
  right: -50px;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: var(--accent-blue);
  bottom: -150px;
  left: -100px;
}

/* Contenedores Principales */
.app-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  width: 100%;
}

.view-container {
  width: 100%;
  max-width: 1200px;
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* El login-view va a pantalla completa, override de view-container */
#login-view.view-container {
  max-width: 100%;
}

/* Dashboard se muestra en bloque normal */
#dashboard-view.view-container.active {
  display: block;
}

.view-container.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: translateY(0);
}

/* Panel Glassmorphism */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}



.login-card {
  padding: 40px;
  width: 100%;
}

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

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  color: var(--accent-blue);
}

/* Imagen del logo - pantalla de login */
.logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(248, 201, 69, 0.25));
}

/* Imagen del logo - header del dashboard */
.logo-img-sm {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent-gold);
  -webkit-text-fill-color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(248, 201, 69, 0.3);
}

.login-header h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Inputs de Formulario */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(248, 201, 69, 0.15);
  background: rgba(15, 23, 42, 0.85);
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Alertas */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fde047;
  margin-bottom: 25px;
}

.alert-icon-wrapper {
  flex-shrink: 0;
  display: flex;
}

.alert-svg {
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 10px;
  outline: none;
}

.btn-primary {
  background: var(--gold-gradient);
  color: #0f172a;
  box-shadow: 0 4px 15px var(--gold-glow);
  font-weight: 700;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f5a623 0%, #F8C945 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(248, 201, 69, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.login-footer {
  text-align: center;
  margin-top: 30px;
}

.login-footer p {
  color: var(--text-muted);
  font-size: 12px;
}

/* --- ESTILOS DE VISTA DE DASHBOARD --- */
#dashboard-view {
  display: flex;
  flex-direction: column;
  gap: 25px;
  background-image: url('../img/aplicativo.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  position: relative;
}

/* Overlay for dashboard background */
#dashboard-view::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(9, 13, 22, 0.85) 0%, rgba(15, 23, 42, 0.7) 100%);
  z-index: 0;
  pointer-events: none;
}



.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 30px;
}

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

.logo-icon-sm {
  width: 32px;
  height: 32px;
  color: var(--accent-gold);
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand .logo-text {
  font-size: 18px;
  line-height: 1.1;
  color: var(--accent-gold);
}

.brand .logo-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.user-profile {
  display: flex;
  position: relative;
  z-index: 1;
  align-items: center;
  gap: 20px;
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.user-company {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
}

.user-role {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 600;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  position: relative;
  z-index: 1;

  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-icon:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
  transform: rotate(180deg);
}

.logout-icon {
  width: 18px;
  height: 18px;
}

/* Área de Búsqueda */
.search-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-title-area {
  text-align: center;
  max-width: 700px;
  margin: 10px auto 0 auto;
}

.search-title-area h1 {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.search-title-area p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.search-box-wrapper {
  display: flex;
  padding: 8px;
  gap: 8px;
  border-radius: 12px;
}

.search-input-field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-svg {
  position: absolute;
  left: 20px;
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
}

.search-input-field input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px 50px 16px 55px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

.search-input-field input::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  position: absolute;
  right: 15px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.clear-svg {
  width: 18px;
  height: 18px;
}

.btn-search {
  padding: 0 35px;
  border-radius: 8px;
}

/* Resultados */
.results-section {
  padding: 25px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

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

.results-header h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.badge {
  background: rgba(248, 201, 69, 0.1);
  border: 1px solid rgba(248, 201, 69, 0.3);
  color: var(--accent-gold);
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}

/* Vista Vacía */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 50px 20px;
  flex: 1;
}

.empty-icon-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-icon {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 420px;
  line-height: 1.5;
}

/* Loader */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  flex: 1;
  gap: 15px;
}

.spinner-large {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Tabla de Resultados */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.2);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.results-table th,
.results-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
  vertical-align: middle;
}

.results-table th {
  background: rgba(15, 23, 42, 0.4);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.col-name {
  width: 28%;
}

.col-snippet {
  width: 45%;
}

.col-date {
  width: 12%;
}

.col-size {
  width: 8%;
}

.col-actions {
  width: 7%;
  text-align: center;
}

/* Celda Nombre del Documento */
.doc-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-icon {
  width: 20px;
  height: 20px;
  color: #f43f5e;
  /* Color rojo de PDF */
  flex-shrink: 0;
}

.doc-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}

/* Celda Snippet (OCR Match) */
.snippet-cell {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.snippet-cell b {
  color: #fbbf24;
  /* Color oro/amarillo para resaltar el texto buscado */
  background: rgba(251, 191, 36, 0.15);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Celda Fecha y Tamaño */
.date-cell,
.size-cell {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Fila interactiva */
.results-table tbody tr {
  transition: background-color 0.2s ease;
}

.results-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Botón de Descargar/Ver */
.btn-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #0f172a;
  transform: translateY(-1px);
}

.btn-action svg {
  width: 14px;
  height: 14px;
}

/* Paginación */
.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  padding-top: 10px;
}

/* Spinner pequeño */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

/* Animaciones */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Adaptabilidad Móvil */
@media (max-width: 1024px) {

  .results-table th,
  .results-table td {
    padding: 12px 14px;
  }

  .col-name {
    width: 35%;
  }

  .col-snippet {
    width: 35%;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 10px;
  }

  .dashboard-header {
    padding: 15px 20px;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .user-profile {
    justify-content: space-between;
  }

  .search-title-area h1 {
    font-size: 24px;
  }

  .search-box-wrapper {
    flex-direction: column;
  }

  .btn-search {
    padding: 14px 20px;
  }

  /* Transformar tabla a tarjetas (Cards) en pantallas pequeñas */
  .results-table thead {
    display: none;
    /* Ocultar cabeceras */
  }

  .results-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: 20px 15px;
    border-bottom: 2px solid var(--panel-border);
    gap: 10px;
  }

  .results-table td {
    display: block;
    padding: 0;
    width: 100% !important;
    border: none;
  }

  .results-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
  }

  .results-table td.col-name::before {
    display: none;
  }

  .doc-name-cell {
    font-size: 16px;
    margin-bottom: 5px;
  }

  .btn-action {
    width: 100%;
    justify-content: center;
    padding: 12px;
    margin-top: 10px;
  }
}