/* =============================================
   BLUEHUNT - Apple Human Interface Design System
   ============================================= */

/* -----------------------------------------
   CSS Variables (iOS/macOS Inspired)
   ----------------------------------------- */
:root {
  /* Backgrounds - iOS Dark Mode */
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --bg-elevated: #3a3a3c;
  --bg-card: #1c1c1e;
  --bg-card-hover: #2c2c2e;
  --bg-grouped: #000000;
  --bg-grouped-secondary: #1c1c1e;

  /* Text - Apple's exact opacity values */
  --text-primary: #ffffff;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.3);
  --text-quaternary: rgba(235, 235, 245, 0.18);

  /* Accent Colors - iOS System Colors */
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --success: #30d158;
  --warning: #ffd60a;
  --danger: #ff453a;
  --error: #ff453a;
  --orange: #ff9f0a;
  --purple: #bf5af2;
  --pink: #ff375f;
  --teal: #64d2ff;
  --indigo: #5e5ce6;

  /* Separators & Borders */
  --separator: rgba(84, 84, 88, 0.65);
  --separator-opaque: #38383a;
  --border: #38383a;
  --border-light: #2c2c2e;

  /* Fills - for backgrounds with transparency */
  --fill-primary: rgba(120, 120, 128, 0.36);
  --fill-secondary: rgba(120, 120, 128, 0.32);
  --fill-tertiary: rgba(120, 120, 128, 0.24);
  --fill-quaternary: rgba(120, 120, 128, 0.18);

  /* Spacing - 8pt grid */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border radius - Apple's rounded corners */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Typography - SF Pro scale */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Monaco, "Cascadia Code", monospace;
  --font-rounded: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;

  /* Font sizes - iOS Dynamic Type (Large) */
  --text-largeTitle: 34px;
  --text-title1: 28px;
  --text-title2: 22px;
  --text-title3: 20px;
  --text-headline: 17px;
  --text-body: 17px;
  --text-callout: 16px;
  --text-subhead: 15px;
  --text-footnote: 13px;
  --text-caption1: 12px;
  --text-caption2: 11px;

  /* Transitions - Apple's spring-like feel */
  --transition-fast: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-base: 300ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-slow: 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-spring: 500ms cubic-bezier(0.175, 0.885, 0.32, 1.1);

  /* Shadows - subtle depth */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.6);

  /* Safe areas for mobile */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* -----------------------------------------
   Reset & Base
   ----------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* -----------------------------------------
   Typography - iOS Dynamic Type Scale
   ----------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Large Title - 34pt Bold */
h1, .text-largeTitle {
  font-size: var(--text-largeTitle);
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Title 1 - 28pt Bold */
h2, .text-title1 {
  font-size: var(--text-title1);
  font-weight: 700;
}

/* Title 2 - 22pt Bold */
h3, .text-title2 {
  font-size: var(--text-title2);
  font-weight: 700;
}

/* Title 3 - 20pt Semibold */
h4, .text-title3 {
  font-size: var(--text-title3);
  font-weight: 600;
}

/* Headline - 17pt Semibold */
.text-headline {
  font-size: var(--text-headline);
  font-weight: 600;
}

/* Body - 17pt Regular */
.text-body {
  font-size: var(--text-body);
  font-weight: 400;
}

/* Callout - 16pt Regular */
.text-callout {
  font-size: var(--text-callout);
  font-weight: 400;
}

/* Subhead - 15pt Regular */
.text-subhead {
  font-size: var(--text-subhead);
  font-weight: 400;
}

/* Footnote - 13pt Regular */
.text-footnote {
  font-size: var(--text-footnote);
  font-weight: 400;
}

/* Caption 1 - 12pt Regular */
.text-caption1, .text-xs {
  font-size: var(--text-caption1);
  font-weight: 400;
}

/* Caption 2 - 11pt Regular */
.text-caption2 {
  font-size: var(--text-caption2);
  font-weight: 400;
}

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-sm { font-size: var(--text-footnote); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* -----------------------------------------
   Navigation - Apple Style
   ----------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-headline);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav-brand:hover {
  color: var(--text-primary);
}

.nav-logo {
  height: 28px;
  width: auto;
}

.nav-brand-text {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
}

.nav-brand-team {
  font-weight: 400;
  font-size: var(--text-footnote);
  color: var(--text-secondary);
}

.nav-brand-team::before {
  content: "·";
  margin-right: var(--space-xs);
  color: var(--text-tertiary);
}

/* Desktop Navigation Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: var(--text-footnote);
  font-weight: 400;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--fill-quaternary);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--fill-tertiary);
  font-weight: 500;
}

.nav-link span {
  display: none;
}

@media (min-width: 1100px) {
  .nav-link span {
    display: inline;
  }
}

/* Nav Icons */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

/* Right Side */
.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

/* User */
.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.nav-user:hover {
  color: var(--text-primary);
  background: var(--fill-quaternary);
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-caption1);
  font-weight: 600;
}

