﻿@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --font-ui: 'Manrope', 'Segoe UI', sans-serif;
  --text-main: #1e293b;
  --text-soft: #64748b;
}

body {
  font-family: var(--font-ui);
  color: var(--text-main);
  min-height: 100vh;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.topbar {
  border-bottom: 1px solid #e9edf3;
}

.topbar .navbar-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.topbar-icon-btn:hover {
  background: #eef2f7;
  color: #475569;
}

.topbar-search {
  width: 300px;
}

.topbar-search .form-control {
  background: #eef2f7;
  border-color: transparent;
  border-radius: 8px;
  padding-left: 38px;
  min-height: 38px;
  color: #64748b;
}

.topbar-search .search-widget-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
}

.topbar-actions {
  color: #64748b;
}

.topbar-notify {
  position: relative;
}

.topbar-notify-wrap {
  position: relative;
}

.topbar-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 4px;
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  overflow: hidden;
  border: 2px solid #eef2f7;
}

.topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 280px;
  background: #ffffff;
  border: 1px solid #e8edf3;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  z-index: 2000;
  overflow: hidden;
}

.topbar-dropdown-title {
  font-weight: 700;
  color: #475569;
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
}

.topbar-dropdown-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #64748b;
  padding: 10px 14px;
  font-weight: 600;
}

.topbar-dropdown-item:hover {
  background: #f8fafc;
  color: #334155;
}

.topbar-profile-menu {
  position: relative;
}

.profile-menu-toggle {
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 250px;
  background: #ffffff;
  border: 1px solid #e8edf3;
  border-radius: 0;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  z-index: 2000;
  overflow: hidden;
}

.profile-dropdown-head {
  padding: 14px 16px 10px;
  color: #475569;
  font-weight: 700;
  border-bottom: 1px solid #eef2f7;
}

.profile-dropdown-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.profile-dropdown-item i {
  font-size: 18px;
}

.profile-dropdown-item:hover {
  background: #f8fafc;
  color: #334155;
}

.profile-dropdown-divider {
  height: 1px;
  background: #eef2f7;
  margin: 4px 0;
}

.profile-dropdown-item.danger {
  color: #ef4444;
}

.profile-dropdown-item.danger:hover {
  background: #fff1f2;
  color: #dc2626;
}

.api-config-hidden {
  display: none !important;
}

.iaclub-brand {
  color: #ffffff;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}

.iaclub-user {
  color: #0f172a;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 6px 10px;
}

.page-title-head {
  margin-bottom: 20px;
}

.theme-toolbar-card {
  border: 1px solid #e8edf3;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.theme-toolbar-card .card-body {
  padding: 14px 18px;
}

.theme-toolbar-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.theme-toolbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 280px;
  flex: 1;
}

.theme-toolbar-search {
  position: relative;
  width: min(100%, 360px);
}

.theme-toolbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
}

.theme-toolbar-search .form-control {
  min-height: 40px;
  border-radius: 8px;
  background: #f1f5f9;
  border-color: #e5ebf2;
  padding-left: 38px;
}

.theme-toolbar-context {
  color: #475569;
  font-weight: 600;
}

.theme-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-title-head h4,
.card-title,
h5,
h4 {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.menu-title {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.navbar-nav .nav-text,
.sub-nav-link {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.main-nav .menu-arrow .nav-text {
  color: #f8fafc;
}

.integration-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
}

#mainTabs .sub-nav-link {
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b7c3d8;
  padding: 10px 14px;
  border-radius: 8px;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.22s ease, color 0.22s ease;
}

#mainTabs .sub-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(4px);
}

#mainTabs .sub-nav-link.active {
  font-weight: 700;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

#mainTabs .sub-nav-link:focus {
  outline: none;
  box-shadow: none;
}

.integration-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9fb0c8;
  padding: 10px 14px;
  border-radius: 8px;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), color 0.22s ease, background-color 0.22s ease;
}

.integration-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(4px);
}

.nav-item-icon {
  width: 18px;
  text-align: center;
  font-size: 17px;
  opacity: 0.9;
}

.logo-box {
  overflow: hidden;
}

/* Sidebar collapsed state fixes */
html[data-sidenav-size="small"] .iaclub-brand,
html[data-sidenav-size="small-hover"] .iaclub-brand,
html[data-sidenav-size="small-hover-active"] .iaclub-brand,
html[data-sidenav-size="condensed"] .iaclub-brand {
  opacity: 0 !important;
  visibility: hidden !important;
  width: 0 !important;
}

html[data-sidenav-size="small"] .main-nav .nav-item-icon,
html[data-sidenav-size="small-hover"] .main-nav .nav-item-icon,
html[data-sidenav-size="small-hover-active"] .main-nav .nav-item-icon,
html[data-sidenav-size="condensed"] .main-nav .nav-item-icon {
  width: 24px;
  font-size: 22px;
}

/* Theme-like look for Knowledge Blocks section */
#tab-bloques .card {
  border: 1px solid #e8edf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#tab-bloques .card-header {
  background: #ffffff;
  border-bottom: 1px solid #edf2f7;
  padding: 16px 20px;
}

