/* Modern Variables */
:root {
  --primary-color: #0b3a5b;
  --primary-gradient: linear-gradient(135deg, #0b3a5b, #0f4c73);
  --bg-color: #f6f7fb;
  --card-bg: #ffffff;
  --text-dark: #0f172a;
  --text-muted: rgba(15, 23, 42, 0.62);
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);

  --accent-color: #82c6f1;
  --surface-2: #fbfcfe;
  --border-color: rgba(15, 23, 42, 0.08);

  /* Bootstrap theme overrides (make standard classes follow the premium theme) */
  --bs-primary: var(--primary-color);
  --bs-primary-rgb: 11, 58, 91;
  --bs-link-color: var(--primary-color);
  --bs-link-hover-color: #0f4c73;
  --bs-border-color: var(--border-color);
  --bs-secondary-color: var(--text-muted);
  --bs-body-color: var(--text-dark);
  --bs-body-bg: var(--bg-color);
  --bs-primary-bg-subtle: rgba(11, 58, 91, 0.10);
  --bs-primary-text-emphasis: #062a40;
  --bs-primary-border-subtle: rgba(11, 58, 91, 0.14);

  /* Override Bootstrap Font Variables */
  --bs-font-sans-serif: 'Outfit', system-ui, -apple-system, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --placeholder-color: rgba(15, 23, 42, 0.30);
}

body {
  background-color: var(--bg-color);
  font-family: var(--bs-body-font-family) !important;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* If templates use Bootstrap utility backgrounds, keep them aligned with the theme */
.bg-light {
  background-color: var(--bg-color) !important;
}

.bg-white {
  background-color: #fff !important;
}

/* Force Font on Everything */
h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand,
.btn,
.form-control,
.form-select,
.nav-link,
.dropdown-item,
input,
button,
select,
textarea {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif !important;
  letter-spacing: normal;
}

/* Make placeholder text clearly softer than actual value text */
input::placeholder,
textarea::placeholder,
select::placeholder,
.form-control::placeholder,
.form-select::placeholder {
  color: var(--placeholder-color) !important;
  opacity: 1 !important;
  font-style: italic;
  font-size: 0.92em;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
  font-weight: 700;
}

main {
  flex: 1;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.fade-in-up {
  animation: fadeInUp 0.5s ease-out backwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Text Gradient */
.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Search Card */
.search-card {
  transition: transform 0.2s, box-shadow 0.2s;
  border-radius: 1rem;
}

.search-card:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg) !important;
}

/* Response Area */
/* Métricas / modal detalle: misma lectura que visor HTML del asistente */
.detail-answer--html.formatted-answer {
  white-space: normal;
  word-break: break-word;
}

.formatted-answer h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.formatted-answer ul,
.formatted-answer ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.formatted-answer li {
  margin-bottom: 0.5rem;
}

.formatted-answer p {
  margin-bottom: 1rem;
}

.formatted-answer code {
  background: #f1f5f9;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: #ef4444;
}

.formatted-answer pre {
  background: #1e293b;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

/* Citation Cards */
.citation-card {
  transition: transform 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.citation-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md) !important;
}

/* Debug Tabs */
.nav-tabs-dark .nav-link {
  color: #9ca3af;
  border: none;
  border-bottom: 2px solid transparent;
}

.nav-tabs-dark .nav-link:hover {
  color: #e5e7eb;
}

.nav-tabs-dark .nav-link.active {
  color: #fff;
  background-color: transparent;
  border-bottom-color: var(--primary-color);
}

/* Utils */
.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hover-opacity-100:hover {
  opacity: 1 !important;
}

/* Custom Scrollbar for Pre blocks */
pre::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

pre::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Navbar Styles */
.main-navbar {
  background-color: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  /* Por encima del contenido / sidebar para que los dropdowns reciban clics */
  z-index: 1030;
}

.main-navbar-toolbar {
  min-width: 0;
}

/* Botón menú móvil: círculo geométrico (evita óvalo por padding/line-height) */
.navbar-sidebar-mark {
  line-height: 0;
  vertical-align: middle;
}

.navbar-sidebar-mark:focus-visible {
  outline: 2px solid rgba(0, 44, 89, 0.45);
  outline-offset: 2px;
}

.navbar-sidebar-mark-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background-color: #002C59;
  box-shadow: 0 1px 4px rgba(0, 44, 89, 0.2);
}

