/* ============================================================
   COMPONENTS
   Tables, buttons, cards, forms, badges, pagination
   ============================================================ */

/* ── Buttons ── */
.btn {
  border-radius: var(--vm-radius-sm);
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(1px); }

/* ── Cards ── */
.card-header {
  border-radius: 8px 8px 0 0 !important;
}

/* Only make overflow visible where explicitly needed for dropdowns */
.dropdown-overflow-fix { overflow: visible !important; }

/* ── Forms ── */
.form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.daterange-group { max-width: 325px; }

/* ── Tables & Responsive ── */
.table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.table { table-layout: auto; }
.table td, .table th { vertical-align: middle; }



.table-responsive .dropdown-menu.show {
  position: absolute;
  z-index: var(--vm-z-dropdown, 1050);
}

/* Ensures dropdown menus inside tables don't get clipped on mobile */
@media (max-width: 991.98px) {
  .table-responsive { padding-bottom: 80px; }
}

/* Modern Data Table Styling */
.table-responsive .table {
  border-collapse: separate;
  border-spacing: 0;
}
.table-responsive .table thead th {
  border-bottom: none;
  background-color: var(--bs-light);
  color: var(--bs-secondary-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 1rem;
}
.table-responsive .table tbody tr {
  transition: all var(--vm-trans-base);
}
.table-responsive .table tbody tr:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.05);
  box-shadow: inset 2px 0 0 0 var(--bs-primary);
}
.table-responsive .table td {
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

/* Custom Table Header (Alternating) */
.thead-themed, .thead-themed th {
  background-color: var(--bs-tertiary-bg) !important;
  color: var(--bs-secondary-color) !important;
  border-bottom: 2px solid var(--bs-border-color) !important;
}

/* ── Pagination ── */
.pagination .page-link {
  border: none;
  background-color: rgba(128, 128, 128, 0.15);
  color: var(--bs-body-color);
  min-width: 34px;
  text-align: center;
  font-weight: 600;
  transition: all var(--vm-trans-base);
}

.pagination .page-item.active .page-link {
  background-color: var(--bs-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.4);
}

.pagination .page-link:hover {
  background-color: rgba(13, 110, 253, 0.2);
  color: var(--bs-primary);
}

.pagination .page-item.disabled .page-link {
  background-color: rgba(128, 128, 128, 0.08);
  color: rgba(128, 128, 128, 0.4);
}

/* ── Badges ── */
.badge-xs {
  font-size: 0.65rem;
}

/* ── Avatar Profile ── */
.perfil-avatar-main {
  width: 150px;
  height: 150px;
  object-fit: cover;
}

.perfil-avatar-btn-main {
  bottom: 5px;
  right: 5px;
  width: 35px;
  height: 35px;
  padding: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   TABLE MODERNIZATION v2
   Premium row hover, stronger header, smoother transitions.
   Zero HTML changes required.
   ============================================================ */

/* ── Smooth row transitions ── */
.table-responsive .table tbody tr {
  transition: background-color var(--vm-trans-base), box-shadow var(--vm-trans-base) !important;
}

/* ── Row hover: left accent bar (visible inline indicator) ── */
.table-responsive .table tbody tr:hover {
  box-shadow: inset 3px 0 0 0 var(--bs-primary) !important;
}

/* ── Column padding consistency ── */
.table-responsive .table td:first-child,
.table-responsive .table th:first-child {
  padding-left: 1.5rem;
}
.table-responsive .table td:last-child,
.table-responsive .table th:last-child {
  padding-right: 1.5rem;
}

/* ── Thead: tighter font + stronger letter-spacing ── */
.table-responsive .table thead th {
  font-size: 0.72rem;
  letter-spacing: 0.9px;
  padding: 0.9rem 1rem;
  white-space: nowrap;
}

/* ── Thead-themed: premium glass-like header ── */
.thead-themed,
.thead-themed th {
  background: linear-gradient(
    180deg,
    rgba(var(--bs-body-bg-rgb, 248, 249, 250), 1) 0%,
    rgba(var(--bs-body-bg-rgb, 248, 249, 250), 0.85) 100%
  ) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 2px solid rgba(var(--bs-primary-rgb), 0.15) !important;
}

/* ── Table row typography ── */
.table-responsive .table td {
  font-size: 0.875rem;
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

/* ============================================================
   RESPONSIVE IMPROVEMENTS — Mobile First
   ============================================================ */

/* ─ Tables: tighter header on mobile ─ */
.tbl-col-check {
  width: 40px;
}

@media (max-width: 767.98px) {
  .table-responsive .table thead th {
    font-size: 0.68rem !important;
    padding: 0.6rem 0.5rem !important;
    letter-spacing: 0.4px !important;
  }
}

/* ─ Pagination: center & wrap on mobile ─ */
@media (max-width: 576px) {
  .pagination {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.2rem;
  }
  .pagination .page-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    min-width: 28px;
  }
  .record-count       { text-align: center; display: block; }
  .pagination-footer  {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0;
    gap: 0.5rem;
  }
}

/* ============================================================
   FORM RESPONSIVENESS — Mobile Polishing
   ============================================================ */

/* Card footer buttons: wrap & full-width on ≤480px */
@media (max-width: 480px) {
  .card-footer.d-flex.justify-content-end {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .card-footer.d-flex.justify-content-end .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* ─ Checkbox Visibility Fix (Light Mode) ─ */
[data-bs-theme="light"] .form-check-input {
  border-color: rgba(0, 0, 0, 0.45);
}

/* Card header: prevent icon+title overflow on very small screens */
@media (max-width: 480px) {
  .card-header h3.card-title,
  .card-header h5.card-title {
    font-size: 0.95rem !important;
    flex-wrap: wrap;
  }
  .card-header h3.card-title .saas-mini-icon-box,
  .card-header h5.card-title .saas-mini-icon-box {
    flex-shrink: 0;
  }
}

/* Input groups: keep prefix/suffix from wrapping on very small screens */
.img-preview-sm {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

.img-preview-lg {
  max-height: 250px;
  object-fit: contain;
}

.modal-dark-theme {
  background-color: #1e293b;
  border-radius: 12px;
}

.btn-back-circle {
  width: 32px; 
  height: 32px; 
  padding: 0; 
  line-height: 30px; 
  text-align: center;
}

.text-micro {
  font-size: 0.6rem;
}

.text-mini {
  font-size: 0.75rem; 
  letter-spacing: 1px;
}

.text-xs {
  font-size: 0.85rem;
}

.search-result-title {
  max-width: 250px; 
  font-size: 0.9rem;
}

.progress-mini {
  height: 6px; 
  width: 80px;
}

@media (max-width: 380px) {
  .input-group .input-group-text {
    padding: 0.375rem 0.5rem;
    font-size: 0.85rem;
  }
  .input-group .form-control,
  .input-group .form-select {
    min-width: 0;
  }
}

/* Compra/Venta create: ensure sidebar panel goes below on mobile */
@media (max-width: 991.98px) {
  /* The col-lg-4 sidebar stacks below the col-lg-8 product panel */
  .col-lg-8 + .col-lg-4 {
    margin-top: 1rem;
  }
}

/* ============================================================
   TOPBAR DROPDOWNS — Bulletproof Mobile Layout & Sizes
   ============================================================ */

/* Width boundaries for topbar dropdowns to prevent inline styles */
.topbar-dropdown-sucursal {
  min-width: 220px;
  max-width: min(280px, 90vw);
}

.topbar-dropdown-notif {
  min-width: 260px;
  max-width: min(360px, 92vw);
}

.topbar-dropdown-user {
  min-width: 240px;
  max-width: min(320px, 92vw);
}

@media (max-width: 575.98px) {
  .app-header .navbar-nav .nav-item.dropdown {
    position: static !important;
  }
  .app-header .navbar-nav .nav-item.dropdown .dropdown-menu {
    position: absolute !important;
    left: 10px !important;
    right: 10px !important;
    top: 100% !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
    margin-top: 5px !important;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15) !important;
  }
}