#tab-bloques .card-body {
  padding: 18px 20px;
}

#tab-bloques .form-control,
#tab-bloques .form-select {
  min-height: 42px;
  border-color: #dbe3ec;
}

#tab-bloques textarea.form-control {
  min-height: 110px;
}

#tab-bloques .table {
  margin-bottom: 0;
}

#tab-bloques .table thead th {
  background: #ffffff;
  color: #3b4a63;
  font-weight: 600;
  border-bottom: 1px solid #e8edf3;
  padding-top: 14px;
  padding-bottom: 14px;
}

#tab-bloques .table tbody td {
  padding-top: 14px;
  padding-bottom: 14px;
  vertical-align: middle;
}

/* Match Empresa tab with Bloques visual language */
#tab-empresa .card {
  border: 1px solid #e8edf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#tab-empresa .card-header {
  background: #ffffff;
  border-bottom: 1px solid #edf2f7;
  padding: 16px 20px;
}

#tab-empresa .card-body {
  padding: 18px 20px;
}

#tab-empresa .form-label {
  font-weight: 600;
  color: #51637d;
  margin-bottom: 6px;
}

#tab-empresa .form-control,
#tab-empresa .form-select {
  min-height: 42px;
  border-color: #dbe3ec;
  background-color: #f8fafc;
}

#tab-empresa textarea.form-control {
  min-height: 105px;
  line-height: 1.45;
}

#tab-empresa .extra-section-title {
  font-weight: 700;
  color: #334155;
}

#tab-empresa .btn[type="submit"].btn-primary {
  min-height: 42px;
  font-weight: 700;
}

/* Match Pruebas tab with Bloques visual language */
#tab-pruebas .card {
  border: 1px solid #e8edf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#tab-pruebas .card-header {
  background: #ffffff;
  border-bottom: 1px solid #edf2f7;
  padding: 16px 20px;
}

#tab-pruebas .card-body {
  padding: 18px 20px;
}

#tab-pruebas .form-control,
#tab-pruebas .form-select {
  min-height: 42px;
  border-color: #dbe3ec;
  background-color: #f8fafc;
}

#tab-pruebas .btn.btn-primary {
  min-height: 42px;
  font-weight: 700;
}

#tab-pruebas .quick-msg {
  border-radius: 8px;
  font-weight: 600;
}

#tab-pruebas .chat-history {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  min-height: 320px;
}

/* Apply Bloques-like style to all main tabs requested */
#tab-dashboard .card,
#tab-clientes .card,
#tab-planes .card,
#tab-logs .card,
#tab-integraciones .card,
#tab-configuracion .card {
  border: 1px solid #e8edf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#tab-clientes .card-header,
#tab-planes .card-header,
#tab-logs .card-header,
#tab-integraciones .card-header,
#tab-configuracion .card-header {
  background: #ffffff;
  border-bottom: 1px solid #edf2f7;
  padding: 16px 20px;
}

#tab-clientes .card-body,
#tab-planes .card-body,
#tab-logs .card-body,
#tab-integraciones .card-body,
#tab-configuracion .card-body {
  padding: 18px 20px;
}

#tab-clientes .form-control,
#tab-clientes .form-select,
#tab-planes .form-control,
#tab-planes .form-select,
#tab-logs .form-control,
#tab-logs .form-select,
#tab-integraciones .form-control,
#tab-integraciones .form-select,
#tab-configuracion .form-control,
#tab-configuracion .form-select {
  min-height: 42px;
  border-color: #dbe3ec;
  background-color: #f8fafc;
}

#tab-integraciones .dicloak-card {
  border-radius: 14px;
}

#tab-integraciones .card-title {
  color: #1e293b;
  font-weight: 800;
  letter-spacing: 0.01em;
}

#tab-integraciones .dicloak-subtitle {
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

#tab-integraciones .dicloak-toggle {
  background: linear-gradient(135deg, #f8fbff 0%, #f1f7ff 100%);
  border: 1px solid #d7e5f8;
  border-radius: 12px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#tab-integraciones .dicloak-toggle .form-check-input {
  margin-top: 0;
  width: 18px;
  height: 18px;
}

#tab-integraciones .dicloak-toggle .form-check-label {
  margin: 0;
  color: #334155;
  font-weight: 700;
}

#tab-integraciones .form-label {
  margin-bottom: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#tab-integraciones .form-control:focus {
  border-color: #7ca6f5;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

#tab-integraciones .dicloak-status {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 12px;
}

#tab-integraciones .dicloak-status.text-bg-success {
  background: #16a34a !important;
}

#tab-integraciones .dicloak-status.text-bg-secondary {
  background: #64748b !important;
}

#tab-integraciones .dicloak-save-btn,
#tab-integraciones .dicloak-test-btn {
  min-height: 44px;
  font-weight: 800;
  border-radius: 10px;
}