.navbar-sidebar-mark-circle img {
  display: block;
  max-width: 72%;
  max-height: 72%;
  width: auto;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.main-navbar-tools {
  min-width: 0;
}

.navbar-project-name {
  max-width: 14rem;
}

@media (max-width: 991.98px) {
  .navbar-project-name {
    max-width: min(9.5rem, 42vw);
  }

  .main-navbar-tools .btn.rounded-pill {
    padding-left: 0.5rem;
    padding-right: 0.65rem;
  }
}

.main-navbar .dropdown-menu,
.main-navbar-account-menu {
  z-index: 2000;
}

.navbar-project-logo {
  object-fit: contain;
}

.navbar-brand {
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.navbar-nav .nav-link {
  color: #4b5563 !important;
  /* text-gray-600 */
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: var(--primary-color) !important;
}

/* Active indicator for nav items (optional subtle dot) */
.navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: all 0.3s ease;
  transform: translateX(-50%);
  opacity: 0;
}

.navbar-nav .nav-link:hover::after {
  width: 20px;
  opacity: 1;
}

/* Dropdowns */
.dropdown-menu {
  border: none;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 0.5rem;
  margin-top: 0.5rem !important;
  /* spacing from button */
  animation: fadeIn 0.2s ease-out;
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
}

.dropdown-item:hover {
  background-color: #f3f4f6;
  color: var(--primary-color);
}

.dropdown-item.active {
  background-color: rgba(11, 58, 91, 0.08);
  color: var(--primary-color);
  font-weight: 600;
}

/* Custom badge/button in navbar */
.bg-gray-100 {
  background-color: #f3f4f6;
}

/* Toggler */
.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(75, 85, 99, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Context Selector */
.context-selector-container {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(to right, #ffffff, #f9fafb);
}

.context-selector-container:hover,
.context-selector-container:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  border-color: #e5e7eb;
}

.context-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none !important;
}

.context-select:focus {
  box-shadow: none !important;
  outline: none !important;
}

/* Custom dropdown icon handled by HTML/Bootstrap icon */

/* Footer */
footer {
  background-color: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(8px);
}

.hover-primary:hover {
  color: var(--primary-color) !important;
  text-decoration: underline !important;
}

/* Minimal mode overrides */
.minimal-mode .main-navbar {
  display: none !important;
}

.minimal-mode .container.py-4 {
  padding-top: 2rem !important;
}

/* DocModern Aesthetic Utilities */

.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-modern {
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.badge-premium {
  padding: 0.5em 1em;
  border-radius: 50rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-success-premium {
  background-color: #ecfdf5;
  color: #059669;
}

.badge-warning-premium {
  background-color: #fffbeb;
  color: #d97706;
}

.badge-danger-premium {
  background-color: #fef2f2;
  color: #dc2626;
}

.btn-gradient-primary {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border: none !important;
  transition: all 0.2s ease;
  border-radius: 12px;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
}

.btn-gradient-primary:hover {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-gradient-success {
  background: #22c55e;
  background: linear-gradient(135deg, #22c55e, #10b981);
  color: white;
  border: none !important;
  transition: all 0.2s ease;
  border-radius: 12px;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
}

.btn-gradient-success:hover {
  background: #16a34a;
  background: linear-gradient(135deg, #16a34a, #059669);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.stat-card {
  border-radius: 16px;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  height: 100%;
}

.form-control,
.form-select {
  border-color: var(--border-color);
}

.form-control {
  background-color: var(--surface-2);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(11, 58, 91, 0.35);
  box-shadow: 0 0 0 0.25rem rgba(11, 58, 91, 0.12);
}

.offcanvas-body .d-grid > .btn.btn-outline-secondary.text-start,
.col-lg-3.d-none.d-lg-block .d-grid > .btn.btn-outline-secondary.text-start {
  background: transparent;
  border-color: transparent;
  color: rgba(15, 23, 42, 0.78);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.offcanvas-body .d-grid > .btn.btn-outline-secondary.text-start:hover,
.col-lg-3.d-none.d-lg-block .d-grid > .btn.btn-outline-secondary.text-start:hover {
  background-color: rgba(15, 23, 42, 0.04);
  color: var(--text-dark);
}

.offcanvas-body .d-grid > .btn.btn-outline-secondary.text-start.active,
.col-lg-3.d-none.d-lg-block .d-grid > .btn.btn-outline-secondary.text-start.active {
  background-color: rgba(11, 58, 91, 0.10) !important;
  border-color: rgba(11, 58, 91, 0.10) !important;
  color: var(--primary-color) !important;
}

.offcanvas-body .d-grid > .btn.btn-outline-danger.text-start,
.col-lg-3.d-none.d-lg-block .d-grid > .btn.btn-outline-danger.text-start {
  border-radius: 12px;
  border-color: transparent;
}

.offcanvas-body .d-grid > .btn.btn-outline-danger.text-start:hover,
.col-lg-3.d-none.d-lg-block .d-grid > .btn.btn-outline-danger.text-start:hover {
  background-color: rgba(220, 38, 38, 0.08);
}

/* Branding dragonSAC */
.navbar-brand .brand-dragon {
  color: var(--text-dark);
  /* Or white if on dark bg */
  font-weight: 500;
}

.navbar-brand .brand-sac {
  color: #82c6f1;
  /* Light blue from logo */
  font-weight: 700;
}

.text-dragonsac {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.2px;
  display: inline-block;
  transform: scaleX(1.2);
  transform-origin: left;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* Global Mobile Modal & Card Optimizations */
@media (max-width: 576px) {
  .modal-header {
    padding: 1rem 1rem !important;
  }

  .modal-body {
    padding: 1rem 1rem !important;
  }

  .modal-footer {
    padding: 0.75rem 1rem !important;
  }

  .plan-card .card-body {
    padding: 1.25rem !important;
  }

  .plan-card h3 {
    font-size: 1.25rem !important;
  }

  .plan-card .price-box {
    padding: 1rem !important;
  }
}
/* ==========================================================================
   Sidebar PRO Refined Layout
   ========================================================================== */
.sidebar-pro {
  background-color: #ffffff;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  height: calc(100vh - 4.5rem);
  position: sticky;
  top: 4.5rem;
  overflow-y: auto;
  z-index: 100;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-pro-section {
  padding: 1.5rem 1.5rem 0.6rem 1.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  display: block;
}

.nav-pro-item {
  display: flex;
  align-items: center;
  padding: 0.65rem 1.25rem;
  margin: 0.1rem 0.75rem;
  color: #64748b;
  text-decoration: none !important;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.nav-pro-item i {
  font-size: 1.15rem;
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
  opacity: 0.75;
}

.nav-pro-item:hover {
  background-color: #f1f5f9;
  color: var(--primary-color);
  padding-left: 1.5rem;
}

.nav-pro-item.active {
  background-color: rgba(11, 58, 91, 0.06);
  color: var(--primary-color);
  font-weight: 600;
}

.nav-pro-item.active i {
  color: var(--primary-color);
  opacity: 1;
}

.nav-pro-item.active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 4px;
  background-color: var(--primary-color);
  border-radius: 0 4px 4px 0;
}

/* Primera opción del menú: probar asistentes (fondo verdoso) */
.nav-pro-item.nav-pro-item-try {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #065f46 !important;
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-weight: 600;
}
.nav-pro-item.nav-pro-item-try i {
  color: #059669;
  opacity: 1;
}
.nav-pro-item.nav-pro-item-try:hover {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #047857 !important;
  padding-left: 1.5rem;
}
.nav-pro-item.nav-pro-item-try.active {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
  color: #064e3b !important;
}
.nav-pro-item.nav-pro-item-try.active i {
  color: #047857;
}
.nav-pro-item.nav-pro-item-try.active::before {
  background-color: #059669;
}

.sidebar-pro::-webkit-scrollbar {
  width: 4px;
}
.sidebar-pro::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.nav-pro-item.logout-pro {
  margin-top: auto;
  color: #ef4444 !important;
}
.nav-pro-item.logout-pro:hover {
  background-color: #fef2f2 !important;
}

/* Tarjetas clicables (fuentes RAG, etc.) — Bootstrap no define .cursor-pointer por defecto */
.cursor-pointer {
  cursor: pointer;
}

.btn-source-pdf {
  cursor: pointer;
}

/* Checkboxes: borde más visible que el gris por defecto de Bootstrap */
.form-check-input {
  border: 1.5px solid #64748b;
}
.form-check-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(11, 58, 91, 0.18);
}
.form-check-input:checked {
  border-color: var(--bs-primary);
  background-color: var(--bs-primary);
}
.form-check-input:disabled {
  border-color: #cbd5e1;
  opacity: 0.65;
}

/* Modal de pregunta unificado (showAppQuestionModal) */
.app-question-modal .modal-content {
  border-radius: 20px;
}
.app-question-modal__accent {
  height: 4px;
  background: var(--primary-gradient);
}
.app-question-modal__icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(11, 58, 91, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-question-modal__icon {
  font-size: 1.35rem;
  color: var(--primary-color);
}
.app-question-modal__body {
  font-size: 0.95rem;
  line-height: 1.55;
}
.app-question-modal .modal-footer .btn {
  min-width: 7rem;
}

