/* ============================================================
   SMN-Pige Web - Main Stylesheet
   Professional Radio Logging Application
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS Custom Properties - Dark Theme (Default)
   ------------------------------------------------------------ */
:root,
[data-theme="dark"] {
  /* Backgrounds */
  --bg-dark: #1a1a2e;
  --bg-medium: #16213e;
  --bg-light: #0f3460;
  --bg-card: #1f2937;

  /* Accent Colors */
  --accent-primary: #3b82f6;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-info: #06b6d4;

  /* Text */
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Borders */
  --border: #374151;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

  /* Fonts */
  --font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Fira Code', monospace;

  /* Sizing */
  --header-height: 64px;
  --footer-height: 48px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ------------------------------------------------------------
   2. CSS Custom Properties - Light Theme
   ------------------------------------------------------------ */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-medium: #f1f5f9;
  --bg-light: #e2e8f0;
  --bg-card: #ffffff;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border: #e2e8f0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ------------------------------------------------------------
   3. Reset / Normalize
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-info);
}

img, svg {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

code, pre, kbd {
  font-family: var(--font-mono);
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

/* ------------------------------------------------------------
   4. Custom Scrollbar
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-dark);
}

/* ------------------------------------------------------------
   5. App Header
   ------------------------------------------------------------ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-medium);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.app-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #ffffff;
}

.app-logo-text span {
  color: var(--accent-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ------------------------------------------------------------
   6. App Navigation
   ------------------------------------------------------------ */
.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.app-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 100%;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
  border: none;
  background: none;
  white-space: nowrap;
}

.app-nav .nav-item:hover {
  color: var(--text-primary);
}

.app-nav .nav-item.active {
  color: var(--accent-primary);
}

.app-nav .nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 3px 3px 0 0;
}

.app-nav .nav-item .nav-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   7. App Content
   ------------------------------------------------------------ */
.app-content {
  padding-top: calc(var(--header-height) + 20px);
  padding-bottom: calc(var(--footer-height) + 20px);
  padding-left: 20px;
  padding-right: 20px;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

/* ------------------------------------------------------------
   8. App Footer
   ------------------------------------------------------------ */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  background: var(--bg-medium);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

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

.footer-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ------------------------------------------------------------
   9. Tab System
   ------------------------------------------------------------ */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn var(--transition-slow) ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   10. Cards
   ------------------------------------------------------------ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header .card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ------------------------------------------------------------
   11. Tables
   ------------------------------------------------------------ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th {
  background: var(--bg-light);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.04);
}

.table tbody tr.selected {
  background-color: rgba(59, 130, 246, 0.1);
}

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

.table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   12. Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  line-height: 1.5;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-success {
  background: var(--accent-success);
  color: #ffffff;
}

.btn-success:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-danger {
  background: var(--accent-danger);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-warning {
  background: var(--accent-warning);
  color: #1a1a2e;
}

.btn-warning:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

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

.btn-ghost:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.btn-outline:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1.0625rem;
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
  padding: 4px;
}

/* ------------------------------------------------------------
   13. Forms
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input.is-invalid {
  border-color: var(--accent-danger);
}

.form-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-help {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.form-error {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--accent-danger);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* ------------------------------------------------------------
   14. Modals
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: modalOverlayIn var(--transition-slow) ease;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalSlideIn var(--transition-slow) ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-sm { max-width: 420px; }
.modal-lg { max-width: 800px; }

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

/* ------------------------------------------------------------
   15. Status Indicators
   ------------------------------------------------------------ */
.status-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.recording {
  background: var(--accent-success);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.stopped {
  background: var(--accent-danger);
}

.status-dot.reconnecting {
  background: var(--accent-warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.error {
  background: var(--accent-danger);
}

.status-dot.idle {
  background: var(--text-muted);
}

@keyframes pulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ------------------------------------------------------------
   16. Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
}

.badge-info {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-info);
}

.badge-primary {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
}

.badge-neutral {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-secondary);
}

/* ------------------------------------------------------------
   17. Splash Screen
   ------------------------------------------------------------ */
.splash {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.5s ease;
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  font-size: 72px;
  line-height: 1;
}

.splash-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.splash-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: -12px;
}

