/* ───────────── Azul oscuro profesional ───────────── */

:root {
  --primary: #1e3a5f;
  --primary-dark: #14304e;
  --primary-light: #2c5282;
  --primary-lighter: #3b6cb7;
  --primary-gradient: linear-gradient(135deg, #1e3a5f, #14304e);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --gray-body: #f2f4f8;
}

body {
  background-color: var(--gray-body);
}

/* ───────────── SB Admin 2 color overrides ───────────── */

/* Sidebar */
.sidebar, .bg-gradient-primary {
  background: var(--primary-gradient) !important;
}
.sidebar .nav-item .nav-link {
  color: rgba(255,255,255,.7) !important;
}
.sidebar .nav-item .nav-link:hover {
  color: #fff !important;
}
.sidebar .nav-item.active .nav-link {
  color: #fff !important;
  font-weight: 600;
}

/* Primary color everywhere */
.text-primary, .btn-link { color: var(--primary) !important; }
a { color: var(--primary-light); }
a:hover { color: var(--primary-dark); }

.btn-primary {
  background: var(--primary-gradient) !important;
  border-color: var(--primary) !important;
  box-shadow: none !important;
}
.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(30,58,95,.3) !important;
  transform: translateY(-1px);
}
.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.btn-outline-primary:hover {
  background: var(--primary) !important;
  color: #fff !important;
}

.border-left-primary { border-left-color: var(--primary) !important; }
.border-left-success { border-left-color: var(--success) !important; }
.border-left-danger { border-left-color: var(--danger) !important; }
.border-left-warning { border-left-color: var(--warning) !important; }
.border-left-info { border-left-color: var(--info) !important; }

.badge-primary { background: var(--primary) !important; }
.badge-success { background: var(--success) !important; }
.badge-danger { background: var(--danger) !important; }
.badge-warning { background: var(--warning) !important; color: #1f2937 !important; }
.badge-info { background: var(--info) !important; }

.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }
.bg-warning { background: var(--warning) !important; }
.bg-info { background: var(--info) !important; }

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

.progress-bar.bg-success { background: var(--success) !important; }
.progress-bar.bg-danger { background: var(--danger) !important; }
.progress-bar.bg-warning { background: var(--warning) !important; }
.progress-bar.bg-info { background: var(--info) !important; }

.btn-success {
  background: var(--success) !important;
  border-color: var(--success) !important;
}
.btn-danger {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
}
.btn-warning {
  background: var(--warning) !important;
  border-color: var(--warning) !important;
  color: #1f2937 !important;
}
.btn-info {
  background: var(--info) !important;
  border-color: var(--info) !important;
  color: #fff !important;
}

