/**
 * compat.css - CRM U3 Company
 * Mapeamento de classes Bootstrap para o nosso design system
 * Garante compatibilidade sem precisar reescrever o código JS
 */

/* Bootstrap compatibility layer */

/* Display utilities */
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* Flex utilities */
.flex-wrap { flex-wrap: wrap !important; }
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-1 { flex: 1 !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.align-middle { vertical-align: middle; }
.ms-auto { margin-left: auto !important; }
.me-auto { margin-right: auto !important; }

/* Gap utilities */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-5 { gap: 1.25rem !important; }

/* Spacing */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.5rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.ps-2 { padding-left: 0.5rem !important; }
.pe-2 { padding-right: 0.5rem !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 1.5rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-5 { margin-top: 1.5rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 0.75rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 0.75rem !important; }

/* Text */
.text-center { text-align: center !important; }
.text-start { text-align: left !important; }
.text-end { text-align: right !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-dark { color: var(--dark) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-white { color: white !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }
.small { font-size: 0.875rem !important; }
.text-nowrap { white-space: nowrap; }

/* Width/height */
.w-100 { width: 100% !important; }
.w-50 { width: 50% !important; }
.w-auto { width: auto !important; }
.h-100 { height: 100% !important; }
.mw-100 { max-width: 100% !important; }
.min-vh-100 { min-height: 100vh !important; }

/* Border radius */
.rounded { border-radius: var(--radius-md) !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: 999px !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

/* Border */
.border { border: 1px solid var(--border) !important; }
.border-0 { border: none !important; }

/* Shadow */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Background */
.bg-white { background-color: white !important; }
.bg-light { background-color: #F8F8F8 !important; }
.bg-dark { background-color: var(--dark) !important; }
.bg-warning { background-color: var(--primary) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-danger { background-color: var(--danger) !important; }
.bg-transparent { background-color: transparent !important; }

/* Form select (Bootstrap form-select → nosso form-control) */
.form-select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: white;
  color: var(--dark);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,246,0,0.2);
}

/* Table Bootstrap classes */
.table-responsive { overflow-x: auto; }
.table-hover tbody tr:hover { background-color: #FFFDF0; }
.table-light { background-color: #F8F8F8; }
.table-striped tbody tr:nth-child(even) { background-color: #FAFAFA; }
.table-bordered th, .table-bordered td { border: 1px solid var(--border); }

/* Badge Bootstrap */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.bg-success.badge, .badge.bg-success { background: #DCFCE7 !important; color: #166534 !important; }
.bg-warning.badge, .badge.bg-warning { background: #FEF3C7 !important; color: #92400E !important; }
.bg-danger.badge, .badge.bg-danger { background: #FEE2E2 !important; color: #991B1B !important; }
.bg-info.badge, .badge.bg-info { background: #DBEAFE !important; color: #1E40AF !important; }
.bg-secondary.badge, .badge.bg-secondary { background: #F3F4F6 !important; color: #374151 !important; }
.bg-primary.badge, .badge.bg-primary { background: #FFF600 !important; color: #222 !important; }

/* Card Bootstrap */
.card-footer { background-color: #FAFAFA; border-top: 1px solid var(--border); padding: 12px 20px; }

/* Input group */
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; }
.input-group .input-group-text {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: #F8F8F8;
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-secondary);
}
.input-group .form-control:not(:first-child) {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: none;
}
.border-end-0 { border-right: none !important; }
.border-start-0 { border-left: none !important; }

/* Spinner Bootstrap */
.spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 0.15em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.spinner-border-sm { width: 0.85rem; height: 0.85rem; }
.me-2 { margin-right: 0.5rem; }

/* Nav tabs Bootstrap */
.nav-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 4px; }
.nav-tabs .nav-link {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  text-decoration: none;
}
.nav-tabs .nav-link:hover { color: var(--dark); }
.nav-tabs .nav-link.active { color: var(--dark); border-bottom-color: var(--primary); background: rgba(255,246,0,0.08); font-weight: 600; }
.tab-content > .tab-pane { display: none; }
.tab-content > .tab-pane.active, .tab-content > .tab-pane.show { display: block; }

/* Alert Bootstrap */
.alert { padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid; margin-bottom: 16px; }
.alert-warning { background: #FEF3C7; border-color: #F59E0B; color: #92400E; }
.alert-danger { background: #FEE2E2; border-color: var(--danger); color: #991B1B; }
.alert-success { background: #DCFCE7; border-color: var(--success); color: #166534; }
.alert-info { background: #DBEAFE; border-color: var(--info); color: #1E40AF; }

/* Overflow hidden */
.overflow-hidden { overflow: hidden !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Position */
.position-relative { position: relative; }
.position-absolute { position: absolute; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Object fit */
.object-fit-cover { object-fit: cover; }

/* Width 4 (Lucide icon size utility) */
.w-4 { width: 16px !important; }
.h-4 { height: 16px !important; }
.w-3 { width: 12px !important; }
.h-3 { height: 12px !important; }
.d-inline { display: inline; }
