:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-yellow: #facc15;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --bg-blob-1: rgba(59, 130, 246, 0.15);
  --bg-blob-2: rgba(139, 92, 246, 0.15);
  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --blur-amount: 12px;
  --card-bg: rgba(40, 53, 75, 0.5);
  --card-bg-hover: rgba(50, 65, 90, 0.6);
  --card-border: rgba(255, 255, 255, 0.05);
  --card-shadow-hover: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
  --item-bg: rgba(255, 255, 255, 0.03);
  --item-bg-hover: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(0, 0, 0, 0.2);
  --sidebar-width: 280px;
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --border-radius-xl: 32px;
}

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

html, body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 15% 50%, var(--bg-blob-1), transparent 25%), radial-gradient(circle at 85% 30%, var(--bg-blob-2), transparent 25%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container { display: flex; width: 100vw; height: 100vh; padding: 16px; gap: 24px; }

/* Scrollbars for dashboard */
.dashboard-grid::-webkit-scrollbar { width: 8px; }
.dashboard-grid::-webkit-scrollbar-track { background: transparent; }
.dashboard-grid::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 10px; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 32px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--border-radius-lg);
}

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

.sidebar-header h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); }

.logo-icon { color: var(--accent-blue); }

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

.nav-link {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  border-radius: var(--border-radius-md); color: var(--text-secondary);
  font-size: 18px; font-weight: 500; text-decoration: none;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); transform: translateX(4px); }

.nav-link.active { background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, transparent 100%); border-left: 3px solid var(--accent-blue); }

.nav-link svg { width: 24px; height: 24px; }

.sidebar-footer { padding-top: 24px; border-top: 1px solid var(--glass-border); }

.family-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--border-radius-md); color: var(--text-secondary);
  font-size: 16px; font-weight: 500; text-decoration: none;
  transition: all 0.2s ease; width: 100%; justify-content: center;
}

.family-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }

/* Main */
.main-content { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; padding: 0 8px; }

/* Views */
.view {
  display: none;
  opacity: 0;
  height: 100%;
  transition: opacity 0.25s ease;
}
.view.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* Dashboard */
.dashboard-header { padding: 32px 0 24px 0; }

.dashboard-header h2 { font-size: 32px; color: var(--text-primary); margin-bottom: 8px; }

.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px; flex: 1; overflow-y: auto; padding-bottom: 24px;
}

/* Cards */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: var(--glass-shadow);
  padding: 24px;
}

.glass-card:hover { transform: translateY(-2px); background: var(--card-bg-hover); box-shadow: var(--card-shadow-hover); }

/* Tiles */
.tile { display: flex; align-items: center; gap: 1.25rem; cursor: default; }

.tile.clickable { cursor: pointer; border-left: 3px solid transparent; }

.tile.clickable:hover { border-left-color: var(--accent-blue); }

.tile-icon {
  width: 56px; height: 56px; border-radius: 1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.temp-icon  { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.light-icon { background: rgba(250, 204, 21, 0.15); color: var(--accent-yellow); }
.rain-icon  { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.sun-icon   { background: rgba(250, 204, 21, 0.15); color: var(--accent-yellow); }
.sunshine-icon { background: rgba(250, 204, 21, 0.15); color: var(--accent-yellow); }
.hum-icon   { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }

.wind-tile { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tile-left { display: flex; align-items: center; gap: 1.25rem; }

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

.tile-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }

.tile-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }

.tile-unit { font-size: 0.85rem; color: var(--text-muted); }

.wind-visual { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }

.wind-label { font-size: 0.85rem; color: var(--text-muted); }

/* Settings */
.settings-container { padding: 32px; height: 100%; display: flex; flex-direction: column; gap: 32px; overflow-y: auto; }

.settings-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); padding-bottom: 16px; }
.settings-header h2 { font-size: 32px; color: var(--text-primary); }

.settings-content { display: flex; flex-direction: column; gap: 24px; max-width: 800px; width: 100%; margin: 0 auto; }

.settings-section { padding: 24px; display: flex; flex-direction: column; gap: 20px; }

.section-header { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--glass-border); padding-bottom: 12px; }
.section-header h3 { font-size: 20px; color: var(--text-primary); margin: 0; }
.section-icon { color: var(--accent-blue); }

.setting-item { display: flex; justify-content: space-between; align-items: center; gap: 24px; }

.setting-info h4 { font-size: 18px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.setting-info p { font-size: 14px; color: var(--text-muted); }

.glass-input-full {
  width: 100%; background: var(--input-bg); border: 1px solid var(--glass-border);
  color: var(--text-primary); padding: 12px 16px; border-radius: var(--border-radius-sm);
  font-size: 16px; outline: none; transition: border-color 0.2s ease; font-family: inherit;
}
.glass-input-full:focus { border-color: var(--accent-blue); }

.btn { font-family: inherit; font-size: 0.95rem; font-weight: 500; padding: 0.75rem 1.5rem; border-radius: var(--border-radius-md); border: none; cursor: pointer; transition: all 0.2s ease; }

.btn.primary { background: var(--accent-blue); color: white; }
.btn.primary:hover { background: #2563eb; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); }

/* Modal */
.modal { display: none; }
.modal.active { display: flex; position: fixed; inset: 0; align-items: center; justify-content: center; z-index: 60; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 50; }

.modal-card { position: relative; z-index: 55; width: 90%; max-width: 960px; max-height: 90vh; display: flex; flex-direction: column; }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--glass-border); gap: 1rem; flex-wrap: wrap; }

.modal-title { font-size: 1.25rem; font-weight: 700; }

.range-tabs { display: flex; gap: 0.5rem; background: var(--bg-secondary); border-radius: var(--border-radius-sm); padding: 0.25rem; }

.range-tab {
  background: none; border: none; color: var(--text-muted); font-family: inherit; font-size: 0.85rem;
  padding: 0.4rem 1rem; border-radius: var(--border-radius-sm); cursor: pointer; transition: all 0.2s ease;
}
.range-tab.active { background: var(--bg-tertiary); color: var(--text-primary); font-weight: 600; }
.range-tab:hover { color: var(--text-primary); }

.modal-close { background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; line-height: 1; }

.modal-body { padding: 1.5rem; }

/* Responsive */
@media (max-width: 768px) {
  .app-container { flex-direction: column; padding: 12px; gap: 16px; overflow-y: auto; }
  .sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; padding: 16px; gap: 16px; }
  .nav-links { flex-direction: row; flex: 1; justify-content: center; }
  .sidebar-footer { width: 100%; padding-top: 0; border-top: none; }
  .family-link { justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .modal-card { width: 95%; max-height: 85vh; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .tile { flex-direction: column; align-items: flex-start; }
  .setting-item { flex-direction: column; align-items: flex-start; }
}
