/**
 * ALLEGRO FLEET — Design System
 * Dark theme tokens, typography, spacing
 * Bootstrap ostaje kao baza; sve vidljivo prolazi kroz ovaj design layer.
 */

:root {
  /* === COLORS — 3 layer depth system === */
  --bg-base: #0b0f14;
  --bg-surface: #121821;
  --bg-elevated: #1a2332;
  --bg-hover: #222c3d;
  /* Aliases for compatibility */
  --bg-surface-elevated: var(--bg-elevated);
  --bg-surface-hover: var(--bg-hover);
  --border-default: #2d3a4f;
  --border-muted: #1e2a3a;
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-primary-muted: rgba(59, 130, 246, 0.15);
  --accent-cyan: #06b6d4;
  --accent-cyan-muted: rgba(6, 182, 212, 0.15);
  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f1419;
  /* Form controls — čitljiv tekst / placeholder na tamnoj temi */
  --form-control-color: #e2e8f0;
  --form-placeholder-color: #94a3b8;
  --form-focus-ring: #3b82f6;

  /* === TYPOGRAPHY === */
  --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.9375rem;
  --font-size-lg: 1rem;
  --font-size-xl: 1.125rem;
  --font-size-2xl: 1.5rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;

  /* === SPACING === */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* === LAYOUT === */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;
  --topbar-height: 56px;
  --content-max-width: 1400px;
  --content-padding: 24px;

  /* === RADIUS === */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* === SHADOWS === */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);

  /* === TRANSITIONS === */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-smooth: 0.25s ease;
}

/* === GLOBAL OVERFLOW FIX === */
* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

/* === BASE === */
body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background: radial-gradient(circle at top, #0f172a, #020617);
  min-height: 100vh;
}

/* === MOBILE OVERFLOW PREVENTION === */
.app-shell,
.app-main,
.app-content,
.page-content,
.ds-card,
.card,
.ds-table-wrap,
.vehicle-detail-grid,
.media-gallery,
.info-panel,
.row,
.container,
.container-fluid {
  max-width: 100%;
  min-width: 0;
}

img,
canvas,
svg,
table {
  max-width: 100%;
}

/* Laravel default paginator SVG strelice — ne smiju naslijediti globalni max-width:100% na svg */
.pagination svg {
  width: 1rem !important;
  height: 1rem !important;
  max-width: none !important;
  flex: 0 0 auto;
}

/* Narrow viewport overflow safeguard (320px / 360px / 375px) */
@media (max-width: 400px) {
  .app-content,
  .page-content,
  .vehicle-detail-grid {
    overflow-x: hidden;
    width: 100%;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

.flex-child,
.grid-child {
  min-width: 0;
}

/* Micro transitions — global */
button,
.card,
.ds-btn,
.ds-card,
.vehicle-card,
.vehicles-summary-card {
  transition: all var(--transition-smooth);
}

/* === TYPOGRAPHY CLASSES === */
.page-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

.page-subtitle {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.metric-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.badge-text {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

/* === LINKS === */
a {
  color: var(--accent-primary);
  text-decoration: none;
}

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

/* === OVERRIDE BOOTSTRAP DEFAULTS (design layer) === */
/* Tekst boje */
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
