/*
 * Sumaq Pacha — Paleta de colores personalizada
 * Primario:        #1f4d45 (verde andino)
 * Naranja andino:  #c65a2e
 * Amarillo andino: #c9a227
 * Blanco:          #ffffff
 */

/* ============================================
   LIGHT THEME
   ============================================ */
:root,
[data-bs-theme=light] {
  /* Bootstrap core */
  --bs-primary: #1f4d45;
  --bs-primary-rgb: 31, 77, 69;
  --bs-warning: #c65a2e;
  --bs-warning-rgb: 198, 90, 46;
  --bs-info: #c9a227;
  --bs-info-rgb: 201, 162, 39;

  /* Bootstrap emphasis */
  --bs-primary-text-emphasis: #0d1f1c;
  --bs-warning-text-emphasis: #4f2412;
  --bs-info-text-emphasis: #504110;

  /* Bootstrap subtle bg */
  --bs-primary-bg-subtle: #d2dfdd;
  --bs-warning-bg-subtle: #f4ddd4;
  --bs-info-bg-subtle: #f4ecd3;

  /* Bootstrap subtle border */
  --bs-primary-border-subtle: #a5c0bb;
  --bs-warning-border-subtle: #e9bba9;
  --bs-info-border-subtle: #e9d9a8;

  /* Link colors */
  --bs-link-color: #1f4d45;
  --bs-link-color-rgb: 31, 77, 69;
  --bs-link-hover-color: #163a33;
  --bs-link-hover-color-rgb: 22, 58, 51;

  /* Focus ring */
  --bs-focus-ring-color: rgba(31, 77, 69, 0.25);
}

/* Keenthemes extended variables — Light */
body[data-bs-theme=light],
body:not([data-bs-theme]) {
  --bs-primary: #1f4d45;
  --bs-primary-active: #163a33;
  --bs-primary-light: #e8f0ef;
  --bs-primary-inverse: #ffffff;
  --bs-primary-rgb: 31, 77, 69;
  --bs-text-primary: #1f4d45;

  --bs-warning: #c65a2e;
  --bs-warning-active: #a84a25;
  --bs-warning-light: #fdf0ea;
  --bs-warning-inverse: #ffffff;
  --bs-warning-rgb: 198, 90, 46;
  --bs-text-warning: #c65a2e;

  --bs-info: #c9a227;
  --bs-info-active: #b08e20;
  --bs-info-light: #fdf8e8;
  --bs-info-inverse: #ffffff;
  --bs-info-rgb: 201, 162, 39;
  --bs-text-info: #c9a227;

  /* Component active/hover */
  --bs-component-active-bg: #1f4d45;
  --bs-component-hover-color: #1f4d45;
  --bs-component-checked-bg: #1f4d45;

  /* Sidebar */
  --bs-app-sidebar-base-bg-color: #1f4d45;
  --bs-app-sidebar-minimize-bg-color: #1f4d45;
}

/* ============================================
   DARK THEME
   ============================================ */
[data-bs-theme=dark] {
  /* Bootstrap core */
  --bs-primary: #2d7a6e;
  --bs-primary-rgb: 45, 122, 110;
  --bs-warning: #d4764e;
  --bs-warning-rgb: 212, 118, 78;
  --bs-info: #d4b444;
  --bs-info-rgb: 212, 180, 68;

  /* Bootstrap emphasis */
  --bs-primary-text-emphasis: #6fbfb3;
  --bs-warning-text-emphasis: #e5a68c;
  --bs-info-text-emphasis: #e5d48c;

  /* Bootstrap subtle bg */
  --bs-primary-bg-subtle: #091916;
  --bs-warning-bg-subtle: #2a1810;
  --bs-info-bg-subtle: #2a2010;

  /* Bootstrap subtle border */
  --bs-primary-border-subtle: #1b4942;
  --bs-warning-border-subtle: #7f472f;
  --bs-info-border-subtle: #7f6117;

  /* Link colors */
  --bs-link-color: #2d7a6e;
  --bs-link-color-rgb: 45, 122, 110;
  --bs-link-hover-color: #3a9a8c;
  --bs-link-hover-color-rgb: 58, 154, 140;

  /* Keenthemes extended */
  --bs-primary-active: #3a9a8c;
  --bs-primary-light: #152c28;
  --bs-primary-inverse: #ffffff;
  --bs-text-primary: #2d7a6e;

  --bs-warning-active: #e0906c;
  --bs-warning-light: #2e1f18;
  --bs-warning-inverse: #ffffff;
  --bs-text-warning: #d4764e;

  --bs-info-active: #e0c862;
  --bs-info-light: #2e2818;
  --bs-info-inverse: #ffffff;
  --bs-text-info: #d4b444;

  /* Component active/hover */
  --bs-component-active-bg: #2d7a6e;
  --bs-component-hover-color: #2d7a6e;
  --bs-component-checked-bg: #2d7a6e;

  /* Sidebar */
  --bs-app-sidebar-base-bg-color: #0a1e1b;
  --bs-app-sidebar-minimize-bg-color: #0a1e1b;
}

