/* ============================================
   NEX Design System — Premium SaaS
   Inspired by Linear, Stripe, Vercel
   ============================================ */

/* --- CSS Variables / Tokens --- */
:root {
  --nex-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Light Mode (default) */
  --nex-bg: #fafafa;
  --nex-surface: #ffffff;
  --nex-surface-raised: #ffffff;
  --nex-border: #e5e5e5;
  --nex-border-subtle: #f0f0f0;
  --nex-text: #0a0a0a;
  --nex-text-secondary: #737373;
  --nex-text-tertiary: #a3a3a3;
  
  --nex-primary: #6366f1;
  --nex-primary-hover: #4f46e5;
  --nex-primary-soft: rgba(99,102,241,0.08);
  --nex-primary-text: #ffffff;
  
  --nex-success: #10b981;
  --nex-success-soft: rgba(16,185,129,0.08);
  --nex-warning: #f59e0b;
  --nex-warning-soft: rgba(245,158,11,0.08);
  --nex-danger: #ef4444;
  --nex-danger-soft: rgba(239,68,68,0.08);
  
  --nex-sidebar-bg: #0f0f12;
  --nex-sidebar-text: #a1a1aa;
  --nex-sidebar-text-active: #ffffff;
  --nex-sidebar-hover: rgba(255,255,255,0.05);
  --nex-sidebar-active-bg: rgba(99,102,241,0.15);
  --nex-sidebar-width: 260px;
  --nex-sidebar-collapsed: 72px;
  
  --nex-topbar-height: 60px;
  --nex-radius-sm: 8px;
  --nex-radius-md: 12px;
  --nex-radius-lg: 16px;
  --nex-radius-xl: 24px;
  --nex-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --nex-shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --nex-shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --nex-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-theme="dark"] {
  --nex-bg: #09090b;
  --nex-surface: #141416;
  --nex-surface-raised: #1c1c1f;
  --nex-border: #27272a;
  --nex-border-subtle: #1e1e21;
  --nex-text: #fafafa;
  --nex-text-secondary: #a1a1aa;
  --nex-text-tertiary: #71717a;
  
  --nex-primary: #818cf8;
  --nex-primary-hover: #6366f1;
  --nex-primary-soft: rgba(129,140,248,0.12);
  
  --nex-success: #34d399;
  --nex-success-soft: rgba(52,211,153,0.12);
  --nex-warning: #fbbf24;
  --nex-warning-soft: rgba(251,191,36,0.12);
  --nex-danger: #f87171;
  --nex-danger-soft: rgba(248,113,113,0.12);
  
  --nex-sidebar-bg: #09090b;
  --nex-shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --nex-shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --nex-shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  
  /* Dark mode improvements */
  img { opacity: 0.9; }
  .nex-vehicle-img { opacity: 0.95; }
  .nex-card { box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
}

/* --- Reset & Global --- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--nex-font) !important;
  background: var(--nex-bg) !important;
  color: var(--nex-text) !important;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Override AdminLTE Wrapper --- */
.nex-app { display: flex; min-height: 100vh; }

/* ============================
   SIDEBAR
   ============================ */
.nex-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nex-sidebar-width);
  background: var(--nex-sidebar-bg);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width var(--nex-transition), transform var(--nex-transition);
  overflow: hidden;
}

.nex-sidebar-brand {
  display: flex;
  align-items: center;
  padding: 20px 20px 16px;
  gap: 12px;
  text-decoration: none !important;
}

.nex-sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--nex-primary), #a78bfa);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.nex-sidebar-brand .brand-text {
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
  transition: opacity var(--nex-transition), transform var(--nex-transition);
  line-height: 1;
}

.nex-sidebar-brand .brand-info {
  display: flex;
  flex-direction: column;
  transition: opacity var(--nex-transition);
}

.nex-sidebar-brand .brand-tagline {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--nex-primary);
  font-weight: 700;
  opacity: 0.8;
  margin-top: 2px;
}

/* Collapsed Sidebar Styles */
.nex-sidebar.collapsed {
  width: var(--nex-sidebar-collapsed);
}