#tab-integraciones .dicloak-command-hint {
  border: 1px dashed #b6c7de;
  background: #f8fbff;
  color: #334155;
  font-weight: 700;
}

#tab-integraciones .dicloak-command-hint:hover {
  background: #eef5ff;
  border-color: #95b1d8;
}

#tab-integraciones .dicloak-test-result {
  min-height: 84px;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #dce6f3;
  border-radius: 10px;
  background: #f8fafc;
}

@media (max-width: 767.98px) {
  #tab-integraciones .dicloak-toggle {
    width: 100%;
    justify-content: center;
  }
}

#tab-clientes .table,
#tab-planes .table,
#tab-logs .table,
#tab-configuracion .table {
  margin-bottom: 0;
}

#tab-clientes .table thead th,
#tab-planes .table thead th,
#tab-logs .table thead th,
#tab-configuracion .table thead th {
  background: #ffffff;
  color: #3b4a63;
  font-weight: 600;
  border-bottom: 1px solid #e8edf3;
  padding-top: 14px;
  padding-bottom: 14px;
}

#tab-clientes .table tbody td,
#tab-planes .table tbody td,
#tab-logs .table tbody td,
#tab-configuracion .table tbody td {
  padding-top: 14px;
  padding-bottom: 14px;
  vertical-align: middle;
}

#tab-dashboard .widget-icon-box .card-body {
  padding: 18px 20px;
}

.table thead th {
  font-weight: 700;
  font-size: 13px;
  color: #475569;
  letter-spacing: 0.02em;
}

.table tbody td {
  font-weight: 500;
}

.form-control,
.form-select,
.btn {
  font-weight: 600;
}

.text-muted {
  color: var(--text-soft) !important;
}

.login-page {
  min-height: 100vh;
  background: radial-gradient(circle at 10% 20%, #dbeafe 0%, #eff6ff 40%, #f8fafc 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(470px, 100%);
  background: #ffffff;
  border: 1px solid #e8edf3;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #1d4ed8;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.login-card h1 {
  margin: 0 0 4px 0;
  font-size: 28px;
  line-height: 1.2;
  color: #151717;
  font-weight: 800;
}

.login-subtitle {
  margin: 0 0 14px 0;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.flex-column > label {
  color: #151717;
  font-weight: 600;
  color: #334155;
  font-size: 14px;
}

.inputForm {
  border: 1.5px solid #ecedec;
  border-radius: 10px;
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  transition: 0.2s ease-in-out;
  color: #64748b;
}

.input {
  margin-left: 10px;
  border-radius: 10px;
  border: none;
  width: 100%;
  height: 100%;
  color: #1e293b;
  font-weight: 600;
}

.input:focus {
  outline: none;
}

.inputForm:focus-within {
  border: 1.5px solid #2d79f3;
}

.flex-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.flex-row > div {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.flex-row > div > label {
  font-size: 14px;
  color: #111827;
  font-weight: 500;
}

.span {
  font-size: 13px;
  margin-left: 5px;
  color: #2d79f3;
  font-weight: 600;
}

.button-submit {
  margin: 14px 0 6px 0;
  background-color: #151717;
  border: none;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  height: 50px;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.button-submit:hover {
  background-color: #0f1111;
}

.button-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.login-error {
  margin-top: 4px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
}

.bot-trap {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.tab-section {
  animation: fadeIn 220ms ease;
}

.chat-history {
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
}

.chat-msg {
  max-width: 78%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.3;
  white-space: pre-wrap;
}

.chat-msg.user {
  margin-left: auto;
  background: #dbeafe;
}

.chat-msg.bot {
  margin-right: auto;
  background: #e2e8f0;
}

.chat-meta {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}

.extra-blocks {
  border: 1px solid #e8edf3;
  border-radius: 10px;
  padding: 14px;
  background: #ffffff;
}

.extra-block-item {
  background: #fdfdff;
  border: 1px solid #e8edf3;
  border-radius: 10px;
  padding: 12px;
}

.extra-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.extra-block-label {
  font-weight: 700;
  color: #334155;
}

.extra-block-text {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
}

.categories-list .category-row .input-group-text {
  min-width: 48px;
  justify-content: center;
}

.categories-list .category-input {
  text-transform: uppercase;
}

#knowledgeBlockEditModal input.form-control,
#knowledgeBlockEditModal textarea.form-control,
#knowledgeBlockEditModal select.form-select {
  background-color: #f8fafc;
}

#knowledgeBlockEditModal .form-select,
#knowledgeBlockEditModal .form-select:focus {
  background-color: #f8fafc !important;
  --bs-form-select-bg: #f8fafc;
  font-weight: 700;
  box-shadow: none;
}

#knowledgeBlockEditModal .form-select option {
  font-weight: 700;
}

@media (max-width: 991px) {
  .topbar-search {
    width: 220px;
  }

  .theme-toolbar-left {
    min-width: 100%;
  }

  .theme-toolbar-search {
    width: 100%;
    max-width: none;
  }
}

/* Hide sections requested by user */
#tab-bloques > .card.mb-3 {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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