/* ==========================================================================
   Porto di Olbia PWA - Stylesheet
   Restyle v2.0 - Scroll fix, deduplication, modern layout
   ========================================================================== */

/* === 1. CSS VARIABLES — "Deep Ocean" Design System === */
:root {
  /* Primary — Deep Ocean Blue */
  --primary-color: #0D7CC4;
  --primary-dark: #074A6E;
  --primary-light: #E8F4FD;
  --primary-50: #E8F4FD;
  --primary-100: #B9DEF7;
  --primary-200: #8AC8F1;
  --primary-500: #0D7CC4;
  --primary-600: #0A6399;
  --primary-700: #074A6E;

  /* Accent — Sunset Coral */
  --accent-color: #E85A20;
  --accent-light: #FFF3ED;

  /* Neutrals */
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --background: #F8FAFC;
  --surface: #FFFFFF;
  --surface-variant: #F1F5F9;
  --surface-elevated: #FFFFFF;
  --error: #EF4444;
  --success: #22C55E;
  --warning: #F59E0B;
  --info: #3B82F6;
  --divider: #E5E7EB;
  --card-bg: #FFFFFF;
  --border-subtle: rgba(0,0,0,0.06);

  /* Header & Nav */
  --header-bg: linear-gradient(135deg, #074A6E 0%, #0D7CC4 100%);
  --modal-close-bg: none;
  --modal-close-hover: var(--primary-light);
  --settings-header-bg: white;
  --bottom-nav-bg: rgba(255, 255, 255, 0.88);

  /* Status Colors — Navi */
  --status-scheduled: #0D7CC4;
  --status-scheduled-bg: rgba(13, 124, 196, 0.08);
  --status-boarding: #EF4444;
  --status-boarding-bg: rgba(239, 68, 68, 0.1);
  --status-vehicles: #E65100;
  --status-vehicles-bg: rgba(255, 152, 0, 0.12);
  --status-departed: #22C55E;
  --status-departed-bg: rgba(34, 197, 94, 0.1);
  --status-arriving: #3B82F6;
  --status-arriving-bg: rgba(59, 130, 246, 0.1);
  --status-docked: #8B5CF6;
  --status-docked-bg: rgba(139, 92, 246, 0.1);
  --status-delayed: #F59E0B;
  --status-delayed-bg: rgba(245, 158, 11, 0.1);
  --status-cancelled: #6B7280;
  --status-cancelled-bg: rgba(107, 114, 128, 0.1);

  /* Spacing */
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px; --space-xl: 32px;

  /* Border Radius */
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 20px; --radius-2xl: 24px; --radius-full: 9999px;

  /* Shadows — more pronounced for visual depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 10px 25px rgba(0, 0, 0, 0.08);

  /* Font */
  --font-xs: 0.6875rem; --font-sm: 0.8125rem; --font-md: 0.9375rem; --font-lg: 1.125rem; --font-xl: 1.375rem; --font-2xl: 1.5rem; --font-3xl: 1.875rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === DARK MODE — Complete === */
.theme-dark,
body.dark-theme {
  --primary-color: #38BDF8;
  --primary-dark: #0EA5E9;
  --primary-light: rgba(56, 189, 248, 0.12);
  --primary-50: rgba(56, 189, 248, 0.08);
  --accent-color: #FB923C;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --background: #0F172A;
  --surface: #1E293B;
  --surface-variant: #334155;
  --surface-elevated: #334155;
  --error: #F87171;
  --success: #4ADE80;
  --warning: #FBBF24;
  --info: #60A5FA;
  --divider: #334155;
  --card-bg: #1E293B;
  --border-subtle: rgba(255,255,255,0.06);

  --header-bg: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  --modal-close-bg: rgba(255, 255, 255, 0.08);
  --modal-close-hover: rgba(255, 255, 255, 0.15);
  --settings-header-bg: #1E293B;
  --bottom-nav-bg: rgba(15, 23, 42, 0.92);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 10px 25px rgba(0, 0, 0, 0.3);

  /* Dark status badges — brighter for contrast */
  --status-boarding: #F87171;
  --status-boarding-bg: rgba(248, 113, 113, 0.15);
  --status-departed: #4ADE80;
  --status-departed-bg: rgba(74, 222, 128, 0.15);
  --status-arriving: #60A5FA;
  --status-arriving-bg: rgba(96, 165, 250, 0.15);
  --status-docked: #A78BFA;
  --status-docked-bg: rgba(167, 139, 250, 0.15);
  --status-delayed: #FBBF24;
  --status-delayed-bg: rgba(251, 191, 36, 0.15);
  --status-cancelled: #94A3B8;
  --status-cancelled-bg: rgba(148, 163, 184, 0.12);
  --status-vehicles: #FB923C;
  --status-vehicles-bg: rgba(251, 146, 60, 0.15);
  --status-scheduled: #38BDF8;
  --status-scheduled-bg: rgba(56, 189, 248, 0.12);
}

.theme-light {
  /* Inherits from :root */
}

/* === 2. RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: -0.011em;
}

/* === 3. VIEW TRANSITIONS API === */
@supports (view-transition-name: root) {
  #page-container { transition: none !important; }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

::view-transition-old(root) { animation-name: vt-fade-out; }
::view-transition-new(root) { animation-name: vt-fade-in; }

@keyframes vt-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes vt-fade-in  { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
  }
}

/* === 4. APP LAYOUT (SCROLL FIX) === */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--background);
}

.main-content {
  flex: 1;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

#page-container {
  opacity: 1;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* === 5. HEADER === */
.app-header {
  background: var(--header-bg);
  color: white;
  padding: 16px 20px 20px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  box-shadow: 0 4px 20px rgba(7, 74, 110, 0.25);
  position: relative;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  margin-bottom: 0;
  flex-shrink: 0;
  z-index: 10;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 100%;
}

.header-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-logo img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  padding: 2px;
}

.header-text { flex: 1; min-width: 0; }
.header-text h1 { font-size: var(--font-lg); font-weight: 700; margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
.header-text p { font-size: var(--font-sm); opacity: 0.8; margin: 2px 0 0; font-weight: 400; letter-spacing: 0.01em; }

.header-settings {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-settings:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.header-settings:active { transform: scale(0.92); }
.header-settings .material-icons { font-size: 22px; }

.header-install-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: pulse 2s infinite;
  position: relative;
}

.header-install-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.header-install-btn:active { transform: scale(0.92); }
.header-install-btn .material-icons { font-size: 22px; }

.header-install-btn.available {
  animation: pulse 2s infinite;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.4);
}

/* === 6. BOTTOM NAVIGATION — Glassmorphism === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bottom-nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  display: flex;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 999;
  box-shadow: 0 -1px 0 var(--border-subtle);
}

.bottom-nav-item {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  transition: color var(--transition-fast), transform var(--transition-fast);
  position: relative;
  min-height: 48px;
  color: var(--text-tertiary, #9CA3AF);
  touch-action: manipulation;
}

.bottom-nav-item:active { transform: scale(0.9); }

/* Active state */
.bottom-nav-item.active { color: var(--primary-color); }

/* Active top indicator bar */
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--primary-color);
}