.splash-progress {
  width: 200px;
  height: 4px;
  background: var(--bg-light);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.splash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-info));
  border-radius: 2px;
  animation: splashProgress 2s ease-in-out;
}

@keyframes splashProgress {
  from { width: 0%; }
  to   { width: 100%; }
}

/* ------------------------------------------------------------
   18. Toast Notifications
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn var(--transition-slow) ease;
  border-left: 4px solid var(--border);
  position: relative;
}

.toast.toast-removing {
  animation: toastSlideOut var(--transition-base) ease forwards;
}

.toast-success {
  border-left-color: var(--accent-success);
}

.toast-error {
  border-left-color: var(--accent-danger);
}

.toast-warning {
  border-left-color: var(--accent-warning);
}

.toast-info {
  border-left-color: var(--accent-info);
}

.toast-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ------------------------------------------------------------
   19. Login Page
   ------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  max-width: 400px;
  width: 100%;
  padding: 40px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-top: 4px;
}

.login-card .form-group {
  margin-bottom: 20px;
}

.login-card .btn {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   20. Audio Player
   ------------------------------------------------------------ */
.player {
  position: fixed;
  bottom: var(--footer-height);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 12px 24px;
  display: none;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
}

.player.active {
  display: flex;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.player-controls .btn-icon {
  width: 40px;
  height: 40px;
  font-size: 1.125rem;
}

.player-controls .btn-play {
  background: var(--accent-primary);
  color: #ffffff;
  border-radius: 50%;
}

.player-info {
  min-width: 0;
  flex-shrink: 0;
  max-width: 220px;
}

.player-filename {
  font-weight: 600;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.player-progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  flex-shrink: 0;
  min-width: 48px;
  text-align: center;
}

.player-progress {
  flex: 1;
  height: 6px;
  background: var(--bg-light);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.player-progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.player-progress:hover .player-progress-fill {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-info));
}

.player-waveform {
  width: 120px;
  height: 36px;
  flex-shrink: 0;
}

.player-waveform canvas {
  width: 100%;
  height: 100%;
}

.player-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.player-volume input[type="range"] {
  width: 80px;
  accent-color: var(--accent-primary);
}

/* Body adjustments when player is visible */
body.player-visible .app-content {
  padding-bottom: calc(var(--footer-height) + 80px);
}

body.player-visible .app-footer {
  /* footer stays at the very bottom */
}

/* ------------------------------------------------------------
   21. Utility Classes
   ------------------------------------------------------------ */

/* Flexbox */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }

/* Gaps */
.gap-xs  { gap: 4px; }
.gap-sm  { gap: 8px; }
.gap-md  { gap: 16px; }
.gap-lg  { gap: 24px; }
.gap-xl  { gap: 32px; }

/* Text colors */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-success   { color: var(--accent-success); }
.text-danger    { color: var(--accent-danger); }
.text-warning   { color: var(--accent-warning); }
.text-info      { color: var(--accent-info); }

/* Text alignment */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

/* Font sizes */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-md { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

/* Font weight */
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* Margins */
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 32px; }

.mb-xs { margin-bottom: 4px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mb-xl { margin-bottom: 32px; }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Padding */
.p-sm  { padding: 8px; }
.p-md  { padding: 16px; }
.p-lg  { padding: 24px; }

/* Width */
.w-full { width: 100%; }

/* Display */
.hidden   { display: none; }
.block    { display: block; }
.inline   { display: inline; }
.relative { position: relative; }

/* Overflow */
.overflow-auto   { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Selection */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Separator / Divider */
.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 16px 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.9375rem;
  max-width: 400px;
  margin: 0 auto;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

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

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

/* Tooltip (basic CSS-only) */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 50;
  box-shadow: var(--shadow-md);
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* Dropdown menu */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 200;
  display: none;
}

.dropdown-menu.active {
  display: block;
  animation: fadeIn var(--transition-fast) ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

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

/* Progress bar (generic) */
.progress-bar {
  height: 8px;
  background: var(--bg-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
  transition: width var(--transition-base);
}

.progress-bar-fill.success { background: var(--accent-success); }
.progress-bar-fill.warning { background: var(--accent-warning); }
.progress-bar-fill.danger  { background: var(--accent-danger); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
}

.pagination .page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.pagination .page-btn:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

.pagination .page-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
