:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 64px;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-main: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active-bg: #1e293b;
  --sidebar-active-text: #38bdf8;
  --card-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: #1e293b;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Dashboard App Layout */
#app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1040;
  overflow-x: hidden;
}

#sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

#sidebar.collapsed .brand-text,
#sidebar.collapsed .nav-category,
#sidebar.collapsed .sidebar-menu .nav-link span {
  display: none;
}

/* Expansión suave al pasar el mouse por encima cuando está colapsado */
#sidebar.collapsed:hover {
  width: var(--sidebar-width);
  box-shadow: 6px 0 25px rgba(0, 0, 0, 0.35);
}

#sidebar.collapsed:hover .brand-text,
#sidebar.collapsed:hover .nav-category,
#sidebar.collapsed:hover .sidebar-menu .nav-link span {
  display: inline-block !important;
}

#sidebar.collapsed:hover .nav-category {
  display: block !important;
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f8fafc;
}

.brand-icon {
  font-size: 1.5rem;
  color: #38bdf8;
}

.brand-text {
  font-size: 1rem;
  line-height: 1.2;
}

.sidebar-menu {
  padding: 16px 12px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
  width: 5px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.nav-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 12px 12px 6px;
  font-weight: 600;
}

#sidebar.collapsed .nav-category {
  display: none;
}

.sidebar-menu .nav-link {
  color: var(--sidebar-text);
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 500;
  font-size: 0.925rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-bottom: 2px;
  text-decoration: none;
}

.sidebar-menu .nav-link:hover {
  background-color: #1e293b;
  color: #f8fafc;
}

.sidebar-menu .nav-link.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left: 3px solid var(--sidebar-active-text);
}

.sidebar-menu .nav-link i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

#sidebar.collapsed .sidebar-menu .nav-link span {
  display: none;
}

/* Main Content Area */
#main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-main);
}

/* Topbar */
#topbar {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.page-content {
  padding: 24px;
  flex-grow: 1;
}

/* Custom Table Utilities */
.table-hover tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.6);
}

.kanban-col {
  min-height: 480px;
  border-radius: 8px;
}

.task-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

.task-card {
  cursor: grab;
}

.task-card:active {
  cursor: grabbing;
}

.task-card-ghost {
  opacity: 0.35;
  border: 2px dashed #0d6efd !important;
  background-color: rgba(13, 110, 253, 0.08) !important;
}

.task-card-chosen,
.task-card-dragging {
  transform: rotate(1deg) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18) !important;
}

.task-card-saving {
  opacity: 0.65;
  pointer-events: none;
}

.kanban-col.sortable-ghost,
.kanban-col:has(.task-card-ghost) {
  background-color: rgba(13, 110, 253, 0.04);
}

/* Dynamic Alert Badges */
.badge-overdue { background-color: #dc3545; color: #ffffff; }
.badge-urgent { background-color: #fd7e14; color: #ffffff; }
.badge-important { background-color: #ffc107; color: #000000; }
.badge-info { background-color: #0d6efd; color: #ffffff; }
.badge-normal { background-color: #198754; color: #ffffff; }

/* Fix Bootstrap Dropdowns in DataTables */
.card, .card-body {
  overflow: visible !important;
}

.table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.table .dropdown-menu {
  z-index: 1060 !important;
}

/* Ensure clean single-line formatting for dates and table cells */
.table th, .table td, .datatable th, .datatable td {
  white-space: nowrap !important;
  vertical-align: middle;
}

/* Column Resizer Handle (Excel Style) */
.column-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
  height: 100%;
  z-index: 10;
  border-right: 2px solid transparent;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.column-resizer:hover, .column-resizer.resizing {
  border-right-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.15);
}

/* Cintillo / Marquee de Tareas Pendientes en Curso */
.tasks-ticker-wrapper {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  overflow: hidden;
  height: 38px;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.tasks-ticker-badge {
  flex-shrink: 0;
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  background: #0f172a;
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 5;
  box-shadow: 2px 0 6px rgba(0,0,0,0.1);
  white-space: nowrap;
}

.tasks-ticker-content {
  flex-grow: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent);
}

.tasks-ticker-track {
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  will-change: transform;
  animation: tasksTickerMove 30s linear infinite;
}

.tasks-ticker-wrapper:hover .tasks-ticker-track {
  animation-play-state: paused;
}

@keyframes tasksTickerMove {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.tasks-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font-size: 0.78rem;
  color: #334155;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.tasks-ticker-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0284c7;
  transform: translateY(-1px);
}