.nex-sidebar.collapsed .brand-text,
.nex-sidebar.collapsed .brand-tagline,
.nex-sidebar.collapsed .brand-info,
.nex-sidebar.collapsed .nex-nav-item span,
.nex-sidebar.collapsed .nex-nav-item .nex-nav-badge,
.nex-sidebar.collapsed .nex-nav-section-title,
.nex-sidebar.collapsed .nex-sidebar-footer span {
  display: none;
}

.nex-sidebar.collapsed .nex-sidebar-brand {
  justify-content: center;
  padding: 20px 0;
}

.nex-sidebar.collapsed .nex-nav-item {
  justify-content: center;
  padding: 12px;
}

.nex-sidebar.collapsed .nex-nav-item .nav-icon {
  margin: 0;
  font-size: 18px;
}

.nex-sidebar.collapsed .nex-sidebar-footer {
  text-align: center;
}

.nex-sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nex-nav-section {
  margin-bottom: 8px;
}

.nex-nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--nex-sidebar-text);
  opacity: 0.5;
  padding: 16px 12px 8px;
}

.nex-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--nex-radius-sm);
  color: var(--nex-sidebar-text);
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--nex-transition);
  position: relative;
  margin-bottom: 2px;
}

.nex-nav-item:hover {
  background: var(--nex-sidebar-hover);
  color: var(--nex-sidebar-text-active);
}

.nex-nav-item.active {
  background: var(--nex-sidebar-active-bg);
  color: var(--nex-primary);
}

.nex-nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nex-nav-item.active .nav-icon { opacity: 1; }

.nex-nav-badge {
  margin-left: auto;
  background: var(--nex-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nex-sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ============================
   TOPBAR
   ============================ */
.nex-topbar {
  position: fixed;
  top: 0;
  left: var(--nex-sidebar-width);
  right: 0;
  height: var(--nex-topbar-height);
  background: var(--nex-surface);
  border-bottom: 1px solid var(--nex-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1030;
  transition: left var(--nex-transition), background var(--nex-transition), backdrop-filter var(--nex-transition);
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.8);
}

.nex-topbar.collapsed {
  left: var(--nex-sidebar-collapsed);
}

[data-theme="dark"] .nex-topbar {
  background: rgba(20,20,22,0.8);
}

.nex-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nex-topbar-toggle {
  background: none;
  border: none;
  color: var(--nex-text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--nex-radius-sm);
  transition: all var(--nex-transition);
  display: none;
}

.nex-topbar-toggle:hover {
  background: var(--nex-primary-soft);
  color: var(--nex-primary);
}

.nex-topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--nex-text);
}

.nex-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nex-topbar-btn {
  background: none;
  border: none;
  color: var(--nex-text-secondary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--nex-radius-sm);
  transition: all var(--nex-transition);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nex-topbar-btn:hover {
  background: var(--nex-primary-soft);
  color: var(--nex-primary);
}

.nex-theme-toggle {
  background: none;
  border: 1px solid var(--nex-border);
  color: var(--nex-text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--nex-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--nex-transition);
}

.nex-theme-toggle:hover {
  border-color: var(--nex-primary);
  color: var(--nex-primary);
}

.nex-user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--nex-radius-sm);
  cursor: pointer;
  transition: all var(--nex-transition);
  border: none;
  background: none;
  color: var(--nex-text);
  position: relative;
}

.nex-user-menu:hover { background: var(--nex-primary-soft); }

.nex-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nex-primary), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.nex-user-name {
  font-size: 13px;
  font-weight: 500;
}

/* ============================
   MAIN CONTENT
   ============================ */
.nex-main {
  margin-left: var(--nex-sidebar-width);
  margin-top: var(--nex-topbar-height);
  min-height: calc(100vh - var(--nex-topbar-height));
  padding: 32px;
  transition: all var(--nex-transition);
  width: calc(100% - var(--nex-sidebar-width));
}

.nex-main.collapsed {
  margin-left: var(--nex-sidebar-collapsed);
  width: calc(100% - var(--nex-sidebar-collapsed));
}

