/* === Base === */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* === Nav Links (Sidebar) === */
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 500;
  color: #94a3b8; text-decoration: none; transition: all 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #ffffff; }
.nav-link.active { background: rgba(14,165,233,0.15); color: #38bdf8; }

/* === Mobile Bottom Nav === */
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; flex: 1; text-decoration: none; color: #64748b;
  font-size: 10px; font-weight: 500; padding: 6px 4px; transition: color 0.15s;
}
.mobile-nav-item i { font-size: 18px; }
.mobile-nav-item.active, .mobile-nav-item:hover { color: #38bdf8; }
.mobile-nav-fab {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 14px; background: #0ea5e9;
  color: white; margin-bottom: 10px; box-shadow: 0 4px 12px rgba(14,165,233,0.4);
  text-decoration: none; transition: transform 0.15s, box-shadow 0.15s;
}
.mobile-nav-fab:hover { transform: scale(1.05); box-shadow: 0 6px 16px rgba(14,165,233,0.5); }

/* === Form Elements === */
.form-label { display: block; font-size: 12px; font-weight: 500; color: #64748b; margin-bottom: 4px; }
.dark .form-label { color: #94a3b8; }

.form-input {
  display: block; width: 100%; padding: 8px 12px; font-size: 13px;
  border: 1px solid #e2e8f0; border-radius: 10px; background: #ffffff;
  color: #1e293b; transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
.form-input:focus { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,0.12); }
.dark .form-input { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: #e2e8f0; }
.dark .form-input:focus { border-color: #38bdf8; }
.form-input::placeholder { color: #94a3b8; }

/* === Buttons === */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; background: #0ea5e9; color: white; font-weight: 600;
  font-size: 13px; border-radius: 10px; border: none; cursor: pointer;
  text-decoration: none; transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(14,165,233,0.25);
}
.btn-primary:hover { background: #0284c7; box-shadow: 0 4px 12px rgba(14,165,233,0.35); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; background: #f1f5f9; color: #475569; font-weight: 600;
  font-size: 13px; border-radius: 10px; border: 1px solid #e2e8f0; cursor: pointer;
  text-decoration: none; transition: background 0.15s;
}
.btn-secondary:hover { background: #e2e8f0; }
.dark .btn-secondary { background: rgba(255,255,255,0.08); color: #94a3b8; border-color: rgba(255,255,255,0.12); }
.dark .btn-secondary:hover { background: rgba(255,255,255,0.12); }

.btn-danger { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; background: #ef4444; color: white; font-weight: 600; font-size: 13px; border-radius: 10px; border: none; cursor: pointer; text-decoration: none; transition: background 0.15s; }
.btn-danger:hover { background: #dc2626; }

.btn-success-sm { display: inline-flex; align-items: center; padding: 4px 10px; background: #10b981; color: white; font-size: 11px; font-weight: 600; border-radius: 7px; border: none; cursor: pointer; transition: background 0.15s; }
.btn-success-sm:hover { background: #059669; }

.btn-danger-sm { display: inline-flex; align-items: center; padding: 4px 10px; background: #ef4444; color: white; font-size: 11px; font-weight: 600; border-radius: 7px; border: none; cursor: pointer; transition: background 0.15s; }
.btn-danger-sm:hover { background: #dc2626; }

.btn-primary-sm { display: inline-flex; align-items: center; padding: 4px 10px; background: #0ea5e9; color: white; font-size: 11px; font-weight: 600; border-radius: 7px; border: none; cursor: pointer; transition: background 0.15s; }
.btn-primary-sm:hover { background: #0284c7; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; background: transparent;
  border: none; cursor: pointer; color: #64748b; transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.icon-btn:hover { background: #f1f5f9; color: #1e293b; }
.dark .icon-btn:hover { background: rgba(255,255,255,0.08); color: #e2e8f0; }

/* === Badges === */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef9c3; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.dark .badge-success  { background: rgba(16,185,129,0.2); color: #34d399; }
.dark .badge-warning  { background: rgba(245,158,11,0.2); color: #fbbf24; }
.dark .badge-danger   { background: rgba(239,68,68,0.2);  color: #f87171; }
.dark .badge-info     { background: rgba(59,130,246,0.2); color: #60a5fa; }
.dark .badge-secondary{ background: rgba(255,255,255,0.08); color: #94a3b8; }

/* === Pagination === */
.pagination-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; font-size: 12px;
  font-weight: 500; border: 1px solid #e2e8f0; background: white; color: #475569;
  text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
.pagination-btn:hover { background: #f8fafc; border-color: #0ea5e9; color: #0ea5e9; }
.pagination-btn.active { background: #0ea5e9; border-color: #0ea5e9; color: white; }
.dark .pagination-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #94a3b8; }
.dark .pagination-btn:hover { background: rgba(255,255,255,0.1); border-color: #38bdf8; color: #38bdf8; }
.dark .pagination-btn.active { background: #0ea5e9; border-color: #0ea5e9; color: white; }

/* === Animations === */
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.animate-slideIn { animation: slideIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-card { animation: fadeIn 0.4s ease; }

/* === Stat cards hover === */
.stat-card { transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.08); }
.dark .stat-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.3); }

/* === Quick Action Cards === */
.quick-action-card { transform: translateY(0); transition: transform 0.2s, box-shadow 0.2s; }
.quick-action-card:hover { transform: translateY(-3px); }

/* === Safe area — iOS notch & Android cutout === */
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }
.safe-top    { padding-top:    env(safe-area-inset-top, 0); }

/* Sticky page header: grows taller to clear the status bar */
header.sticky {
  padding-top: env(safe-area-inset-top, 0) !important;
  height: calc(3.5rem + env(safe-area-inset-top, 0)) !important;
  min-height: calc(3.5rem + env(safe-area-inset-top, 0));
}

/* Toast container: always below the status bar notch */
#toast-container {
  top: max(1rem, calc(env(safe-area-inset-top, 0) + 0.5rem)) !important;
  right: max(1rem, env(safe-area-inset-right, 0)) !important;
}

/* Pull-to-refresh indicator */
#ptr-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9980;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 0;
  overflow: hidden;
  transition: height 0.15s ease;
  background: linear-gradient(to bottom, rgba(14,165,233,0.15), transparent);
  padding-top: env(safe-area-inset-top, 0);
}
#ptr-indicator .ptr-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #0ea5e9;
  color: white;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(14,165,233,0.4);
  transition: transform 0.2s;
}
#ptr-indicator.ptr-ready .ptr-icon {
  transform: rotate(180deg);
}
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}
#ptr-indicator.ptr-loading .ptr-icon i {
  animation: ptr-spin 0.7s linear infinite;
}

/* Sidebar logo row: push down on phones with notch */
#sidebar .safe-top {
  padding-top: calc(1.25rem + env(safe-area-inset-top, 0)) !important;
}

/* Sidebar itself: left safe area (landscape notch) */
#sidebar {
  padding-left: env(safe-area-inset-left, 0);
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

/* === Dark glass === */
.glass { background: rgba(255,255,255,0.05); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.1); }