.nav-username {
  font-size: var(--text-footnote);
  font-weight: 500;
}

@media (max-width: 768px) {
  .nav-username {
    display: none;
  }
}

/* Feedback Button */
.nav-feedback-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-feedback-btn:hover {
  color: var(--accent);
  background: var(--fill-quaternary);
}

/* Mobile Menu Toggle */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 12px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all var(--transition-fast);
}

.nav-toggle.active .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}

/* Mobile Navigation Menu */
.nav-mobile {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 0.5px solid var(--separator);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.nav-mobile.active {
  max-height: calc(100vh - 48px);
}

.nav-mobile-inner {
  padding: var(--space-sm);
}

.nav-mobile-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  color: var(--text-primary);
  font-size: var(--text-body);
  font-weight: 400;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.nav-mobile-link:hover {
  background: var(--fill-quaternary);
}

.nav-mobile-link.active {
  background: var(--fill-tertiary);
  font-weight: 500;
}

.nav-mobile-link .nav-icon {
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
}

.nav-mobile-link.active .nav-icon {
  color: var(--accent);
}

.nav-mobile-divider {
  height: 0.5px;
  background: var(--separator);
  margin: var(--space-sm) var(--space-md);
}

.nav-mobile-logout {
  color: var(--danger);
}

.nav-mobile-logout .nav-icon {
  color: var(--danger);
}

/* Prevent scroll when nav open */
body.nav-open {
  overflow: hidden;
}

@media (min-width: 901px) {
  .nav-mobile {
    display: none;
  }
}

/* -----------------------------------------
   Main Content
   ----------------------------------------- */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  width: 100%;
}

/* -----------------------------------------
   Footer
   ----------------------------------------- */
.footer {
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  border-top: 1px solid var(--border-light);
}

/* -----------------------------------------
   Cards
   ----------------------------------------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.card-header {
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* -----------------------------------------
   Weather Card
   ----------------------------------------- */
.weather-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xl);
  align-items: center;
}

.weather-icon {
  font-size: 4rem;
  line-height: 1;
}