/* Navbar top */
.topbar { background: #fff !important; }
.topbar .dropdown-toggle { color: #4a5568 !important; }

/* DataTable pagination */
.page-item.active .page-link {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}
.page-link { color: var(--primary) !important; }

/* ───────────── Mobile App Layout ───────────── */

@media (max-width: 767.98px) {
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    display: flex;
    background: #fff;
    border-top: 1px solid #e3e6f0;
    box-shadow: 0 -2px 10px rgba(0,0,0,.08);
    padding: 4px 0;
    justify-content: space-around;
  }
  .mobile-bottom-nav a {
    flex: 1;
    text-align: center;
    color: #858796;
    font-size: 10px;
    text-decoration: none;
    padding: 4px 0;
    transition: color .2s;
  }
  .mobile-bottom-nav a i {
    display: block;
    font-size: 20px;
    margin-bottom: 2px;
  }
  .mobile-bottom-nav a.active,
  .mobile-bottom-nav a:active {
    color: var(--primary);
  }
  .mobile-bottom-nav a span {
    display: block;
    line-height: 1.1;
  }

  body { padding-bottom: 58px; }
  #wrapper #content-wrapper { padding-bottom: 0; }

  .sidebar { display: none !important; }
  .sidebar.toggled { display: flex !important; }
  .sidebar.toggled + * { margin-left: 0; }

  #wrapper #content-wrapper { margin-left: 0 !important; }
  .container-fluid { padding-left: 12px; padding-right: 12px; }

  .btn { padding: .5rem .85rem; font-size: .9rem; }
  .btn-sm { padding: .35rem .6rem; font-size: .8rem; }

  .card { border-radius: 12px; border: none; margin-bottom: .75rem; }
  .card .card-header { border-radius: 12px 12px 0 0; }
  .shadow { box-shadow: 0 1px 6px rgba(0,0,0,.08) !important; }

  .border-left-primary,
  .border-left-danger,
  .border-left-success,
  .border-left-warning,
  .border-left-info { border-left: 4px solid !important; }

  .table-responsive table:not(.no-mobile-card) thead { display: none; }
  .table-responsive table:not(.no-mobile-card) tbody tr {
    display: block;
    border: 1px solid #e3e6f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
  }
  .table-responsive table:not(.no-mobile-card) tbody tr td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    font-size: .85rem;
  }
  .table-responsive table:not(.no-mobile-card) tbody tr td[data-label]::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--primary);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-right: 8px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .table-responsive table:not(.no-mobile-card) tbody tr td:not([data-label]) {
    justify-content: center;
  }
  .table-responsive table:not(.no-mobile-card) tbody tr td:last-child {
    justify-content: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #f1f1f1;
    margin-top: 6px;
  }
  .table-responsive table:not(.no-mobile-card) tbody tr td:last-child::before { display: none; }
  .table-responsive table:not(.no-mobile-card) tbody tr td[colspan] { justify-content: center; padding: 12px; }
  .table-responsive table:not(.no-mobile-card) tbody tr td[colspan]::before { display: none; }
  .table-responsive table:not(.no-mobile-card) tbody tr td .badge,
  .table-responsive table:not(.no-mobile-card) tbody tr td .btn { white-space: nowrap; }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter { width: 100%; text-align: left; margin-bottom: 8px; }
  .dataTables_wrapper .dataTables_filter input { width: 100% !important; }

  .form-group { margin-bottom: .65rem; }
  .form-control { font-size: 16px; padding: .55rem .75rem; }
  select.form-control { font-size: 16px; }

  h1.h3 { font-size: 1.25rem; }
  .d-sm-flex.align-items-center { flex-direction: column; align-items: flex-start !important; gap: 8px; }
  .d-sm-flex.align-items-center .btn { width: 100%; }
  .d-sm-flex.align-items-center > div { width: 100%; display: flex; gap: 8px; }
  .d-sm-flex.align-items-center > div .btn { flex: 1; }

  form.mb-4.row { flex-direction: column; gap: 8px; }
  form.mb-4.row .col-auto { width: 100%; padding: 0 15px; }

  .progress { height: 24px !important; border-radius: 12px; }
  .progress .progress-bar { font-size: .75rem; line-height: 24px; }

  .table td, .table th { padding: .45rem; font-size: .8rem; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .container-fluid { padding-left: 16px; padding-right: 16px; }
  .sidebar { width: 160px !important; }
  .sidebar .nav-item .nav-link span { font-size: .75rem; }
  #wrapper #content-wrapper { margin-left: 160px !important; }
  .btn { padding: .45rem .7rem; }
}

@media (max-width: 400px) {
  .mobile-bottom-nav a { font-size: 9px; }
  .mobile-bottom-nav a i { font-size: 17px; }
  .btn { font-size: .8rem; padding: .4rem .6rem; }
}

/* ───────────── Touch ───────────── */
.btn, a, select, input, button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sidebar { transition: all .2s ease-in-out !important; }

/* ───────────── Professional Dashboard ───────────── */

.card.border-left-primary,
.card.border-left-danger,
.card.border-left-success,
.card.border-left-warning,
.card.border-left-info {
  transition: transform .15s ease, box-shadow .15s ease;
}
.card.border-left-primary:hover,
.card.border-left-danger:hover,
.card.border-left-success:hover,
.card.border-left-warning:hover,
.card.border-left-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.1) !important;
}
.card-header { border-bottom: 1px solid rgba(0,0,0,.05); }
.card-header h6 { letter-spacing: .02em; }
.table tfoot td { border-top: 2px solid #dee2e6; font-size: .9rem; }
.thead-light th {
  text-transform: uppercase; font-size: .7rem; letter-spacing: .04em;
  color: #5a5c69; border-bottom: 2px solid #e3e6f0;
}
.card-header .badge { font-size: .7rem; padding: 4px 10px; border-radius: 20px; }
.card canvas { max-height: 320px; }
.font-weight-medium { font-weight: 600; }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: #f8f9fc; }

@media (max-width: 767.98px) {
  .card.border-left-primary:hover,
  .card.border-left-danger:hover,
  .card.border-left-success:hover,
  .card.border-left-warning:hover,
  .card.border-left-info:hover { transform: none; }
}