.nex-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.nex-page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--nex-text);
  margin: 0;
}

.nex-page-subtitle {
  font-size: 14px;
  color: var(--nex-text-secondary);
  margin: 4px 0 0;
}

/* ============================
   CARDS
   ============================ */
.nex-card {
  background: var(--nex-surface);
  border: 1px solid var(--nex-border);
  border-radius: var(--nex-radius-md);
  overflow: hidden;
  transition: all var(--nex-transition);
}

.nex-card:hover {
  border-color: var(--nex-primary);
  box-shadow: var(--nex-shadow-md);
}

.nex-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--nex-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nex-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--nex-text);
  margin: 0;
}

.nex-card-body { padding: 24px; }
.nex-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--nex-border);
  background: var(--nex-bg);
}

/* ============================
   STAT CARDS
   ============================ */
.nex-stat-card {
  background: var(--nex-surface);
  border: 1px solid var(--nex-border);
  border-radius: var(--nex-radius-md);
  padding: 24px;
  transition: all var(--nex-transition);
}

.nex-stat-card:hover {
  border-color: var(--nex-primary);
  box-shadow: var(--nex-shadow-md);
  transform: translateY(-2px);
}

.nex-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--nex-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 16px;
}

.nex-stat-icon.primary { background: var(--nex-primary-soft); color: var(--nex-primary); }
.nex-stat-icon.success { background: var(--nex-success-soft); color: var(--nex-success); }
.nex-stat-icon.warning { background: var(--nex-warning-soft); color: var(--nex-warning); }
.nex-stat-icon.danger  { background: var(--nex-danger-soft);  color: var(--nex-danger); }

.nex-stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--nex-text);
  line-height: 1;
  margin-bottom: 4px;
}

.nex-stat-label {
  font-size: 13px;
  color: var(--nex-text-secondary);
  font-weight: 500;
}

.nex-stat-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--nex-border);
}

.nex-stat-link {
  font-size: 13px;
  color: var(--nex-primary);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap var(--nex-transition);
}

.nex-stat-link:hover { gap: 10px; color: var(--nex-primary-hover); }

/* ============================
   BUTTONS
   ============================ */
.nex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--nex-radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--nex-font);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--nex-transition);
  text-decoration: none !important;
  line-height: 1.4;
  white-space: nowrap;
}

.nex-btn:active { transform: scale(0.97); }

.nex-btn-primary {
  background: var(--nex-primary);
  color: var(--nex-primary-text);
}
.nex-btn-primary:hover {
  background: var(--nex-primary-hover);
  color: var(--nex-primary-text);
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.nex-btn-secondary {
  background: var(--nex-surface);
  color: var(--nex-text);
  border-color: var(--nex-border);
}
.nex-btn-secondary:hover {
  background: var(--nex-bg);
  border-color: var(--nex-text-tertiary);
  color: var(--nex-text);
}

.nex-btn-danger {
  background: var(--nex-danger-soft);
  color: var(--nex-danger);
  border-color: transparent;
}
.nex-btn-danger:hover {
  background: var(--nex-danger);
  color: #fff;
}

.nex-btn-ghost {
  background: transparent;
  color: var(--nex-text-secondary);
}
.nex-btn-ghost:hover {
  background: var(--nex-primary-soft);
  color: var(--nex-primary);
}

.nex-btn-sm { padding: 6px 14px; font-size: 13px; }
.nex-btn-lg { padding: 14px 28px; font-size: 16px; }
.nex-btn-icon { padding: 10px; }

/* ============================
   INPUTS
   ============================ */
.nex-input-group { margin-bottom: 20px; }

.nex-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--nex-text);
  margin-bottom: 6px;
}

.nex-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--nex-border);
  border-radius: var(--nex-radius-sm);
  background: var(--nex-surface);
  color: var(--nex-text);
  font-size: 14px;
  font-family: var(--nex-font);
  transition: all var(--nex-transition);
  outline: none;
}

.nex-input::placeholder { color: var(--nex-text-tertiary); }

