/* ── Negocios – Custom Styles ─────────────────────────────────────────────── */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 0px;
  --theme-primary: var(--bs-primary);
  --theme-secondary: var(--bs-secondary-theme, var(--bs-secondary));
}

/* ── Theme color bindings ─────────────────────────────────────────────────── */

.btn-primary {
  --bs-btn-bg: var(--theme-primary);
  --bs-btn-border-color: var(--theme-primary);
  --bs-btn-hover-bg: var(--theme-primary);
  --bs-btn-hover-border-color: var(--theme-primary);
  --bs-btn-active-bg: var(--theme-primary);
  --bs-btn-active-border-color: var(--theme-primary);
  --bs-btn-disabled-bg: var(--theme-primary);
  --bs-btn-disabled-border-color: var(--theme-primary);
}

.btn-outline-primary {
  --bs-btn-color: var(--theme-primary);
  --bs-btn-border-color: var(--theme-primary);
  --bs-btn-hover-bg: var(--theme-primary);
  --bs-btn-hover-border-color: var(--theme-primary);
  --bs-btn-active-bg: var(--theme-primary);
  --bs-btn-active-border-color: var(--theme-primary);
  --bs-btn-disabled-color: var(--theme-primary);
}

.text-primary {
  color: var(--theme-primary) !important;
}

.bg-primary {
  background-color: var(--theme-primary) !important;
}

.border-primary {
  border-color: var(--theme-primary) !important;
}

.btn-success {
  --bs-btn-bg: var(--theme-secondary);
  --bs-btn-border-color: var(--theme-secondary);
  --bs-btn-hover-bg: var(--theme-secondary);
  --bs-btn-hover-border-color: var(--theme-secondary);
  --bs-btn-active-bg: var(--theme-secondary);
  --bs-btn-active-border-color: var(--theme-secondary);
  --bs-btn-disabled-bg: var(--theme-secondary);
  --bs-btn-disabled-border-color: var(--theme-secondary);
}

.btn-outline-success {
  --bs-btn-color: var(--theme-secondary);
  --bs-btn-border-color: var(--theme-secondary);
  --bs-btn-hover-bg: var(--theme-secondary);
  --bs-btn-hover-border-color: var(--theme-secondary);
  --bs-btn-active-bg: var(--theme-secondary);
  --bs-btn-active-border-color: var(--theme-secondary);
  --bs-btn-disabled-color: var(--theme-secondary);
}

.text-success {
  color: var(--theme-secondary) !important;
}

.bg-success {
  background-color: var(--theme-secondary) !important;
}

.border-success {
  border-color: var(--theme-secondary) !important;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

body {
  min-height: 100vh;
  background-color: #f4f6f9;
}

.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: all 0.3s ease;
  z-index: 1000;
}

#sidebar .sidebar-brand {
  padding: 1.25rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

#sidebar .nav-link {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  border-radius: 0.375rem;
  margin: 0.1rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background-color 0.15s ease;
}

#sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

#sidebar .nav-link.active {
  font-weight: 600;
}

#sidebar .nav-section-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.75rem 1.5rem 0.25rem;
  opacity: 0.55;
}

#sidebar .nav-section-toggle {
  width: calc(100% - 1rem);
  margin: 0.35rem 0.5rem 0.1rem;
  padding: 0.45rem 1rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}

#sidebar .nav-section-toggle:hover,
#sidebar .nav-section-toggle.active {
  background-color: rgba(255, 255, 255, 0.08);
  opacity: 1;
}

#sidebar .nav-section-toggle i {
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

#sidebar .nav-section-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

#sidebar .nav-link i {
  font-size: 1rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}

/* ── Main Content ─────────────────────────────────────────────────────────── */

#content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-header {
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.content-body {
  padding: 1.5rem;
  flex: 1;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */

.table-hover tbody tr:hover {
  background-color: color-mix(in srgb, var(--theme-primary) 6%, #fff);
}

.invoice-items-table {
  table-layout: fixed;
}

.invoice-items-table .invoice-col-date { width: 7.5rem; }
.invoice-items-table .invoice-col-type { width: 6.25rem; }
.invoice-items-table .invoice-col-description { width: auto; }
.invoice-items-table .invoice-col-qty { width: 6.5rem; }
.invoice-items-table .invoice-col-rate { width: 7.5rem; }
.invoice-items-table .invoice-col-total { width: 8rem; }

.invoice-items-table th,
.invoice-items-table td {
  vertical-align: middle;
}

.invoice-items-table th:not(:nth-child(3)),
.invoice-items-table td:not(:nth-child(3)) {
  white-space: nowrap;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
  border: 1px solid #e3e6ea;
  border-radius: 0.5rem;
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid #e3e6ea;
  font-weight: 600;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */

.badge-paid   { background-color: #198754; }
.badge-unpaid { background-color: #ffc107; color: #000; }
.badge-overdue{ background-color: #dc3545; }

/* ── Invoice print styles ─────────────────────────────────────────────────── */

@media print {
  #sidebar, .content-header, .no-print { display: none !important; }
  .content-body { padding: 0; }
  body { background: #fff; }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
  #sidebar {
    position: fixed;
    left: -100%;
    height: 100%;
    transition: left 0.3s ease;
    z-index: 1050;
  }

  #sidebar.show {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
  }

  .sidebar-overlay.show {
    display: block;
  }
}
