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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-black);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ─── Typography ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-white);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

.gradient-text {
  background: linear-gradient(135deg, var(--color-white) 0%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Layout ────────────────────────────────────────────── */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-dark);
  position: relative;
}

.main-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-8);
  background: var(--color-dark);
}

.page {
  display: none;
  animation: pageEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.active {
  display: block;
}

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

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

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

::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(251, 191, 36, 0.3);
}

/* ─── Selection ─────────────────────────────────────────── */
::selection {
  background: rgba(251, 191, 36, 0.3);
  color: var(--color-white);
}

/* ─── Glass Card ────────────────────────────────────────── */
.glass-card {
  background: rgba(24, 24, 27, 0.85);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(251, 191, 36, 0.05);
  transition: all var(--transition-base);
}

.glass-card:hover {
  border-color: rgba(251, 191, 36, 0.2);
  box-shadow: var(--shadow-xl), var(--shadow-gold), inset 0 1px 0 rgba(251, 191, 36, 0.08);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-dark) 100%);
  color: var(--color-black);
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(251, 191, 36, 0.35);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(39, 39, 42, 0.5);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: rgba(39, 39, 42, 0.8);
  border-color: rgba(151, 151, 151, 0.4);
  color: var(--color-white);
}

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-white);
}

.btn-danger {
  background: var(--color-red-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--text-base);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

/* ─── Inputs ────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}

.input-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-white);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  outline: none;
}

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

.input:focus {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
  background: rgba(0, 0, 0, 0.6);
}

.input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 30px rgba(0, 0, 0, 0.8) inset !important;
  -webkit-text-fill-color: var(--color-white) !important;
}

/* ─── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success {
  background: var(--color-green-bg);
  color: var(--color-green);
}

.badge-danger {
  background: var(--color-red-bg);
  color: var(--color-red);
}

.badge-warning {
  background: var(--color-orange-bg);
  color: var(--color-orange);
}

.badge-info {
  background: var(--color-blue-bg);
  color: var(--color-blue);
}

.badge-gold {
  background: rgba(251, 191, 36, 0.15);
  color: var(--color-gold);
}

/* ─── Utilities ─────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.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; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.text-center { text-align: center; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-gold { color: var(--color-gold); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

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

.status-dot.online {
  background: var(--color-green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse-green 2s ease-in-out infinite;
}

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

.status-dot.warning {
  background: var(--color-orange);
  animation: pulse-orange 2s ease-in-out infinite;
}

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

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

/* ─── Mobile Responsive ──────────────────────────────────── */
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { left: 0; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
  }
  .sidebar-backdrop.show { display: block; }
  .main-content { width: 100vw; }
  .top-bar { padding: var(--space-3) var(--space-4); }
  .top-bar-left h1 { font-size: var(--text-base); }
  .device-selector .device-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .device-list { right: auto; left: 0; min-width: 260px; }
  .main-area.camera-active { padding: 0; }
  .main-area.camera-active .control-panel { margin: 0; padding: 0; grid-template-columns: 1fr; gap: 0; }
  .main-area.camera-active .media-placeholder.large { min-height: calc(100vh - 56px); border-radius: 0; border: none; }
  .main-area.camera-active .action-grid { padding: var(--space-2) var(--space-3); }
}

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.3;
}

.empty-state h3 {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 300px;
}