.nex-input:focus {
  border-color: var(--nex-primary);
  box-shadow: 0 0 0 3px var(--nex-primary-soft);
}

.nex-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23737373' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================
   TABLES
   ============================ */
.nex-table {
  width: 100%;
  border-collapse: collapse;
}

.nex-table thead th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--nex-text-secondary);
  padding: 12px 16px;
  border-bottom: 1px solid var(--nex-border);
  text-align: left;
  background: var(--nex-bg);
}

.nex-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--nex-border-subtle);
  font-size: 14px;
  color: var(--nex-text);
  vertical-align: middle;
}

.nex-table tbody tr {
  transition: background var(--nex-transition);
}

.nex-table tbody tr:hover {
  background: var(--nex-primary-soft);
}

.nex-table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================
   BADGES
   ============================ */
.nex-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.nex-badge-primary { background: var(--nex-primary-soft); color: var(--nex-primary); }
.nex-badge-success { background: var(--nex-success-soft); color: var(--nex-success); }
.nex-badge-warning { background: var(--nex-warning-soft); color: var(--nex-warning); }
.nex-badge-danger  { background: var(--nex-danger-soft);  color: var(--nex-danger); }
.nex-badge-neutral { background: var(--nex-border); color: var(--nex-text-secondary); }

/* ============================
   ALERTS / TOASTS
   ============================ */
.nex-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--nex-radius-md);
  font-size: 14px;
  margin-bottom: 24px;
  border: 1px solid;
  animation: nex-slideDown 300ms ease-out;
}

.nex-alert-success {
  background: var(--nex-success-soft);
  border-color: var(--nex-success);
  color: var(--nex-success);
}
.nex-alert-danger {
  background: var(--nex-danger-soft);
  border-color: var(--nex-danger);
  color: var(--nex-danger);
}
.nex-alert-warning {
  background: var(--nex-warning-soft);
  border-color: var(--nex-warning);
  color: var(--nex-warning);
}

.nex-alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: 18px;
  color: inherit;
  padding: 0;
  line-height: 1;
}
.nex-alert-close:hover { opacity: 1; }

/* ============================
   VEHICLE CARDS (Grid)
   ============================ */
.nex-vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.nex-vehicle-card {
  background: var(--nex-surface);
  border: 1px solid var(--nex-border);
  border-radius: var(--nex-radius-md);
  overflow: hidden;
  transition: all var(--nex-transition);
  text-decoration: none !important;
  color: var(--nex-text) !important;
  display: flex;
  flex-direction: column;
}

.nex-vehicle-card:hover {
  border-color: var(--nex-primary);
  box-shadow: var(--nex-shadow-lg);
  transform: translateY(-4px);
}

.nex-vehicle-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.nex-vehicle-img-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--nex-border) 0%, var(--nex-bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nex-text-tertiary);
  font-size: 48px;
}

.nex-vehicle-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.nex-vehicle-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--nex-text);
}

.nex-vehicle-version {
  font-size: 13px;
  color: var(--nex-text-secondary);
  margin-bottom: 12px;
  min-height: 20px;
}

.nex-vehicle-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.nex-vehicle-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--nex-text-secondary);
  margin-top: auto;
}

.nex-vehicle-meta i { font-size: 12px; }

.nex-vehicle-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--nex-border);
  display: flex;
  gap: 8px;
}

/* ============================
   EMPTY STATE
   ============================ */
.nex-empty {
  text-align: center;
  padding: 64px 24px;
}

.nex-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--nex-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 32px;
  color: var(--nex-primary);
}

.nex-empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--nex-text);
}

.nex-empty-text {
  font-size: 14px;
  color: var(--nex-text-secondary);
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================
   DROPDOWN
   ============================ */
.nex-dropdown {
  position: relative;
  display: inline-block;
}

.nex-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--nex-surface);
  border: 1px solid var(--nex-border);
  border-radius: var(--nex-radius-md);
  box-shadow: var(--nex-shadow-lg);
  padding: 6px;
  z-index: 1050;
  display: none;
  animation: nex-fadeIn 150ms ease-out;
}

