:root {
  --color-primary: #2563eb;
  --color-secondary: #60a5fa;
  --color-bg: #f8fafc;
  --color-text: #1e293b;
  --color-dark: #1e3a8a;
}

/* Global */
html, body {
  height: 100%;
}
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

/* Header degradado */
.topbar {
  background: linear-gradient(90deg, #2563eb, #60a5fa) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 1020;
}

/* Sidebar */
.sidebar {
  background: #fff !important;
  transition: transform .25s ease-in-out;
}
.sidebar .nav-link {
  border-radius: 10px;
  color: #334155;
  transition: all .2s ease-in-out;
}
.sidebar .nav-link:hover {
  background: #e0f2fe;
}
.sidebar .nav-link.active {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37,99,235,0.25);
}

.sidebar.collapsed {
  transform: translateX(-100%);
  position: fixed;
  left: 0;
  top: 64px;
  height: calc(100vh - 64px);
}

/* Cards modernas */
.card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  background: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

/* Botones redondeados con gradiente */
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
  border-radius: 10px;
  border: none;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
}
.btn-primary:hover {
  transform: scale(1.03);
  filter: brightness(1.05);
}

/* Inputs */
.form-control {
  border: 2px solid #dbeafe;
  border-radius: 12px;
}
.form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(37,99,235,0.25);
  border-color: #93c5fd;
}

/* Modales */
.modal-content {
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.modal-header {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
}
/* Transición suave del diálogo para evitar lag visual */
.modal.fade .modal-dialog { transition: transform 0.25s ease-out; }

/* Cotizaciones: secciones y usabilidad */
.cot-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.cot-items .d-flex h6 { font-weight: 600; }
.cot-item-textarea {
  min-height: 72px; /* ~3 líneas */
  line-height: 1.4;
  padding: 10px;
  resize: vertical;
}
.cot-items-table td { vertical-align: top; }
.cot-items-table tbody tr { border-top: 8px solid #f8f9fa; }
.cot-items-table tbody tr:first-child { border-top: none; }

/* DataTables */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 2px solid #dbeafe;
  border-radius: 10px;
}
table.dataTable {
  background: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
table.dataTable thead th {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
}
table.dataTable tbody tr:nth-child(odd) {
  background: #f9fafb;
}
table.dataTable tbody tr:hover {
  background: #e0f2fe;
}

/* Login moderno */
.login-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  padding: 24px;
}

/* Animaciones */
.fadeInUp {
  animation: fadeInUp .35s ease-out both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.shake {
  animation: shake .4s ease-in-out;
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* Scroll suave */
html { scroll-behavior: smooth; }

/* Loader overlay */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: grid;
  place-items: center;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5edff;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.footer {
  background: #fff;
}

/* Utilidades */
.soft-shadow { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.rounded-16 { border-radius: 16px; }
.rounded-12 { border-radius: 12px; }

/* Estilos de impresión unificados */
@media print {
  @page { size: A4; margin: 12mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #ffffff !important; margin: 0; }
  /* Ocultar navegación y elementos interactivos */
  .topbar, .sidebar, .footer, .navbar, .no-print,
  .btn, .btn-group,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_paginate,
  .dataTables_wrapper .dataTables_info { display: none !important; }
  /* Limpieza de contenedores y tarjetas */
  .card, .container, .container-fluid { box-shadow: none !important; background: #fff !important; }
  /* Tablas legibles al imprimir */
  table { border-collapse: collapse !important; page-break-inside: auto; }
  th, td { border: 1px solid #d1d5db; padding: 6px; }
  tr, img { page-break-inside: avoid; page-break-after: auto; }
}