.weather-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.weather-temp {
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.weather-temp-range {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.weather-condition {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.weather-details {
  display: flex;
  gap: var(--space-xl);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.weather-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.weather-detail-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.weather-detail-value {
  font-size: 1rem;
  font-weight: 500;
}

/* -----------------------------------------
   Grid Layouts
   ----------------------------------------- */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* -----------------------------------------
   Video Grid
   ----------------------------------------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}

.video-card video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-primary);
}

.video-card-info {
  padding: var(--space-md);
}

.video-card-time {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.video-card-battery {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

/* -----------------------------------------
   Image Gallery
   ----------------------------------------- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.image-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  transition: all var(--transition-base);
}

.image-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: var(--text-primary);
  font-size: 0.75rem;
}

/* -----------------------------------------
   Calendar
   ----------------------------------------- */
.calendar-container {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.calendar-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.calendar-nav {
  display: flex;
  gap: var(--space-sm);
}

.calendar-nav-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.calendar-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-xs);
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  border: 1px solid transparent;
  position: relative;
}

.calendar-day:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.calendar-day.has-videos {
  background: rgba(48, 209, 88, 0.15);
  border-color: rgba(48, 209, 88, 0.3);
}

.calendar-day.has-videos:hover {
  background: rgba(48, 209, 88, 0.25);
  border-color: var(--success);
}

.calendar-day.has-images {
  background: rgba(10, 132, 255, 0.15);
  border-color: rgba(10, 132, 255, 0.3);
}

.calendar-day.has-images:hover {
  background: rgba(10, 132, 255, 0.25);
  border-color: var(--accent);
}

.calendar-day.today {
  border: 2px solid var(--accent);
}

.calendar-day-number {
  font-size: 0.9375rem;
  font-weight: 500;
}

.calendar-day-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  margin-top: var(--space-xs);
}

.calendar-day-dot.images-only {
  background: var(--accent);
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
}

/* -----------------------------------------
   Tabs
   ----------------------------------------- */
.tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--bg-secondary);
  padding: var(--space-xs);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* -----------------------------------------
   Buttons - iOS Style (44pt minimum touch target)
   ----------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-body);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.8;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--fill-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--fill-secondary);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover {
  background: rgba(10, 132, 255, 0.1);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #ff6961;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  min-height: auto;
  padding: var(--space-xs) var(--space-sm);
}

.btn-ghost:hover {
  background: var(--fill-quaternary);
}

/* Large button - 50px height */
.btn-lg {
  min-height: 50px;
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-headline);
  border-radius: var(--radius-lg);
}

/* Small button */
.btn-sm {
  min-height: 34px;
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-subhead);
  border-radius: var(--radius-sm);
}

/* Icon button */
.btn-icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  min-height: 32px;
}

/* Full width button */
.btn-block {
  width: 100%;
}

/* Button group */
.btn-group {
  display: flex;
  gap: var(--space-sm);
}

.btn-group .btn {
  flex: 1;
}

/* -----------------------------------------
   Form Elements - iOS Style
   ----------------------------------------- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--text-footnote);
  font-weight: 400;
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-body);
  font-family: inherit;
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.3);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

/* Select with custom arrow */
.form-select {
  padding-right: var(--space-xl);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ebebf599' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

/* Input with icon */
.form-input-wrapper {
  position: relative;
}

.form-input-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1rem;
  pointer-events: none;
}

.form-input-wrapper .form-input {
  padding-left: calc(var(--space-md) + 24px);
}

/* Input with clear button */
.form-input-clear {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--fill-secondary);
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.form-input:not(:placeholder-shown) ~ .form-input-clear {
  display: flex;
}