/* ============================================
   BOOTSTRAP COMPONENT OVERRIDES
   (hardcoded colors that don't use CSS vars)
   ============================================ */

/* Buttons */
.btn-primary {
  --bs-btn-color: #ffffff;
  --bs-btn-bg: #1f4d45;
  --bs-btn-border-color: #1f4d45;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #163a33;
  --bs-btn-hover-border-color: #163a33;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #122e29;
  --bs-btn-active-border-color: #122e29;
  --bs-btn-disabled-color: #ffffff;
  --bs-btn-disabled-bg: #1f4d45;
  --bs-btn-disabled-border-color: #1f4d45;
}

.btn-outline-primary {
  --bs-btn-color: #1f4d45;
  --bs-btn-border-color: #1f4d45;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #1f4d45;
  --bs-btn-hover-border-color: #1f4d45;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #163a33;
  --bs-btn-active-border-color: #163a33;
  --bs-btn-disabled-color: #1f4d45;
  --bs-btn-disabled-border-color: #1f4d45;
}

.btn-warning {
  --bs-btn-color: #ffffff;
  --bs-btn-bg: #c65a2e;
  --bs-btn-border-color: #c65a2e;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #a84a25;
  --bs-btn-hover-border-color: #a84a25;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #8e3e1f;
  --bs-btn-active-border-color: #8e3e1f;
  --bs-btn-disabled-color: #ffffff;
  --bs-btn-disabled-bg: #c65a2e;
  --bs-btn-disabled-border-color: #c65a2e;
}

.btn-outline-warning {
  --bs-btn-color: #c65a2e;
  --bs-btn-border-color: #c65a2e;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #c65a2e;
  --bs-btn-hover-border-color: #c65a2e;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #a84a25;
  --bs-btn-active-border-color: #a84a25;
  --bs-btn-disabled-color: #c65a2e;
  --bs-btn-disabled-border-color: #c65a2e;
}

.btn-info {
  --bs-btn-color: #ffffff;
  --bs-btn-bg: #c9a227;
  --bs-btn-border-color: #c9a227;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #b08e20;
  --bs-btn-hover-border-color: #b08e20;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #97791b;
  --bs-btn-active-border-color: #97791b;
  --bs-btn-disabled-color: #ffffff;
  --bs-btn-disabled-bg: #c9a227;
  --bs-btn-disabled-border-color: #c9a227;
}

.btn-outline-info {
  --bs-btn-color: #c9a227;
  --bs-btn-border-color: #c9a227;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #c9a227;
  --bs-btn-hover-border-color: #c9a227;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #b08e20;
  --bs-btn-active-border-color: #b08e20;
  --bs-btn-disabled-color: #c9a227;
  --bs-btn-disabled-border-color: #c9a227;
}

/* Badges */
.badge.badge-primary,
.badge.bg-primary {
  background-color: #1f4d45 !important;
  color: #ffffff !important;
}

.badge.badge-light-primary {
  background-color: var(--bs-primary-light) !important;
  color: #1f4d45 !important;
}

.badge.badge-warning,
.badge.bg-warning {
  background-color: #c65a2e !important;
  color: #ffffff !important;
}

.badge.badge-light-warning {
  background-color: var(--bs-warning-light) !important;
  color: #c65a2e !important;
}

.badge.badge-info,
.badge.bg-info {
  background-color: #c9a227 !important;
  color: #ffffff !important;
}

.badge.badge-light-info {
  background-color: var(--bs-info-light) !important;
  color: #c9a227 !important;
}

/* Form controls focus */
.form-control:focus,
.form-select:focus {
  border-color: #1f4d45;
  box-shadow: 0 0 0 0.25rem rgba(31, 77, 69, 0.25);
}

.form-check-input:checked {
  background-color: #1f4d45;
  border-color: #1f4d45;
}

.form-check-input:focus {
  border-color: #1f4d45;
  box-shadow: 0 0 0 0.25rem rgba(31, 77, 69, 0.25);
}

.form-switch .form-check-input:checked {
  background-color: #1f4d45;
}

/* Nav / Tabs / Pills */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background-color: #1f4d45;
}

/* Pagination */
.page-item.active .page-link {
  background-color: #1f4d45;
  border-color: #1f4d45;
}

.page-link:hover {
  color: #1f4d45;
}

/* Progress */
.progress-bar {
  background-color: #1f4d45;
}

/* Sidebar menu — light mode: sidebar oscuro con texto blanco */
body[data-bs-theme=light] .app-sidebar,
body:not([data-bs-theme]) .app-sidebar {
  background-color: #1f4d45 !important;
}