.bottom-nav-item .material-icons { font-size: 24px; transition: transform var(--transition-spring); }
.bottom-nav-item.active .material-icons { transform: scale(1.1); }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }

.nav-badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(14px);
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  z-index: 2;
  color: white;
  animation: badge-pop 0.3s var(--transition-spring);
}

@keyframes badge-pop { 0% { transform: translateX(14px) scale(0); } 100% { transform: translateX(14px) scale(1); } }

.bottom-nav-item[data-page="bus"] .nav-badge { background: var(--warning); }
.bottom-nav-item[data-page="favorites"] .nav-badge { background: var(--error); }

/* === 7. SPLASH SCREEN — Deep Ocean Gradient === */
#splash-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
  overflow: hidden;
  background: linear-gradient(160deg, #011918 0%, #074A6E 40%, #0D7CC4 100%);
}

.splash-wave {
  position: absolute;
  top: 0; left: -20%; right: -20%;
  height: 60%;
  background: radial-gradient(ellipse at 50% 0%, rgba(56,189,248,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.splash-content {
  position: relative;
  z-index: 3;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.splash-logo {
  width: 180px;
  height: auto;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.35));
  animation: splashLogoIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}

.splash-subtitle {
  font-size: 15px;
  font-weight: 400;
  opacity: 0;
  letter-spacing: 0.5px;
  margin: 0;
  animation: splashTextIn 0.6s ease-out 0.3s forwards;
}

.splash-spinner {
  width: 28px; height: 28px;
  margin-top: 40px;
  border: 2.5px solid rgba(255,255,255,0.15);
  border-top-color: rgba(255,255,255,0.9);
  border-radius: 50%;
  animation: splashSpin 0.7s linear infinite;
  opacity: 0;
  animation: splashSpin 0.7s linear infinite, splashTextIn 0.4s ease-out 0.6s forwards;
}

.splash-footer {
  position: absolute;
  bottom: 32px;
  z-index: 3;
  opacity: 0;
  animation: splashTextIn 0.6s ease-out 0.5s forwards;
}

.splash-sps-logo {
  height: 28px;
  width: auto;
  opacity: 0.4;
}

@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(0.85) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes splashTextIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 0.8; transform: translateY(0); }
}

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

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

/* === 7b. NOTIFICATION BOTTOM SHEET === */
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
}

.bottom-sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bottom-sheet.visible .bottom-sheet-overlay {
  opacity: 1;
}

.bottom-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface, #fff);
  border-radius: 20px 20px 0 0;
  padding: 16px 24px calc(32px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
}

.bottom-sheet.visible .bottom-sheet-content {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--divider, #E0E0E0);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.bottom-sheet-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-light, #E3F2FD);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.bottom-sheet-icon .material-icons {
  font-size: 28px;
  color: var(--primary-color, #1976D2);
}

.bottom-sheet-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-primary, #212121);
}

.bottom-sheet-desc {
  font-size: 14px;
  color: var(--text-secondary, #757575);
  line-height: 1.5;
  margin: 0 0 24px;
}

.bottom-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bottom-sheet-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, opacity 0.15s;
}

.bottom-sheet-btn:active {
  transform: scale(0.97);
}

.bottom-sheet-btn.primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(13, 124, 196, 0.3);
}

.bottom-sheet-btn.secondary {
  background: transparent;
  color: var(--text-secondary, #757575);
}

.bottom-sheet-btn .material-icons {
  font-size: 20px;
}

/* === 8. PULL-TO-REFRESH === */
.ptr-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.15);
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.ptr-overlay.active { opacity: 1; visibility: visible; }

.ptr-refresh-indicator {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.ptr-refresh-indicator.active { opacity: 1; visibility: visible; }

.ptr-loading-circle {
  position: relative;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptr-favicon-container {
  position: relative;
  z-index: 3;
  width: 50px; height: 50px;
  border-radius: 50%;
  overflow: hidden;
}

.ptr-favicon-container img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ptr-water-fill {
  height: 0;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(0deg, #1976D2 0%, rgba(25,118,210,0.7) 70%, transparent 100%);
  border-radius: 50%;
  z-index: 1;
}

.ptr-refresh-indicator.active .ptr-water-fill {
  animation: ptrWaterFill 3s ease-out forwards;
}

@keyframes ptrWaterFill {
  0% { height: 0; }
  50% { height: 60%; }
  100% { height: 100%; }
}

.ptr-loading-circle::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: ptrWaves 2s infinite;
  z-index: 2;
}

@keyframes ptrWaves {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.1; }
}

/* === 9. OFFLINE & CONNECTION BANNERS === */
.offline-banner {
  background: #F44336;
  color: white;
  padding: 12px 16px;
  display: none;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.offline-banner.show { display: flex; }

.offline-content { display: flex; align-items: center; gap: 12px; flex: 1; }
.offline-text { display: flex; flex-direction: column; gap: 2px; }
.offline-title { font-weight: 500; }
.offline-subtitle { font-size: 12px; opacity: 0.9; }

.retry-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connection-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #ff9800;
  color: white;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.connection-banner.show { transform: translateY(0); }
.connection-banner .material-icons { font-size: 18px; }

/* === 10. STATUS BANNER === */
.status-banner {
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  padding: 12px 16px;
  flex-shrink: 0;
}

.status-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-icon .material-icons { font-size: 24px; color: var(--success); }
.status-text { display: flex; flex-direction: column; }
.status-title { font-weight: 500; font-size: 14px; color: var(--text-primary); }
.status-message { font-size: 13px; color: var(--text-secondary); }

/* === 11. LOADING === */
.loading-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner { text-align: center; color: var(--primary-color); }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--primary-light);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-variant) 25%,
    var(--surface) 50%,
    var(--surface-variant) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
}

.skeleton-line {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 10px;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.long { width: 90%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 10px; }

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

/* === 12. HOME PAGE — Premium Layout === */
.home-page { padding: 20px 16px; }

.welcome-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, #074A6E 100%);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  margin-bottom: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.welcome-section::after {
  content: '';
  position: absolute;
  top: -30%; right: -20%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.welcome-title { font-size: var(--font-xl); font-weight: 700; color: white; margin: 0 0 8px; letter-spacing: -0.02em; }
.welcome-text { font-size: var(--font-sm); color: rgba(255,255,255,0.85); line-height: 1.5; margin: 0; }

.services-section { margin-bottom: 24px; }
.services-title { font-size: var(--font-lg); font-weight: 700; color: var(--text-primary); margin: 0 0 14px; letter-spacing: -0.02em; }

.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.service-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-base);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  min-height: 110px;
  position: relative;
  touch-action: manipulation;
  border: 1px solid var(--border-subtle);
}

.service-card:active {
  transform: scale(0.96);
}

