:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --border-color: rgba(255, 255, 255, 0.1);
  --accent-blue: #38bdf8;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(circle at top left, #1e1b4b, #0f172a 50%, #020617);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-color);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 11px;
  color: var(--accent-blue);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--accent-blue);
}

.device-status-card {
  margin-top: auto;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.status-title {
  font-size: 13px;
  font-weight: 600;

}

.status-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.stat-row strong.highlight {
  color: var(--accent-blue);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title h2 {
  font-size: 24px;
  font-weight: 700;
}

.header-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.mode-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-rose), #e11d48);
  color: white;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.6);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--accent-rose);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.4);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

/* Bassinet Visual Card */
.bassinet-view-card {
  grid-column: span 7;
}

.status-pill {
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
}

.status-pill .dot.crying {
  background: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
  animation: pulse-red 1s infinite alternate;
}

@keyframes pulse-red {
  0% { transform: scale(1); }
  100% { transform: scale(1.4); }
}

.bassinet-visual-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bassinet-frame {
  height: 280px;
  background: radial-gradient(circle at center, rgba(30, 58, 138, 0.3), rgba(15, 23, 42, 0.8));
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bassinet-cradle {
  width: 220px;
  height: 140px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease;
}

.baby-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.baby-head {
  width: 48px;
  height: 48px;
  background: #fde047;
  border-radius: 50%;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,0.1);
}

.baby-body {
  width: 60px;
  height: 40px;
  background: #38bdf8;
  border-radius: 20px 20px 10px 10px;
  margin-top: -6px;
}

.sleep-zzz {
  position: absolute;
  top: -24px;
  right: -10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-purple);
  animation: float-zzz 2s infinite ease-in-out;
}

@keyframes float-zzz {
  0% { transform: translateY(0) scale(0.8); opacity: 0.3; }
  50% { transform: translateY(-10px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-20px) scale(1.3); opacity: 0; }
}

.cry-waves {
  display: none;
  position: absolute;
  top: -30px;
  font-size: 18px;
  animation: bounce-cry 0.5s infinite alternate;
}

@keyframes bounce-cry {
  0% { transform: scale(1); }
  100% { transform: scale(1.2); }
}

.actuator-base {
  position: absolute;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.transducer-label {
  font-size: 11px;
  color: var(--text-muted);
}

.vibration-ring {
  width: 140px;
  height: 6px;
  border-radius: 4px;
  background: var(--accent-blue);
  opacity: 0.3;
}

.simulation-controls h4 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Soothing Control Card */
.soothing-control-card {
  grid-column: span 5;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider { background-color: var(--accent-green); }
input:checked + .slider:before { transform: translateX(20px); }

.soothing-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.control-label span { color: var(--text-muted); }
.control-label strong { color: var(--accent-blue); }

.range-slider {
  width: 100%;
  accent-color: var(--accent-blue);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.sound-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.preset-btn {
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.preset-btn.active, .preset-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-blue);
  color: white;
}

/* Graph Card */
.graph-card {
  grid-column: span 7;
}

.rate-badge {
  font-size: 11px;
  color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
}

.chart-container {
  height: 200px;
  position: relative;
}

/* Hardware Card */
.hardware-card {
  grid-column: span 5;
}

.power-metrics {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.metric-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: 12px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.metric-icon.pvdd { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.metric-icon.vdd33 { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.metric-icon.temp { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-info .label { font-size: 11px; color: var(--text-muted); }
.metric-info .value { font-size: 18px; font-weight: 700; color: white; margin: 2px 0; }
.metric-info .subtext { font-size: 10px; color: var(--text-muted); }

/* Log Card */
.log-card {
  grid-column: span 12;
}

.log-terminal {
  height: 140px;
  background: #020617;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  font-family: monospace;
  font-size: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-line.info { color: var(--accent-blue); }
.log-line.success { color: var(--accent-green); }
.log-line.warn { color: var(--accent-amber); }
.log-line.error { color: var(--accent-rose); }
