@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;700;800&display=swap');

:root {
  /* Premium Palette - Light */
  --bg-body: #f3f4f6;
  --bg-grad-1: rgba(59, 130, 246, 0.15);
  --bg-grad-2: rgba(147, 51, 234, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.1);

  --text-main: #0f172a;
  --text-muted: #64748b;

  --radius-sm: 0.75rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
}

.dark :root {
  /* Premium Palette - Dark */
  --bg-body: #020617;
  --bg-grad-1: rgba(59, 130, 246, 0.08);
  --bg-grad-2: rgba(147, 51, 234, 0.05);
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

/* Base Reset & Typography */
html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-body);
  background-image:
    radial-gradient(at 0% 0%, var(--bg-grad-1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, var(--bg-grad-2) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  transition: color 0.3s ease, background 0.3s ease;
}

/* Typography Headings */
h1,
h2,
h3,
h4,
.font-heading {
  font-family: 'Outfit', sans-serif;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.3);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.5);
}

/* Components */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  border: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  transition: all 0.2s;
}

.btn-icon:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
  transform: rotate(5deg);
}

/* Inputs */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: all 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

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

/* Cards (Machine / Camera) */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

/* Machine List Item */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.2);
  font-weight: 600;
}

.nav-item .metric {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.05);
}

.dark .nav-item .metric {
  background: rgba(255, 255, 255, 0.05);
}

/* Camera Grid */
.cam-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: #000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.cam-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  opacity: 0.8;
}

.cam-card:hover img {
  transform: scale(1.05);
  opacity: 1;
}

.cam-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
  color: white;
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.3s ease;
}

.cam-card:hover .cam-overlay {
  transform: translateY(0);
  opacity: 1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.green {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-dot.red {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

/* Header / Toolbar */
.top-bar {
  position: sticky;
  top: 1rem;
  z-index: 50;
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
}

/* Table */
.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.modern-table th {
  text-align: left;
  padding: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--glass-border);
}

.modern-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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