body[data-bs-theme=light] .app-sidebar .menu-title,
body[data-bs-theme=light] .app-sidebar .menu-link .menu-title,
body:not([data-bs-theme]) .app-sidebar .menu-title,
body:not([data-bs-theme]) .app-sidebar .menu-link .menu-title {
  color: rgba(255, 255, 255, 0.85) !important;
}

body[data-bs-theme=light] .app-sidebar .menu-link:hover .menu-title,
body:not([data-bs-theme]) .app-sidebar .menu-link:hover .menu-title {
  color: #ffffff !important;
}

body[data-bs-theme=light] .app-sidebar .menu-link.active .menu-title,
body:not([data-bs-theme]) .app-sidebar .menu-link.active .menu-title {
  color: #ffffff !important;
}

body[data-bs-theme=light] .app-sidebar .menu-icon i,
body[data-bs-theme=light] .app-sidebar .menu-icon .ki-outline,
body:not([data-bs-theme]) .app-sidebar .menu-icon i,
body:not([data-bs-theme]) .app-sidebar .menu-icon .ki-outline {
  color: rgba(255, 255, 255, 0.65) !important;
}

body[data-bs-theme=light] .app-sidebar .menu-link:hover .menu-icon i,
body[data-bs-theme=light] .app-sidebar .menu-link:hover .menu-icon .ki-outline,
body:not([data-bs-theme]) .app-sidebar .menu-link:hover .menu-icon i,
body:not([data-bs-theme]) .app-sidebar .menu-link:hover .menu-icon .ki-outline {
  color: #ffffff !important;
}

body[data-bs-theme=light] .app-sidebar .menu-link.active .menu-icon i,
body[data-bs-theme=light] .app-sidebar .menu-link.active .menu-icon .ki-outline,
body:not([data-bs-theme]) .app-sidebar .menu-link.active .menu-icon i,
body:not([data-bs-theme]) .app-sidebar .menu-link.active .menu-icon .ki-outline {
  color: #c9a227 !important;
}

body[data-bs-theme=light] .app-sidebar .menu-arrow::after,
body:not([data-bs-theme]) .app-sidebar .menu-arrow::after {
  color: rgba(255, 255, 255, 0.5) !important;
}

body[data-bs-theme=light] .app-sidebar .menu-section .menu-heading,
body:not([data-bs-theme]) .app-sidebar .menu-section .menu-heading {
  color: rgba(255, 255, 255, 0.4) !important;
}

body[data-bs-theme=light] .app-sidebar .menu-link.active,
body:not([data-bs-theme]) .app-sidebar .menu-link.active {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body[data-bs-theme=light] .app-sidebar .menu-link:hover,
body:not([data-bs-theme]) .app-sidebar .menu-link:hover {
  background-color: rgba(255, 255, 255, 0.07) !important;
}

/* Sidebar logo area */
body[data-bs-theme=light] .app-sidebar .app-sidebar-logo,
body:not([data-bs-theme]) .app-sidebar .app-sidebar-logo {
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

/* Sidebar — dark mode */
[data-bs-theme=dark] .app-sidebar {
  background-color: #0a1e1b !important;
}

/* Scrollbar en sidebar */
.app-sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Alerts */
.alert-primary {
  --bs-alert-color: #1f4d45;
  --bs-alert-bg: #d2dfdd;
  --bs-alert-border-color: #a5c0bb;
  --bs-alert-link-color: #163a33;
}

.alert-warning {
  --bs-alert-color: #c65a2e;
  --bs-alert-bg: #f4ddd4;
  --bs-alert-border-color: #e9bba9;
  --bs-alert-link-color: #a84a25;
}

.alert-info {
  --bs-alert-color: #c9a227;
  --bs-alert-bg: #f4ecd3;
  --bs-alert-border-color: #e9d9a8;
  --bs-alert-link-color: #b08e20;
}

/* Spinner */
.spinner-border.text-primary {
  color: #1f4d45 !important;
}

/* List group */
.list-group-item.active {
  background-color: #1f4d45;
  border-color: #1f4d45;
}

/* Accordion */
.accordion-button:not(.collapsed) {
  color: #1f4d45;
  background-color: #e8f0ef;
}

.accordion-button:focus {
  border-color: #1f4d45;
  box-shadow: 0 0 0 0.25rem rgba(31, 77, 69, 0.25);
}

/* Selection / highlight */
::selection {
  background-color: rgba(31, 77, 69, 0.2);
}

/* Permitir que los dropdowns dentro de .table-responsive escapen del recorte
   vertical mientras están abiertos. .table-responsive usa overflow-x:auto, lo
   cual también recorta el eje Y por especificación CSS. */
.table-responsive:has(.dropdown-menu.show) {
  overflow: visible;
}