.service-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-icon.blue { background: linear-gradient(135deg, #0D7CC4, #074A6E); color: white; }
.service-icon.orange { background: linear-gradient(135deg, #F59E0B, #D97706); color: white; }
.service-icon.red { background: linear-gradient(135deg, #EF4444, #DC2626); color: white; }
.service-icon .material-icons { font-size: 24px; }

.service-content { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.service-title { font-size: var(--font-md); font-weight: 700; color: var(--text-primary); margin: 0; }
.service-subtitle { font-size: var(--font-xs); color: var(--text-secondary); margin: 0; }

.service-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--warning);
  color: white;
  border-radius: var(--radius-full);
  width: 22px; height: 22px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(245,158,11,0.3);
}

.service-card.urgent {
  animation: subtle-pulse 2s infinite;
  border: 2px solid rgba(245,158,11,0.3);
}

.service-card.urgent .service-icon { animation: subtle-glow 2s infinite; }

/* === 13. TRANSIT CARDS — Premium Compact Design === */
.transit-card-android {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  touch-action: manipulation;
  transition: transform var(--transition-fast), box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

.transit-card-android:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-card-hover);
}

/* Status highlight animation when SSE updates */
.transit-card-android.status-changed {
  animation: status-highlight 3s ease-out;
}

@keyframes status-highlight {
  0% { box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-card); }
  100% { box-shadow: var(--shadow-card); }
}

.card-header-android {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.company-logo-square {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
  background: var(--surface);
}

.company-logo-img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: white;
  padding: 4px;
}

.company-logo-fallback {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: white;
  letter-spacing: -0.02em;
}

.vessel-info-android { flex: 1; min-width: 0; }

.vessel-name-android {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 1px 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.route-text-android {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.2;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.route-text-android::-webkit-scrollbar { display: none; }

.heart-button-android { flex-shrink: 0; }

.heart-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: transform var(--transition-spring);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.heart-btn:active { transform: scale(0.85); }

.heart-btn .material-icons {
  font-size: 24px;
  color: var(--text-tertiary);
  transition: color var(--transition-fast), transform var(--transition-spring);
}

.heart-btn.active .material-icons { color: #EC4899; }
.heart-btn.animate .material-icons { animation: heart-pop 0.4s var(--transition-spring); }

@keyframes heart-pop {
  0% { transform: scale(0.85); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Time display — compact inline */
.time-display-android {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.scheduled-time-android,
.actual-time-android {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--status-scheduled-bg);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

.scheduled-time-android .time-icon,
.actual-time-android .time-icon { font-size: 15px; color: var(--primary-color); }
.actual-time-android .time-icon { color: var(--warning); }

.time-content-android { display: flex; flex-direction: column; }

.actual-time-android {
  background: var(--status-delayed-bg);
}

.time-label-android { font-size: 10px; font-weight: 600; color: var(--primary-color); line-height: 1; letter-spacing: 0.03em; text-transform: uppercase; }
.actual-time-android .time-label-android { color: var(--warning); }

.time-value-android { font-size: 15px; font-weight: 700; color: var(--primary-color); line-height: 1.2; letter-spacing: -0.02em; }
.actual-time-android .time-value-android { color: var(--warning); }

/* Delay reason */
.delay-reason-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--status-delayed-bg);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
}

.delay-icon { font-size: 18px; color: var(--warning); }
.delay-reason-text { font-size: 12px; color: var(--text-primary); flex: 1; font-weight: 500; }

.theme-dark .delay-reason-row,
body.dark-theme .delay-reason-row { background: rgba(251, 191, 36, 0.1); }

/* Status row — full-width badge */
.status-row-android { margin-bottom: 10px; }
.status-row-android:empty { margin-bottom: 0; display: none; }

/* Favorite button */
.favorite-btn-android {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.favorite-btn-android:hover { background: rgba(236,72,153,0.08); color: #EC4899; }
.favorite-btn-android.active { color: #EC4899; }
.favorite-btn-android .material-icons { font-size: 24px; }

/* Modern transit card variant */
.transit-card-modern {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.company-logo-container {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.company-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }

.company-logo-text {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
}

.transit-main-info { flex: 1; }
.vessel-name { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }

.route-info { display: flex; align-items: center; gap: 4px; font-size: 14px; color: #666; }
.route-prefix { color: #999; }
.route-destination { color: var(--text-primary); font-weight: 500; }

.favorite-container { position: absolute; top: 16px; right: 16px; }

.favorite-btn {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #ddd;
}

.favorite-btn.active { color: #e91e63; }
.favorite-btn:hover { background: rgba(0,0,0,0.05); }

.time-info-section { display: flex; gap: 16px; align-items: center; margin-top: 8px; }

.scheduled-time,
.actual-time { display: flex; flex-direction: column; gap: 2px; }

.time-label { font-size: 12px; color: #999; text-transform: uppercase; font-weight: 500; }
.time-value { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.actual-time .time-label { color: #ff9800; }
.actual-time .time-value { color: #ff9800; }

.status-section { margin: 8px 0; }

.location-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
  margin-top: 8px;
}

.dock-info, .transport-info { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #666; }
.dock-info .material-icons, .transport-info .material-icons { font-size: 14px; color: #999; }

/* === 14. STATUS BADGES — Pill Design with Status Variables === */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 700;
  border: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: transform var(--transition-fast);
}

.status-badge .material-icons { font-size: 14px; }

/* Status-specific colors using CSS variables */
.status-badge.entry { background: var(--status-vehicles-bg); color: var(--status-vehicles); }
.status-badge.boarding { background: var(--status-boarding-bg); color: var(--status-boarding); animation: pulse-subtle 2s infinite; }
.status-badge.last-call { background: var(--status-boarding-bg); color: var(--status-boarding); animation: pulse-subtle 1.5s infinite; }
.status-badge.boarding-closed { background: var(--status-cancelled-bg); color: var(--status-cancelled); }
.status-badge.departed { background: var(--status-departed-bg); color: var(--status-departed); }
.status-badge.disembarking { background: var(--status-arriving-bg); color: var(--status-arriving); animation: pulse-subtle 2s infinite; }
.status-badge.arriving { background: var(--status-arriving-bg); color: var(--status-arriving); animation: pulse-subtle 2s infinite; }
.status-badge.delayed { background: var(--status-delayed-bg); color: var(--status-delayed); }
.status-badge.cancelled { background: var(--status-cancelled-bg); color: var(--status-cancelled); text-decoration: line-through; }
.status-badge.docked { background: var(--status-docked-bg); color: var(--status-docked); }
.status-badge.unknown { background: var(--status-cancelled-bg); color: var(--status-cancelled); }

@keyframes pulse-subtle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* === 15. PAGES === */
.page-header {
  background: transparent;
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title { font-size: var(--font-2xl); font-weight: 700; color: var(--text-primary); margin: 0; letter-spacing: -0.02em; }

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

.refresh-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
  box-shadow: 0 2px 8px rgba(13, 124, 196, 0.25);
}

.refresh-btn:active { transform: scale(0.9); }

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

.clear-all-btn {
  background: #f44336;
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.clear-all-btn:hover { background: #d32f2f; }

.transits-list { padding: 12px 16px; }

/* Bottom info row — pier + transport inline */
.bottom-info-android {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pier-info-complete,
.transport-info-complete {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.pier-info-complete .material-icons,
.transport-info-complete .material-icons {
  font-size: 15px;
  color: var(--text-tertiary);
}

/* Pill "Vai al Molo X" affianco al badge status */
.status-row-android {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pier-maps-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary-color);
  text-decoration: none;
  padding: 5px 11px 5px 8px;
  background: #fff;
  border: 1.5px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
  border-radius: 14px;
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.pier-maps-link .maps-icon-color {
  flex-shrink: 0;
  display: block;
}
.pier-maps-link .pier-maps-label { line-height: 1.1; }
.pier-maps-link::after {
  content: '›';
  font-size: 15px;
  line-height: 1;
  margin-left: 2px;
  opacity: 0.65;
}
.pier-maps-link:hover,
.pier-maps-link:focus-visible {
  background: color-mix(in srgb, var(--primary-color) 6%, #fff);
  border-color: var(--primary-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.pier-maps-link:active { transform: scale(0.97); }

.pier-text, .transport-text { font-weight: 500; }

/* Compact info row — time + pier + transport on one line */
.card-info-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.time-compact {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.time-compact .time-icon { font-size: 16px; color: var(--primary-color); }
.time-compact .time-scheduled { color: var(--text-primary); }
.time-compact .time-arrow { color: var(--text-tertiary); font-weight: 400; margin: 0 2px; }
.time-compact .time-actual { color: var(--warning); }

.pier-compact,
.transport-compact {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--font-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.pier-compact .material-icons,
.transport-compact .material-icons {
  font-size: 14px;
  color: var(--text-tertiary);
}

/* === 16. LEGENDS & INFO === */
.legend-section,
.info-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
}

.legend-title, .info-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-items { display: flex; flex-direction: column; gap: 12px; }

.legend-item { display: flex; align-items: center; gap: 12px; }

.legend-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.legend-icon.boarding { background: rgba(255,152,0,0.1); color: #FF9800; }
.legend-icon.completed { background: rgba(76,175,80,0.1); color: #4CAF50; }
.legend-icon.cancelled { background: rgba(244,67,54,0.1); color: #F44336; }
.legend-icon.delayed { background: rgba(255,193,7,0.1); color: #FFC107; }
.legend-icon .material-icons { font-size: 20px; }

.legend-text { font-size: 14px; color: var(--text-primary); }

.info-content { color: var(--text-secondary); line-height: 1.6; }
.info-content p { margin: 0 0 8px; display: flex; align-items: flex-start; gap: 4px; }
.info-content p:last-child { margin-bottom: 0; }
.heart-icon { color: #F44336; font-size: 16px !important; margin: 0 2px; }

/* Info box */
.info-box-android {
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.info-title-android { font-size: var(--font-md); font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.info-text-android { font-size: var(--font-sm); color: var(--text-secondary); line-height: 1.5; }
.info-bullet-android { font-size: 18px; color: var(--text-tertiary); flex-shrink: 0; }

.info-item-android {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.info-item-android:not(:last-child) {
  border-bottom: 1px solid var(--border-subtle);
}

/* Empty state — centered, minimal */
.empty-state-android { text-align: center; padding: 60px 32px; color: var(--text-secondary); }
.empty-icon-android .material-icons { font-size: 56px; color: var(--text-tertiary); opacity: 0.5; }
.empty-title-android { font-size: var(--font-lg); font-weight: 700; color: var(--text-primary); margin: 16px 0 8px; letter-spacing: -0.01em; }
.empty-subtitle-android { font-size: var(--font-sm); color: var(--text-secondary); line-height: 1.6; max-width: 280px; margin: 0 auto; }

/* === 17. FOLLOWED SHIPS EMPTY STATE === */
.followed-ships-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 40px 20px;
  text-align: center;
}

.empty-state-content { max-width: 400px; width: 100%; }

.empty-heart-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(158,158,158,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.empty-heart-icon .material-icons { font-size: 40px; color: #9E9E9E; }
.empty-title { font-size: 20px; font-weight: 600; color: var(--text-primary); margin: 0 0 8px 0; }
.empty-subtitle { font-size: 14px; color: var(--text-secondary); margin: 0 0 32px 0; }

.instructions-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 20px;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.instruction-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.instruction-item:not(:last-child) { border-bottom: 1px solid var(--divider); }

.instruction-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(25,118,210,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.instruction-icon .material-icons { font-size: 16px; color: #1976D2; }
.instruction-text { flex: 1; font-size: 14px; color: var(--text-primary); line-height: 1.4; }
.instruction-text strong { font-weight: 600; color: var(--text-primary); }
.heart-demo { font-size: 16px; margin: 0 2px; }

.followed-count {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(233,30,99,0.08), rgba(233,30,99,0.15));
  border: 1px solid rgba(233,30,99,0.2);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 12px;
  color: #C2185B;
}
.followed-count-icon {
  font-size: 22px;
  color: #E91E63;
  flex-shrink: 0;
}
.followed-count-text {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
}
.followed-count-text strong {
  font-weight: 700;
}

/* === 18. BUS CARDS === */
.bus-card-android {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  position: relative;
}

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

.bus-info-row { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bus-name-android { font-size: 16px; font-weight: 600; margin: 0; color: var(--text-primary); flex: 1; }

.bus-time-android {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--status-scheduled-bg);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.bus-time-android .time-icon { font-size: 14px; color: var(--primary-color); }
.bus-time-android .time-value { font-size: 14px; font-weight: 700; color: var(--primary-color); }
.bus-time-android .time-not-available { font-size: var(--font-xs); color: var(--text-tertiary); }

.bus-in-evidence {
  border: 2px solid var(--warning) !important;
  box-shadow: 0 0 12px rgba(245,158,11,0.2);
  background: var(--status-delayed-bg);
}

.bus-in-evidence .company-logo-text {
  background: #FF9800 !important;
  animation: pulse 2s infinite;
}

.bus-notification-badge {
  position: absolute;
  top: -6px; right: -6px;
  background: #f44336;
  color: white;
  font-size: 12px;
  font-weight: bold;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.bus-alert { font-weight: 600; font-size: 13px; }

.bus-card-special {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: white;
  position: relative;
}

.bus-card-special .service-title,
.bus-card-special .service-subtitle { color: white; }
.bus-card-special .service-icon { background: rgba(255,255,255,0.2); color: white; }

/* === 19. FOLLOW FEEDBACK === */
.follow-feedback {
  position: fixed;
  bottom: 80px;
  left: 16px; right: 16px;
  z-index: 1001;
  border-radius: var(--radius-md);
  color: white;
  font-size: var(--font-sm);
  box-shadow: var(--shadow-lg);
  animation: toast-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes toast-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.follow-feedback.added { background: #059669; }
.follow-feedback.removed { background: #6B7280; }

.feedback-content { display: flex; align-items: center; padding: 12px 16px; gap: 12px; }
.feedback-content .material-icons { font-size: 18px; }
.feedback-text { flex: 1; font-weight: 500; }

.feedback-action {
  background: none;
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.feedback-action:hover { background: rgba(255,255,255,0.2); }

/* === 20. MODALS === */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h2 { margin: 0; font-size: 20px; color: var(--text-primary); }

.setting-section { margin-bottom: 20px; }
.setting-section h3 { font-size: 16px; color: var(--primary-color); margin: 0 0 12px; }

.setting-item {
  width: 100%;
  padding: 16px;
  background: none;
  border: 1px solid var(--divider);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.setting-item:hover { border-color: var(--primary-color); }

.modal-actions { display: flex; gap: 12px; margin-top: 24px; }

.modal-close {
  flex: 1;
  padding: 12px 24px;
  background: none;
  border: 1px solid var(--divider);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-primary {
  flex: 2;
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

/* === 21. SETTINGS MODAL === */
.modal-content.settings-modal { padding: 0 !important; }

.settings-modal {
  background: var(--card-bg);
  border-radius: var(--radius-2xl);
  padding: 0;
  max-width: 480px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--settings-header-bg);
  position: sticky;
  top: 0;
  z-index: 10;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.settings-header h2 {
  margin: 0;
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.modal-close-x {
  background: var(--modal-close-bg);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-x:hover {
  background: var(--modal-close-hover);
  color: var(--primary-color);
}

.settings-body { padding: 20px 24px 32px; }

.setting-group { margin-bottom: 24px; }
.setting-group:last-child { margin-bottom: 0; }

.setting-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setting-group-title .material-icons { font-size: 18px; color: var(--primary-color); }

.setting-buttons { display: flex; flex-direction: column; gap: 12px; }

.setting-button {
  background: var(--surface-variant);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.setting-button:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.setting-button:active { transform: scale(0.98); }

.setting-button.selected {
  border: 2px solid var(--primary-color) !important;
  background: var(--primary-light) !important;
  box-shadow: 0 0 0 3px rgba(13, 124, 196, 0.1) !important;
}

.setting-button .setting-icon {
  font-size: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.setting-info { display: flex; flex-direction: column; gap: 4px; }
.setting-name { font-weight: 500; color: var(--text-primary); }
.setting-desc { font-size: 12px; color: var(--text-secondary); }
.setting-text { font-weight: 500; color: var(--text-primary); }

.save-settings-btn {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-base);
  margin-top: 20px;
  box-shadow: 0 4px 12px rgba(13, 124, 196, 0.25);
  letter-spacing: -0.01em;
}

.save-settings-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13, 124, 196, 0.35);
}

.save-settings-btn:active { transform: scale(0.98); }

/* Text Size Control */
.text-size-control {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card-bg, #f5f5f5);
  border-radius: 12px;
}

.text-size-label {
  font-weight: 600;
  color: var(--text-secondary, #666);
  user-select: none;
  line-height: 1;
}
.text-size-small { font-size: 13px; }
.text-size-large { font-size: 22px; }

.text-size-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border-subtle, #e0e0e0);
  border-radius: 3px;
  outline: none;
}
.text-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: var(--primary-color, #0D7CC4);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.text-size-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--primary-color, #0D7CC4);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.text-size-preview {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary, #999);
  margin-top: 6px;
  font-weight: 500;
}

/* Text Scale — applied to html via JS */
html[data-text-scale="1"] { font-size: 110%; }
html[data-text-scale="2"] { font-size: 120%; }
html[data-text-scale="3"] { font-size: 130%; }
html[data-text-scale="4"] { font-size: 140%; }

.notification-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card-bg, #f5f5f5);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-primary, #333);
}

.notification-status-row .material-icons {
  font-size: 20px;
}

.notification-status-row .material-icons.granted { color: #43a047; }
.notification-status-row .material-icons.denied { color: #e53935; }
.notification-status-row .material-icons.default-perm { color: #ff9800; }

.setting-help-text {
  font-size: 13px;
  color: var(--text-secondary, #999);
  margin-top: 8px;
  line-height: 1.4;
  padding: 0 4px;
}

.settings-footer {
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-color, #e0e0e0);
}

.settings-version {
  font-size: 12px;
  color: var(--text-secondary, #999);
  margin: 0;
}

/* Flag icons */
.flag-icon {
  position: relative;
  display: inline-block;
  font-size: 24px;
  width: 32px; height: 24px;
  text-align: center;
  line-height: 24px;
}

.flag-text {
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  background: #2196F3;
  padding: 2px 4px;
  border-radius: 3px;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.language-flag-android {
  font-size: 32px !important;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji", system-ui, sans-serif !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  position: relative;
}

/* === 22. PWA INSTALL OVERLAYS === */
.pwa-install-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.pwa-install-modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: modalSlideUp 0.3s ease-out;
}

.pwa-install-icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.pwa-install-icon img { width: 100%; height: 100%; object-fit: cover; }
.pwa-install-title { font-size: 20px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.pwa-install-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.4; }
.pwa-install-actions { display: flex; gap: 12px; justify-content: center; }

.pwa-install-btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.pwa-install-btn.primary { background: var(--primary-color); color: white; }
.pwa-install-btn.primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.pwa-install-btn.secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--divider); }
.pwa-install-btn.secondary:hover { background: var(--surface-variant); }

/* Install choice */
.install-choice-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.install-choice-content {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.install-choice-header { margin-bottom: 24px; }

.install-app-icon {
  width: 80px; height: 80px;
  margin: 0 auto 16px;
  background: var(--primary-light);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.install-app-icon img { width: 60px; height: 60px; border-radius: 15px; }
.install-choice-header h3 { font-size: 22px; font-weight: 600; color: var(--text-primary); margin: 0 0 8px; }
.install-choice-header p { font-size: 14px; color: var(--text-secondary); margin: 0; line-height: 1.4; }

.install-features {
  display: flex;
  justify-content: space-around;
  margin: 24px 0;
  padding: 20px 0;
  background: var(--primary-light);
  border-radius: 12px;
}

.install-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--primary-color);
  font-weight: 500;
}

.install-feature .material-icons { font-size: 24px; color: var(--primary-color); }
.install-choice-actions { display: flex; gap: 12px; }

.install-later-btn,
.install-now-btn {
  flex: 1;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.install-later-btn { background: rgba(117,117,117,0.1); color: var(--text-secondary); border: 1px solid var(--divider); }
.install-later-btn:hover { background: rgba(117,117,117,0.2); }
.install-now-btn { background: var(--primary-color); color: white; }
.install-now-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.install-later-btn .material-icons, .install-now-btn .material-icons { font-size: 18px; }

/* Manual install instructions */
.manual-install-instructions { margin: 20px 0; text-align: left; }

.install-step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--surface-variant);
  border-radius: 8px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #2196F3;
  color: white;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.step-text { color: var(--text-primary); font-size: 14px; }

/* PWA install progress */
.pwa-install-progress-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.pwa-install-progress-modal {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-progress-icon { width: 80px; height: 80px; margin: 0 auto 24px; display: flex; align-items: center; justify-content: center; }
.pwa-install-progress-icon img { width: 100%; height: 100%; border-radius: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.pwa-install-progress-title { font-size: 22px; font-weight: 700; color: var(--primary-color); text-align: center; margin: 0 0 12px; }
.pwa-install-progress-subtitle { font-size: 15px; color: var(--text-secondary); text-align: center; margin: 0 0 32px; line-height: 1.5; }

.pwa-install-progress-bar-container {
  width: 100%; height: 8px;
  background: var(--primary-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
}

.pwa-install-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1976D2, #42A5F5, #1976D2);
  background-size: 200% 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressGradient 2s ease infinite;
}

.pwa-install-progress-text { font-size: 14px; color: var(--primary-color); text-align: center; font-weight: 600; }

.pwa-install-success-icon {
  width: 60px; height: 60px;
  margin: 0 auto 20px;
  background: #4CAF50;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-install-success-icon .material-icons { font-size: 36px; color: white; }

/* === 23. (REMOVED - old notification prompts, replaced by bottom sheet in 7b) === */

/* Notification card (setup step 3) */
.notification-card-white {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  color: var(--text-primary);
}

.notification-header { text-align: center; margin-bottom: 24px; }
.notification-icon-large { font-size: 64px; margin-bottom: 16px; }
.notification-header h3 { color: var(--primary-color); font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.notification-header p { color: var(--text-secondary); font-size: 16px; line-height: 1.4; }

.notification-benefits { margin-bottom: 24px; }

.benefit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.benefit-item:last-child { border-bottom: none; }
.benefit-icon { font-size: 20px; width: 28px; text-align: center; }
.benefit-item span:last-child { color: var(--text-primary); font-size: 16px; font-weight: 500; }

.notification-enable-btn-white {
  width: 100%;
  padding: 16px 24px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.notification-enable-btn-white:hover {
  background: #1565c0;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(25,118,210,0.3);
}

.notification-skip-btn-white {
  width: 100%;
  padding: 12px 24px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--divider);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.notification-skip-btn-white:hover { background: var(--surface-variant); }

.notification-help {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface-variant);
  border-radius: 12px;
  border-left: 4px solid #2196f3;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.help-icon { font-size: 24px; color: #2196f3; min-width: 28px; }
.help-content { flex: 1; }
.help-content strong { color: var(--primary-color); font-size: 16px; display: block; margin-bottom: 8px; }
.help-content p { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
.help-content ol { color: var(--text-primary); font-size: 14px; padding-left: 20px; }
.help-content li { margin-bottom: 6px; line-height: 1.4; }
.help-content li strong { color: var(--primary-color); font-weight: 600; display: inline; font-size: inherit; margin: 0; }

/* === 24. SETUP SCREEN === */
#setup-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
  display: flex;
  justify-content: center;
  overflow-y: auto;
  z-index: 9999;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

#setup-screen::-webkit-scrollbar { width: 6px; }
#setup-screen::-webkit-scrollbar-track { background: transparent; }
#setup-screen::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }
#setup-screen::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }

.setup-container {
  width: 100%;
  max-width: 450px;
  padding: 20px 20px 60px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  margin: 0 auto;
  min-height: 100vh;
}

.setup-header-android { text-align: center; margin-bottom: 16px; color: white; flex-shrink: 0; }

.setup-logo-android {
  width: 60px; height: 60px;
  margin: 0 auto 8px;
  background: white;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.setup-logo-android img { width: 40px; height: 40px; border-radius: 10px; }
.setup-title-android { font-size: 18px; font-weight: 600; color: white; margin: 0 0 4px 0; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.setup-subtitle-android { font-size: 12px; color: rgba(255,255,255,0.9); margin: 0; font-weight: 400; }

.setup-progress-android { width: 100%; margin-bottom: 32px; }

.progress-steps-android { display: flex; align-items: center; justify-content: center; gap: 0; }

.step-circle-android {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.step-circle-android.active { background: white; border-color: white; color: #1976d2; }

.progress-line-android { width: 120px; height: 2px; background: rgba(255,255,255,0.3); margin: 0; }

.setup-step-android { width: 100%; display: flex; flex-direction: column; }
.step-title-android { font-size: 24px; font-weight: 600; color: white; text-align: left; margin: 0 0 32px 0; }

.language-options-android,
.port-options-android { display: flex; flex-direction: column; gap: 16px; width: 100%; }

.language-button-android,
.port-button-android {
  width: 100%;
  min-height: 80px;
  padding: 20px 24px;
  background: white;
  border: 2px solid transparent;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

.language-button-android:hover,
.port-button-android:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.language-button-android.selected,
.port-button-android.selected { border-color: #1976d2; background: #f3f8ff; }

.language-content-android, .port-content-android { display: flex; align-items: center; gap: 16px; }
.port-icon-android { font-size: 24px; }
.language-text-android, .port-name-android { font-size: 18px; font-weight: 500; color: #333; }
.port-info-android { display: flex; flex-direction: column; align-items: flex-start; }
.port-desc-android { font-size: 14px; color: #666; margin-top: 2px; }

.radio-indicator-android { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #ccc; position: relative; }

.language-button-android.selected .radio-indicator-android,
.port-button-android.selected .radio-indicator-android { border-color: #1976d2; }

.language-button-android.selected .radio-indicator-android::after,
.port-button-android.selected .radio-indicator-android::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 12px;
  background: #1976d2;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.setup-actions-android { width: 100%; margin-top: 32px; }

.continue-btn-android {
  width: 100%;
  padding: 16px 32px;
  background: white;
  color: #1976d2;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.continue-btn-android:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.continue-btn-android:active { transform: translateY(0); }

/* Old setup variants */
.setup-content {
  width: 100%; max-width: 400px;
  padding: 20px 32px 32px;
  color: white;
  display: flex; flex-direction: column;
  justify-content: flex-start;
  min-height: 100vh; height: auto;
  padding-top: max(20px, calc(50vh - 300px));
}

.setup-header { text-align: center; margin-bottom: 48px; }

.setup-logo {
  width: 80px; height: 80px;
  margin: 0 auto 24px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.setup-logo img { width: 60px; height: 60px; border-radius: 15px; }
.setup-header h1 { font-size: 24px; font-weight: 600; margin: 0 0 8px; }
.setup-header p { font-size: 16px; opacity: 0.9; margin: 0; }

.setup-progress { margin-bottom: 48px; display: flex; justify-content: center; }
.progress-steps { display: flex; align-items: center; gap: 16px; }

.step-indicator {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.step-indicator.active { background: white; color: #1976D2; }
.step-line { width: 40px; height: 2px; background: rgba(255,255,255,0.3); }

.setup-steps { margin-bottom: 48px; }
.setup-step { display: none; }
.setup-step.active { display: block; }
.setup-step h2 { font-size: 32px; font-weight: 400; margin: 0 0 40px; text-align: center; }

.language-options, .port-options { display: flex; flex-direction: column; gap: 16px; }

.setup-button {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 16px;
  padding: 20px 24px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
  font-size: 18px;
  backdrop-filter: blur(10px);
  width: 100%;
}

.setup-button:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.6); transform: translateY(-2px); }
.setup-button.selected { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.8); }
.setup-button .flag, .setup-button .port-icon { font-size: 28px; flex-shrink: 0; }
.language-text { font-weight: 500; font-size: 18px; }
.port-info { display: flex; flex-direction: column; gap: 4px; }
.port-name { font-weight: 600; font-size: 18px; }
.port-desc { font-size: 14px; opacity: 0.8; }

.setup-navigation { display: flex; justify-content: center; margin-top: 32px; }

.setup-btn {
  padding: 16px 48px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 160px;
}

.setup-btn.primary { background: white; color: #1976D2; }
.setup-btn.primary:hover { background: rgba(255,255,255,0.9); transform: translateY(-2px); }

/* Step 3 usage cards */
.step-content-android { display: flex; flex-direction: column; }
.step-subtitle-android { text-align: center; color: #666; margin-bottom: 24px; }

.usage-options-cards { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 24px; }

.usage-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.usage-card:hover { border-color: #1976d2; box-shadow: 0 4px 16px rgba(25,118,210,0.15); transform: translateY(-2px); }
.usage-card-icon { font-size: 48px; margin-bottom: 12px; animation: bounce 2s infinite; }
.usage-card-title { font-size: 18px; font-weight: 600; color: #333; margin: 0 0 8px; }
.usage-card-desc { font-size: 14px; color: #666; margin: 0 0 16px; line-height: 1.5; }

.usage-card-benefits { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; }
.usage-card-benefits li { font-size: 13px; color: #555; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.usage-card-benefits li:last-child { border-bottom: none; }

.usage-card-btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.usage-card-btn.primary {
  background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(25,118,210,0.3);
}

.usage-card-btn.primary:hover { box-shadow: 0 6px 16px rgba(25,118,210,0.4); transform: translateY(-2px); }

.usage-card-btn.secondary { background: white; color: #1976d2; border: 2px solid #1976d2; }
.usage-card-btn.secondary:hover { background: #f5f5f5; transform: translateY(-2px); }

/* Dark theme usage cards */
.theme-dark .usage-card { background: #2E2E2E; border-color: #444; }
.theme-dark .usage-card:hover { border-color: #42A5F5; }
.theme-dark .usage-card-title { color: #FFFFFF; }
.theme-dark .usage-card-desc { color: #CCCCCC; }
.theme-dark .usage-card-benefits li { color: #AAAAAA; border-bottom-color: #444; }
.theme-dark .usage-card-btn.secondary { background: #2E2E2E; color: #42A5F5; border-color: #42A5F5; }
.theme-dark .usage-card-btn.secondary:hover { background: #3E3E3E; }

/* === 25. DARK THEME OVERRIDES — Comprehensive === */
/* Most handled by CSS variables. These are component-specific overrides. */

/* Cards & surfaces */
.theme-dark .transit-card-android,
.theme-dark .service-card,
.theme-dark .legend-section,
.theme-dark .info-section,
.theme-dark .instructions-card,
.theme-dark .info-box-android {
  border-color: var(--divider);
  box-shadow: var(--shadow-card);
}

/* Welcome section keeps gradient but darker */
.theme-dark .welcome-section {
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
  border: 1px solid var(--divider);
}

/* Company logos */
.theme-dark .company-logo-square {
  background: var(--surface-variant);
  border-color: var(--divider);
}

.theme-dark .company-logo-img { background: var(--surface-variant); }

/* Time badges */
.theme-dark .scheduled-time-android { background: rgba(56, 189, 248, 0.1); }
.theme-dark .actual-time-android { background: rgba(251, 191, 36, 0.1); }
.theme-dark .time-label-android { color: var(--primary-color); }
.theme-dark .time-value-android { color: var(--primary-color); }
.theme-dark .actual-time-android .time-label-android { color: var(--warning); }
.theme-dark .actual-time-android .time-value-android { color: var(--warning); }

/* Followed count */
.theme-dark .followed-count { background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(236, 72, 153, 0.18)); border-color: rgba(236, 72, 153, 0.25); color: #F48FB1; }
.theme-dark .followed-count-icon { color: #F48FB1; }

/* Empty states */
.theme-dark .empty-state-android { color: var(--text-secondary); }
.theme-dark .empty-title-android { color: var(--text-primary); }
.theme-dark .empty-heart-icon { background: var(--surface-variant); }

/* Bottom navigation */
.theme-dark .bottom-nav { border-top-color: var(--divider); }

/* Header */
.theme-dark .app-header { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); }
.theme-dark .header-logo { background: var(--surface-variant); }

/* Buttons */
.theme-dark .clear-all-btn { background: #DC2626; }
.theme-dark .clear-all-btn:hover { background: #B91C1C; }
.theme-dark .refresh-btn { box-shadow: 0 2px 8px rgba(56, 189, 248, 0.2); }
.theme-dark .save-settings-btn { box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2); }

/* Settings */
.theme-dark .setting-button { border-color: var(--divider); box-shadow: none; }
.theme-dark .setting-button:hover { background: var(--surface-variant); border-color: var(--primary-color); }
.theme-dark .setting-button.selected { background: var(--primary-light) !important; border-color: var(--primary-color) !important; }
.theme-dark .notification-status-row { background: var(--surface-variant); }
.theme-dark .text-size-control { background: var(--surface-variant); }
.theme-dark .text-size-slider { background: rgba(255,255,255,0.15); }

/* Service cards */
.theme-dark .service-icon.blue { background: linear-gradient(135deg, #0EA5E9, #0284C7); }
.theme-dark .service-icon.orange { background: linear-gradient(135deg, #F59E0B, #D97706); }
.theme-dark .service-icon.red { background: linear-gradient(135deg, #EF4444, #DC2626); }

/* Bottom sheet */
.theme-dark .bottom-sheet-content { background: var(--surface); }
.theme-dark .bottom-sheet-handle { background: var(--divider); }
.theme-dark .bottom-sheet-btn.primary { background: linear-gradient(135deg, #0EA5E9, #0284C7); }

/* Bus cards */
.theme-dark .bus-time-android { background: rgba(56, 189, 248, 0.1); }
.theme-dark .bus-time-android .time-icon,
.theme-dark .bus-time-android .time-value { color: var(--primary-color); }
.theme-dark .bus-in-evidence { border-color: var(--warning); background: rgba(245, 158, 11, 0.08); }

/* Modals */
.theme-dark .modal-overlay { background: rgba(0, 0, 0, 0.7); }
.theme-dark .settings-modal { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }

/* Info section */
.theme-dark .info-bullet-android { color: var(--text-tertiary); }

/* Page header */
.theme-dark .page-header { background: transparent; }

/* Skeleton */
.theme-dark .skeleton {
  background: linear-gradient(90deg, var(--surface-variant) 25%, var(--surface) 50%, var(--surface-variant) 75%);
  background-size: 200% 100%;
}

/* Follow feedback toast */
.theme-dark .follow-feedback.added { background: #059669; }
.theme-dark .follow-feedback.removed { background: #475569; }

/* Offline/connection banners */
.theme-dark .offline-banner { background: #DC2626; }
.theme-dark .connection-banner { background: #D97706; }

/* === 26. ANIMATIONS === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalSlideUp { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes scaleIn { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }
@keyframes progressGradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); } 50% { box-shadow: 0 0 0 8px rgba(255,255,255,0); } }
@keyframes wobble { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes subtle-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes subtle-glow { 0%, 100% { box-shadow: 0 0 0 rgba(255,152,0,0); } 50% { box-shadow: 0 0 20px rgba(255,152,0,0.3); } }

/* === 27. RESPONSIVE === */
@media (max-width: 480px) {
  .home-page { padding: 16px 12px; }
  .transit-card-android { padding: 12px; }
  .company-logo-large { width: 70px; height: 70px; }
  .setup-container { padding: 24px 20px; }
  .setup-logo-android { width: 100px; height: 100px; }
  .setup-logo-android img { width: 70px; height: 70px; }
  .setup-title-android { font-size: 24px; }
  .step-title-android { font-size: 20px; }
  .language-button-android, .port-button-android { padding: 16px 20px; }
  .notification-card-white { padding: 20px; margin: 16px 0; }
  .notification-icon-large { font-size: 48px; margin-bottom: 12px; }
  .notification-header h3 { font-size: 20px; }
  .benefit-item { padding: 10px 0; }
  .benefit-item span:last-child { font-size: 15px; }
  .notification-help { padding: 16px; margin-top: 20px; }
  .help-content strong { font-size: 15px; }
  .pwa-install-modal { margin: 20px; padding: 20px; }
  .pwa-install-actions { flex-direction: column; }
  .pwa-install-btn { width: 100%; }
}

@media (min-width: 600px) {
  .usage-options-cards { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (max-height: 700px) {
  .setup-header-android { margin-top: 10px; margin-bottom: 30px; }
  .setup-logo-android { width: 100px; height: 100px; }
  .setup-logo-android img { width: 70px; height: 70px; }
  .setup-title-android { font-size: 24px; }
  .setup-subtitle-android { font-size: 14px; }
}

@media (max-height: 600px) {
  .setup-container { padding-top: 10px; }
  .setup-header-android { margin-top: 5px; margin-bottom: 20px; }
  .setup-logo-android { width: 80px; height: 80px; margin: 0 auto 16px; }
  .setup-logo-android img { width: 55px; height: 55px; }
  .setup-title-android { font-size: 20px; }
  .setup-subtitle-android { font-size: 13px; }
  .setup-content { padding-top: 10px; min-height: auto; }
  .setup-header { margin-bottom: 24px; }
  .setup-logo { width: 60px; height: 60px; }
  .setup-logo img { width: 45px; height: 45px; }
  .setup-header h1 { font-size: 20px; }
  .setup-progress { margin-bottom: 24px; }
}

@media (max-height: 500px) {
  .setup-content { padding: 10px 24px 20px; padding-top: 5px; }
  .setup-header { margin-bottom: 16px; }
  .setup-logo { width: 50px; height: 50px; margin: 0 auto 16px; }
  .setup-logo img { width: 35px; height: 35px; }
  .setup-header h1 { font-size: 18px; margin: 0 0 4px; }
  .setup-header p { font-size: 14px; }
  .setup-progress { margin-bottom: 16px; }
}

@media (min-width: 768px) {
  /* Desktop: App layout */
  #app { width: 100%; max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
  body { background: var(--background); padding: 0; }

  /* Desktop: Header */
  .app-header { border-radius: 0 0 24px 24px; margin-bottom: 16px; }

  /* Desktop: Bottom nav */
  .bottom-nav { position: fixed; left: 0; right: 0; border-radius: 0; margin-top: 0; }

  /* Desktop: Settings */
  .settings-modal { max-width: 800px; max-height: 85vh; border-radius: 24px; width: 90%; scrollbar-width: thin; scrollbar-color: rgba(25,118,210,0.3) transparent; }
  .settings-modal::-webkit-scrollbar { width: 8px; }
  .settings-modal::-webkit-scrollbar-track { background: transparent; }
  .settings-modal::-webkit-scrollbar-thumb { background: rgba(25,118,210,0.3); border-radius: 10px; }
  .settings-modal::-webkit-scrollbar-thumb:hover { background: rgba(25,118,210,0.5); }
  .settings-header { padding: 28px 32px 24px; border-radius: 24px 24px 0 0; }
  .settings-body { padding: 24px 32px 40px; }
  .setting-button { border-radius: 20px; padding: 20px 22px; gap: 16px; }
  .save-settings-btn { border-radius: 20px; padding: 20px 28px; font-size: 17px; margin-top: 24px; }

  /* Desktop: Setup */
  .setup-content { max-width: 480px; padding: 32px 48px 48px; padding-top: max(32px, calc(50vh - 350px)); }
  .setup-logo { width: 100px; height: 100px; }
  .setup-logo img { width: 75px; height: 75px; }
  .setup-header h1 { font-size: 28px; }
  .setup-header p { font-size: 18px; }
  .setup-container { max-width: 500px; padding: 40px 32px; }
  .setup-logo-android { width: 100px; height: 100px; }
  .setup-logo-android img { width: 70px; height: 70px; }
  .setup-title-android { font-size: 28px; margin-bottom: 8px; }
  .setup-subtitle-android { font-size: 16px; }
  .step-title-android { font-size: 32px; }
  .language-button-android, .port-button-android { min-height: 90px; padding: 24px 28px; }
  .language-text-android, .port-name-android { font-size: 20px; }
  .port-desc-android { font-size: 16px; }
  .continue-btn-android { padding: 18px 32px; font-size: 18px; }

  /* Desktop: Notifications */
  .notification-card-white { padding: 32px; }
  .notification-icon-large { font-size: 80px; }
  .notification-header h3 { font-size: 26px; }
  .notification-header p { font-size: 18px; }
  .benefit-item span:last-child { font-size: 18px; }
  .notification-enable-btn-white { font-size: 18px; padding: 18px 28px; }

  /* Desktop: Flags */
  .flag-it, .flag-gb {
    width: 28px !important; height: 20px !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    color: transparent !important;
    text-indent: -9999px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    border-radius: 2px !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
  }

  .flag-it {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect fill='%23009639' width='1' height='2'/%3E%3Crect fill='%23fff' x='1' width='1' height='2'/%3E%3Crect fill='%23cd212a' x='2' width='1' height='2'/%3E%3C/svg%3E") !important;
  }

  .flag-gb {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3Cpath fill='%23012169' d='M0 0h60v30H0z'/%3E%3Cpath fill='none' stroke='%23FFF' stroke-width='5' d='m0 0 60 30m0-30L0 30'/%3E%3Cpath fill='none' stroke='%23FFF' stroke-width='3' d='M30 0v30M0 15h60'/%3E%3Cpath fill='none' stroke='%23C8102E' stroke-width='3' d='m0 0 60 30m0-30L0 30'/%3E%3Cpath fill='none' stroke='%23C8102E' stroke-width='2' d='M30 0v30M0 15h60'/%3E%3C/svg%3E") !important;
  }

  .setting-button .flag-it, .setting-button .flag-gb { width: 32px !important; height: 24px !important; margin-right: 8px !important; }
  .setting-button .flag-it .flag-text, .setting-button .flag-gb .flag-text { display: none !important; }

  .setting-icon .flag-text { display: flex !important; }
  .setting-icon .flag-icon { font-size: 0; }

  .language-flag-android { font-size: 36px !important; width: 52px; height: 52px; }
  .language-flag-android[data-fallback] { font-size: 0 !important; color: transparent !important; }

  .language-flag-android[data-fallback="IT"]::after,
  .language-flag-android[data-fallback="EN"]::after {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 36px !important;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji" !important;
    z-index: 10 !important;
    background: transparent !important;
    color: initial !important;
  }

  .language-flag-android[data-fallback="IT"]::after { content: "\1F1EE\1F1F9" !important; }
  .language-flag-android[data-fallback="EN"]::after { content: "\1F1EC\1F1E7" !important; }
}

@media (min-width: 1024px) {
  .settings-modal { max-width: 900px; max-height: 80vh; border-radius: 28px; width: 85%; }
  .settings-header { padding: 32px 40px 28px; border-radius: 28px 28px 0 0; }
  .settings-body { padding: 28px 40px 48px; }
  .setting-button { padding: 22px 24px; gap: 18px; }
  .save-settings-btn { padding: 22px 32px; font-size: 18px; margin-top: 28px; }
}
