/* MSU Tracker - Shared UX Styles */
:root {
  --nav-height: 56px;
  color-scheme: dark;
}

* { -webkit-tap-highlight-color: transparent; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Focus visible for keyboard nav */
:focus-visible {
  outline: 2px solid #34d399;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Smooth transitions */
a, button, input, select {
  transition-property: color, background-color, border-color, opacity, box-shadow, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-in-out;
}

/* Touch-friendly minimum sizes */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
select {
  min-height: 44px;
  font-size: 16px !important; /* Prevent iOS zoom */
}

button {
  min-height: 44px;
}

/* Mobile nav */
@media (max-width: 767px) {
  .nav-desktop { display: none !important; }
  .nav-hamburger { display: flex !important; }
}

@media (min-width: 768px) {
  .nav-hamburger { display: none !important; }
  .nav-mobile-menu { display: none !important; }
}

.nav-hamburger {
  display: none;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* Mobile menu overlay */
.nav-mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.nav-mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-mobile-menu .menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(280px, 85vw);
  height: 100%;
  background: #111827;
  border-left: 1px solid #1f2937;
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-mobile-menu.open .menu-panel {
  transform: translateX(0);
}

.nav-mobile-menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 15px;
  color: #9ca3af;
}

.nav-mobile-menu a:hover,
.nav-mobile-menu a.active {
  background: #1f2937;
  color: #fff;
}

.nav-mobile-menu a.active {
  background: #059669;
  color: #fff;
}

/* Card touch feedback */
.card-interactive {
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.card-interactive:active {
  transform: scale(0.985);
}

/* Better scrollbar on mobile */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}

/* Table responsive */
@media (max-width: 639px) {
  .table-responsive {
    font-size: 13px;
  }
  .table-responsive th,
  .table-responsive td {
    padding: 10px 8px;
    white-space: nowrap;
  }
}

/* Better button states */
.btn-primary {
  background: #059669;
  color: white;
  font-weight: 500;
  border-radius: 8px;
  padding: 10px 20px;
  min-height: 44px;
  font-size: 14px;
}

.btn-primary:hover { background: #047857; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: #1f2937;
  color: #d1d5db;
  font-weight: 500;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 13px;
}

.btn-secondary:hover { background: #374151; }
.btn-secondary:active { transform: scale(0.97); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  color: #f87171;
  font-size: 13px;
  min-height: 36px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

/* Form fields */
.form-input {
  width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 10px 14px;
  color: #f3f4f6;
  font-size: 15px;
  min-height: 44px;
}

.form-input:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
  outline: none;
}

.form-input::placeholder { color: #6b7280; }

.form-label {
  display: block;
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 6px;
  font-weight: 500;
}

/* KPI cards */
.kpi-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 16px;
}

@media (min-width: 768px) {
  .kpi-card { padding: 20px; }
}

/* Section card */
.section-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 16px;
}

@media (min-width: 768px) {
  .section-card { padding: 24px; }
}

/* Page title */
.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .page-title { font-size: 1.5rem; margin-bottom: 24px; }
}

/* Section title inside cards */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #374151;
  border-top-color: #059669;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Progress bar */
.progress-bar {
  height: 8px;
  background: #1f2937;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: #059669;
  transition: width 500ms ease;
}

/* Toast / form message */
.msg-success { color: #34d399; }
.msg-error { color: #f87171; }