/* Form hint/error text */
.form-hint {
  font-size: var(--text-caption1);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.form-error {
  font-size: var(--text-caption1);
  color: var(--danger);
  margin-top: var(--space-xs);
}

.form-input.error {
  box-shadow: 0 0 0 1px var(--danger);
}

/* Inline form */
.form-inline {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.form-inline .form-group {
  margin-bottom: 0;
  flex: 1;
}

/* Checkbox & Radio - iOS style */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 44px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 22px;
  height: 22px;
  border: 2px solid var(--fill-primary);
  background: transparent;
  border-radius: var(--radius-sm);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.form-check input[type="radio"] {
  border-radius: var(--radius-full);
}

.form-check input[type="checkbox"]:checked,
.form-check input[type="radio"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.form-check input[type="checkbox"]:checked::after {
  content: "✓";
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.form-check input[type="radio"]:checked::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: var(--radius-full);
  margin: 5px;
}

.form-check-label {
  font-size: var(--text-body);
  color: var(--text-primary);
}

/* -----------------------------------------
   Section Headers
   ----------------------------------------- */
.section {
  margin-bottom: var(--space-2xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* -----------------------------------------
   Back Link
   ----------------------------------------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--space-lg);
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--text-primary);
}

/* -----------------------------------------
   Page Header
   ----------------------------------------- */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* -----------------------------------------
   Empty States
   ----------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-text {
  font-size: 0.875rem;
}

/* -----------------------------------------
   Login Page
   ----------------------------------------- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  border: 1px solid var(--border-light);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo {
  width: 80px;
  height: auto;
  margin: 0 auto var(--space-md) auto;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.login-error {
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid rgba(255, 69, 58, 0.3);
  color: var(--danger);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.875rem;
}

/* -----------------------------------------
   Utilities
   ----------------------------------------- */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* -----------------------------------------
   Responsive
   ----------------------------------------- */
@media (max-width: 768px) {
  :root {
    --space-lg: 20px;
    --space-xl: 24px;
    --space-2xl: 32px;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .nav-inner {
    padding: var(--space-md);
  }

  .main {
    padding: var(--space-lg) var(--space-md);
  }

  .weather-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .weather-details {
    flex-wrap: wrap;
    justify-content: center;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .calendar-day-number {
    font-size: 0.8125rem;
  }

  .tabs {
    flex-direction: column;
  }
}

/* -----------------------------------------
   iOS Grouped Lists (Settings style)
   ----------------------------------------- */
.list-group {
  background: var(--bg-grouped-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.list-group-header {
  font-size: var(--text-footnote);
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.list-item {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-secondary);
  min-height: 44px;
  border-bottom: 0.5px solid var(--separator);
  transition: background var(--transition-fast);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:active,
.list-item:hover {
  background: var(--bg-tertiary);
}

.list-item-icon {
  width: 29px;
  height: 29px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--space-md);
  font-size: 1rem;
  flex-shrink: 0;
}

.list-item-icon.blue { background: var(--accent); color: white; }
.list-item-icon.green { background: var(--success); color: white; }
.list-item-icon.orange { background: var(--orange); color: white; }
.list-item-icon.red { background: var(--danger); color: white; }
.list-item-icon.purple { background: var(--purple); color: white; }
.list-item-icon.gray { background: var(--fill-primary); color: white; }

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: var(--text-body);
  font-weight: 400;
  color: var(--text-primary);
}

.list-item-subtitle {
  font-size: var(--text-caption1);
  color: var(--text-secondary);
  margin-top: 2px;
}

.list-item-value {
  font-size: var(--text-body);
  color: var(--text-secondary);
  margin-right: var(--space-sm);
}

.list-item-chevron {
  color: var(--text-quaternary);
  font-size: 0.875rem;
}

.list-item-chevron::after {
  content: "›";
  font-size: 1.25rem;
  font-weight: 300;
}

/* Destructive list item */
.list-item-destructive .list-item-title {
  color: var(--danger);
}

/* -----------------------------------------
   Segmented Control (iOS style)
   ----------------------------------------- */
.segmented-control {
  display: flex;
  background: var(--fill-tertiary);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 0;
}

.segment {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: var(--text-footnote);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.segment:hover:not(.active) {
  background: var(--fill-quaternary);
}

.segment.active {
  background: var(--bg-elevated);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* -----------------------------------------
   Badges & Pills
   ----------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: var(--text-caption2);
  font-weight: 600;
  background: var(--danger);
  color: white;
}

.badge-sm {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
}

.badge-lg {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: var(--text-caption1);
}

.badge-primary { background: var(--accent); }
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); color: #1c1c1e; }
.badge-secondary { background: var(--fill-primary); }

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--text-caption1);
  font-weight: 500;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
}

.pill-success {
  background: rgba(48, 209, 88, 0.15);
  color: var(--success);
}

.pill-warning {
  background: rgba(255, 214, 10, 0.15);
  color: var(--warning);
}

.pill-danger {
  background: rgba(255, 69, 58, 0.15);
  color: var(--danger);
}

.pill-accent {
  background: rgba(10, 132, 255, 0.15);
  color: var(--accent);
}

/* -----------------------------------------
   Species Tags (AI Classification)
   ----------------------------------------- */
.species-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: rgba(10, 132, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption1);
  font-weight: 500;
  color: var(--accent);
}

.species-tag-icon {
  font-size: 0.875rem;
}

.species-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

/* -----------------------------------------
   Modal / Sheet
   ----------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  max-width: 90vw;
  max-height: 85vh;
  overflow: hidden;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-spring);
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 0.5px solid var(--separator);
}

.modal-title {
  font-size: var(--text-headline);
  font-weight: 600;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--fill-tertiary);
  border: none;
  color: var(--text-secondary);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--fill-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  max-height: calc(85vh - 120px);
}

.modal-footer {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 0.5px solid var(--separator);
  justify-content: flex-end;
}

/* Bottom sheet (mobile) */
.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 90vh;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform var(--transition-spring);
  padding-bottom: var(--safe-area-bottom);
}

.sheet.active {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 5px;
  background: var(--fill-secondary);
  border-radius: var(--radius-full);
  margin: var(--space-sm) auto var(--space-md);
}

/* -----------------------------------------
   Toast / Alert
   ----------------------------------------- */
.toast-container {
  position: fixed;
  top: calc(var(--safe-area-top) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 90vw;
}

.toast {
  background: var(--bg-elevated);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  animation: toastIn var(--transition-spring) forwards;
}

.toast.toast-out {
  animation: toastOut var(--transition-fast) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--accent); }

.toast-message {
  font-size: var(--text-subhead);
  font-weight: 500;
}

/* -----------------------------------------
   Loading States
   ----------------------------------------- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--fill-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--fill-quaternary) 25%,
    var(--fill-tertiary) 50%,
    var(--fill-quaternary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* -----------------------------------------
   Search Bar
   ----------------------------------------- */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--fill-tertiary);
  border-radius: var(--radius-md);
  padding: 0 var(--space-md);
  height: 36px;
  gap: var(--space-sm);
  transition: all var(--transition-fast);
}