.nex-dropdown-menu.show { display: block; }

.nex-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--nex-radius-sm);
  font-size: 14px;
  color: var(--nex-text);
  text-decoration: none !important;
  transition: all var(--nex-transition);
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  font-family: var(--nex-font);
}

.nex-dropdown-item:hover {
  background: var(--nex-primary-soft);
  color: var(--nex-primary);
}

.nex-dropdown-divider {
  height: 1px;
  background: var(--nex-border);
  margin: 4px 0;
}

/* ============================
   PAGINATION
   ============================ */
.nex-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.nex-pagination nav {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Reset the <ul> from Laravel paginator */
.nex-pagination nav > div {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nex-pagination ul,
.nex-pagination nav ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center;
  gap: 4px;
}

.nex-pagination li,
.nex-pagination nav li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.nex-pagination li::before,
.nex-pagination nav li::before {
  display: none !important;
  content: none !important;
}

.nex-pagination li a,
.nex-pagination li span,
.nex-pagination nav li a,
.nex-pagination nav li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--nex-radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none !important;
  transition: all var(--nex-transition);
  border: 1px solid var(--nex-border);
  color: var(--nex-text-secondary);
  background: var(--nex-surface);
}

.nex-pagination li a:hover,
.nex-pagination nav li a:hover {
  border-color: var(--nex-primary);
  color: var(--nex-primary);
  background: var(--nex-primary-soft);
}

/* Active page */
.nex-pagination li.active span,
.nex-pagination li span[aria-current="page"],
.nex-pagination nav li.active span,
.nex-pagination nav li span[aria-current="page"] {
  background: var(--nex-primary) !important;
  color: #fff !important;
  border-color: var(--nex-primary) !important;
}

/* Disabled state (prev/next when at start/end) */
.nex-pagination li.disabled span,
.nex-pagination li span[aria-disabled="true"],
.nex-pagination nav li.disabled span,
.nex-pagination nav li span[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
}

/* Hide the "Showing X to Y of Z results" text from Tailwind paginator */
.nex-pagination nav > div:first-child {
  display: none !important;
}

.nex-pagination nav > div:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Also handle simple paginator that uses p-* classes */
.nex-pagination p {
  display: none !important;
}

/* SVG icons inside pagination buttons */
.nex-pagination svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ============================
   FOOTER
   ============================ */
.nex-footer {
  padding: 24px 32px;
  border-top: 1px solid var(--nex-border);
  font-size: 13px;
  color: var(--nex-text-tertiary);
  text-align: center;
  margin-top: auto;
}

/* ============================
   ANIMATIONS
   ============================ */
@keyframes nex-fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes nex-slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes nex-scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Card entrance animation */
.nex-animate-in {
  animation: nex-fadeIn 400ms ease-out both;
}

.nex-animate-in:nth-child(2) { animation-delay: 50ms; }
.nex-animate-in:nth-child(3) { animation-delay: 100ms; }
.nex-animate-in:nth-child(4) { animation-delay: 150ms; }
.nex-animate-in:nth-child(5) { animation-delay: 200ms; }
.nex-animate-in:nth-child(6) { animation-delay: 250ms; }

/* ============================
   SKELETON LOADING
   ============================ */
.nex-skeleton {
  background: linear-gradient(90deg, var(--nex-border) 25%, var(--nex-bg) 50%, var(--nex-border) 75%);
  background-size: 200% 100%;
  animation: nex-shimmer 1.5s infinite;
  border-radius: var(--nex-radius-sm);
}

@keyframes nex-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 1024px) {
  .nex-sidebar {
    transform: translateX(-100%);
  }
  .nex-sidebar.open { transform: translateX(0); }
  
  .nex-main {
    margin-left: 0;
    width: 100%;
    padding: 24px 16px;
  }
  
  .nex-topbar {
    left: 0;
  }
  
  .nex-topbar-toggle { display: flex; }
  
  .nex-vehicle-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 640px) {
  .nex-page-title { font-size: 20px; }
  .nex-stat-value { font-size: 24px; }
  .nex-main { padding: 16px 12px; }
  .nex-vehicle-grid { grid-template-columns: 1fr; }
}

/* Backdrop for sidebar mobile */
.nex-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1035;
  display: none;
  backdrop-filter: blur(4px);
}

.nex-sidebar-backdrop.show { display: block; }

/* ============================
   GRID HELPERS
   ============================ */
.nex-grid { display: grid; gap: 20px; }
.nex-grid-2 { grid-template-columns: repeat(2, 1fr); }
.nex-grid-3 { grid-template-columns: repeat(3, 1fr); }
.nex-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .nex-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nex-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .nex-grid-4, .nex-grid-3, .nex-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Utility */
.nex-flex { display: flex; }
.nex-flex-center { display: flex; align-items: center; }
.nex-flex-between { display: flex; align-items: center; justify-content: space-between; }
.nex-gap-sm { gap: 8px; }
.nex-gap-md { gap: 16px; }
.nex-gap-lg { gap: 24px; }
.nex-mt-sm { margin-top: 8px; }
.nex-mt-md { margin-top: 16px; }
.nex-mt-lg { margin-top: 32px; }
.nex-mb-sm { margin-bottom: 8px; }
.nex-mb-md { margin-bottom: 16px; }
.nex-mb-lg { margin-bottom: 32px; }

/* ============================
   FOOTER
   ============================ */
.nex-footer {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--nex-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--nex-text-tertiary);
}

.nex-footer a {
  color: var(--nex-primary);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--nex-transition);
}

.nex-footer a:hover {
  color: var(--nex-primary-hover);
}