.search-bar:focus-within {
  background: var(--fill-secondary);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.search-icon {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-body);
  outline: none;
}

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

.search-clear {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--fill-secondary);
  border: none;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-bar:focus-within .search-clear,
.search-input:not(:placeholder-shown) ~ .search-clear {
  display: flex;
}

/* -----------------------------------------
   Toggle / Switch
   ----------------------------------------- */
.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

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

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--fill-primary);
  border-radius: 16px;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.toggle input:checked + .toggle-track {
  background: var(--success);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(20px);
}

/* -----------------------------------------
   Progress Bar
   ----------------------------------------- */
.progress {
  width: 100%;
  height: 4px;
  background: var(--fill-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.progress-bar-success { background: var(--success); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-danger { background: var(--danger); }

/* -----------------------------------------
   Avatar
   ----------------------------------------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--fill-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-subhead);
  color: var(--text-secondary);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--text-caption1); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-title3); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--text-title1); }

/* Avatar group */
.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-primary);
  margin-left: -12px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* -----------------------------------------
   Dividers
   ----------------------------------------- */
.divider {
  height: 0.5px;
  background: var(--separator);
  margin: var(--space-md) 0;
}

.divider-inset {
  margin-left: var(--space-lg);
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-tertiary);
  font-size: var(--text-caption1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.divider-label::before,
.divider-label::after {
  content: "";
  flex: 1;
  height: 0.5px;
  background: var(--separator);
}

/* -----------------------------------------
   Stats Card
   ----------------------------------------- */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
}

.stat-value {
  font-size: var(--text-largeTitle);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: var(--text-footnote);
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-caption1);
  font-weight: 500;
  margin-top: var(--space-sm);
}

.stat-change-up { color: var(--success); }
.stat-change-down { color: var(--danger); }

/* -----------------------------------------
   Quick Actions Row
   ----------------------------------------- */
.quick-actions {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  min-width: 72px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
}

.quick-action:hover {
  background: var(--bg-tertiary);
}

.quick-action:active {
  transform: scale(0.95);
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.quick-action-label {
  font-size: var(--text-caption1);
  font-weight: 500;
  text-align: center;
}