@media (max-width: 768px) {
  .nex-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */
@media (max-width: 640px) {
  /* Base font */
  body { font-size: 13px; }
  
  /* Page */
  .nex-page-header { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px 12px; }
  .nex-page-title { font-size: 18px; font-weight: 700; }
  .nex-page-subtitle { font-size: 12px; }
  
  /* Cards */
  .nex-card { border-radius: 12px; margin-bottom: 12px; }
  .nex-card-body { padding: 12px; }
  .nex-card-title { font-size: 14px; }
  .nex-card-header { padding: 12px; flex-wrap: wrap; gap: 8px; }
  
  /* Stats */
  .nex-stats { gap: 12px; }
  .nex-stat { padding: 12px; min-width: calc(50% - 6px); }
  .nex-stat-value { font-size: 20px; }
  .nex-stat-label { font-size: 10px; }
  
  /* Buttons */
  .nex-btn { padding: 10px 14px; font-size: 12px; border-radius: 8px; }
  .nex-btn-lg { padding: 12px 18px; font-size: 14px; }
  .nex-btn-sm { padding: 6px 10px; font-size: 11px; }
  
  /* Forms */
  .nex-input { padding: 10px 12px; font-size: 13px; border-radius: 8px; }
  .nex-label { font-size: 12px; font-weight: 600; }
  .nex-input-group { margin-bottom: 14px; }
  
  /* Topbar */
  .nex-topbar { padding: 12px; }
  .nex-topbar-title { font-size: 14px; font-weight: 600; }
  .nex-user-name { display: none; }
  
  /* Vehicle Grid */
  .nex-vehicle-grid { gap: 12px; }
  .nex-vehicle-card { padding: 12px; }
  .nex-vehicle-name { font-size: 14px; }
  .nex-vehicle-meta { font-size: 11px; }
  
  /* Alerts */
  .nex-alert { padding: 10px 12px; font-size: 12px; border-radius: 8px; }
  .nex-alert-title { font-size: 13px; }
  
  /* Badges */
  .nex-badge { font-size: 10px; padding: 3px 8px; border-radius: 6px; }
  
  /* Grid */
  .nex-grid-2, .nex-grid-3, .nex-grid-4 { grid-template-columns: 1fr; }
  
  /* Tables */
  .nex-table { font-size: 11px; }
  .nex-table th, .nex-table td { padding: 8px 6px; }
  
  /* Modal */
  .nex-modal { margin: 12px; max-width: calc(100% - 24px); border-radius: 12px; }
  .nex-modal-header { padding: 14px; }
  .nex-modal-body { padding: 14px; }
  .nex-modal-title { font-size: 16px; }
  
  /* Pagination */
  .pagination { gap: 4px; }
  .page-link { padding: 6px 10px; font-size: 12px; }
  
  /* Sidebar */
  .nex-sidebar { width: 280px; }
  .nex-sidebar-brand { padding: 16px; }
  .nex-sidebar-nav a { padding: 12px 16px; font-size: 13px; }
  .nex-sidebar-nav i { width: 20px; font-size: 14px; }
  
  /* FAB */
  .nex-fab { width: 52px; height: 52px; font-size: 20px; bottom: 20px; right: 20px; }
  
  /* Vehicle Show */
  .vehicle-hero { padding: 24px 16px; }
  .vehicle-hero-name { font-size: 20px; }
  .vehicle-hero-placa { font-size: 14px; padding: 6px 12px; }
  
  /* Prevent horizontal scroll */
  html, body { overflow-x: hidden; max-width: 100vw; }
  
  /* Touch improvements */
  a, button, input, select, textarea { min-height: 44px; }
  a, button { min-width: 44px; }
  
  /* Images */
  img { max-width: 100%; height: auto; }
  
  /* Hide on mobile */
  .hide-mobile { display: none !important; }
}

/* Very small screens */
@media (max-width: 380px) {
  .nex-main { padding: 12px 8px; }
  .nex-page-header { padding: 12px 8px; }
  .nex-stat { min-width: 100%; }
}

/* Mobile topbar adjustments */
@media (max-width: 640px) {
  .nex-topbar { padding: 10px 12px; }
  .nex-topbar-left { gap: 8px; }
  .nex-topbar-right { gap: 8px; }
  .nex-topbar-toggle, .nex-theme-toggle, .nex-notification-bell {
    width: 36px !important;
    height: 36px !important;
    padding: 6px !important;
  }
  .nex-theme-toggle i, .nex-notification-bell i { font-size: 14px !important; }
  .nex-user-avatar { width: 28px !important; height: 28px !important; font-size: 12px !important; }
  
  /* Touch-friendly form elements */
  .nex-input, .nex-select, .nex-textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
    height: 44px;
    padding: 10px 12px;
  }
  
  /* Better scrolling */
  .nex-card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Vehicle list adjustments */
  .vehicle-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  /* Icon sizes */
  .nex-card-title i { font-size: 14px; }
  
  /* Dropdown on mobile */
  .nex-dropdown-menu {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 16px 16px 0 0;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  /* SVG circle adjustments */
  svg[viewBox="0 0 36 36"] {
    width: 60px;
    height: 60px;
  }
  
  /* Prevent overflow */
  .nex-container {
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  /* Vehicle detail page */
  .vehicle-hero {
    padding: 20px 12px;
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .vehicle-hero-name { font-size: 18px; }
  .vehicle-hero-placa { font-size: 16px; }
  .vehicle-hero-status { font-size: 11px; }
  
  /* Stats on mobile */
  .cost-center-stats {
    grid-template-columns: 1fr !important;
  }
  
  /* Checklist */
  .checklist-grid {
    grid-template-columns: 1fr;
  }
  
  /* Mobile grid overrides */
  .mobile-grid-3 {
    grid-template-columns: 1fr !important;
  }
  
  /* Force no horizontal scroll */
  html, body, .nex-main, .nex-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  /* Mobile table fix */
  .nex-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .nex-table thead, .nex-table tbody, .nex-table th, .nex-table td, .nex-table tr {
    display: block;
  }
  .nex-table thead {
    display: none;
  }
  .nex-table tr {
    border: 1px solid var(--nex-border);
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--nex-surface);
  }
  .nex-table td {
    padding: 6px 8px;
    border: none;
    text-align: left;
    font-size: 12px;
  }
  .nex-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--nex-text-tertiary);
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 2px;
  }
}
