:root {
  --bg-primary: #090d16;
  --bg-surface: rgba(26, 36, 52, 0.68);
  --bg-surface-hover: rgba(34, 47, 68, 0.85);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-purple: #c084fc;
  --accent-green: #4ade80;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
  --badge-vpn: #818cf8;
  --badge-local: #34d399;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.45);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 16px 36px -8px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.18);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #000 url('icons/space-eclipse.jpg') no-repeat center center fixed;
  background-size: cover;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation */
.navbar {
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: -0.01em;
}

.nav-brand i {
  color: var(--accent-blue);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-blue);
}

@media (max-width: 640px) {
  .nav-container {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .nav-links {
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-between;
  }
  .nav-links a {
    font-size: 0.85rem;
  }
}

/* Page Layout */
.container {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #e0f2fe 10%, #38bdf8 55%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.4rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Accessibility: Visually Hidden for Screen Readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Profile Switcher */
.user-switch-bar {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  height: 42px;
  box-sizing: border-box;
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.35rem 0.5rem 0.35rem 1rem;
  box-shadow: var(--shadow);
}

.user-current {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.user-current strong {
  color: var(--text-main);
  font-weight: 600;
}

.switch-user-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.32rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.switch-user-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-blue);
  color: #fff;
}

/* Widgets Toolbar (Homepage Style: Date/Time + Profile Switcher + Live Search) */
.widgets-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.widget-item {
  background: rgba(22, 30, 46, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.45rem 1rem;
  height: 42px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow);
}

.widget-datetime {
  justify-self: start;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.widget-datetime i {
  color: var(--accent-blue);
}

.widget-date-divider {
  color: rgba(255, 255, 255, 0.3);
}

.widget-date {
  color: var(--text-muted);
}

.widget-search {
  justify-self: end;
  width: 100%;
  max-width: 320px;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.widget-search:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

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

#service-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
}

#service-search-input::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
}

.search-clear-btn:hover {
  color: var(--text-main);
}

@media (max-width: 860px) {
  .widgets-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
  }
  .widgets-bar .widget-datetime {
    order: 1;
    justify-self: auto;
  }
  .widgets-bar .user-switch-bar {
    order: 2;
    justify-self: auto;
  }
  .widgets-bar .widget-search {
    order: 3;
    justify-self: auto;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 580px) {
  .widgets-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .widgets-bar .user-switch-bar {
    justify-content: center;
  }
  .widgets-bar .widget-datetime {
    justify-content: center;
  }
}

/* Sections & Grid */
.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* Glassmorphic Cards */
.card {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.25s ease, 
              box-shadow 0.25s ease, 
              background 0.25s ease;
  box-shadow: var(--shadow);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  background: var(--bg-surface-hover);
  box-shadow: var(--shadow-hover);
}

button.card {
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border-style: solid;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.15rem;
  min-height: 44px;
}

/* Official Logo and Icon Containers */
.icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease;
}

.card:hover .icon-wrapper {
  transform: scale(1.04);
}

.service-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.icon-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-group .service-icon {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Legacy Icon wrappers (Profile cards & PWA tools) */
.icon-cloud   { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); font-size: 1.4rem; }
.icon-heart   { background: rgba(251, 113, 133, 0.15); color: var(--accent-rose); font-size: 1.4rem; }
.icon-penlair { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); font-size: 1.4rem; }
.icon-currency { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); font-size: 1.4rem; }
.icon-shopping { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); font-size: 1.4rem; }

/* Live Status Indicator (Pulse Dot like Homepage) */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid rgba(74, 222, 128, 0.28);
  letter-spacing: 0.03em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: pulse-dot 2.2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Badges */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-vpn,
.badge-remote {
  background: rgba(129, 140, 248, 0.15);
  color: var(--badge-vpn);
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.badge-local,
.badge-home {
  background: rgba(52, 211, 153, 0.15);
  color: var(--badge-local);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-warning {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-pwa {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-pwa-green {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.card-reminder:hover {
  border-color: var(--accent-amber);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Dual-Action Cards (Jellyfin + Seerr) */
.card-dual-service {
  cursor: default;
}

.card-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

.card-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.card-btn-primary {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.card-btn-primary:hover {
  background: rgba(168, 85, 247, 0.35);
  border-color: #c084fc;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.card-btn-secondary {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.card-btn-secondary:hover {
  background: rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

/* Install Button */
.nav-install-btn {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.nav-install-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.hidden {
  display: none !important;
}

/* Content Box (Guides) */
.content-box {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.content-box h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.content-box ol, .content-box ul {
  padding-left: 1.5rem;
  color: #cbd5e1;
  line-height: 1.7;
}

.alert-warning {
  background: rgba(251, 191, 36, 0.1);
  border-left: 4px solid var(--accent-amber);
  padding: 1rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  color: #fde68a;
}

.alert-danger {
  background: rgba(251, 113, 133, 0.12);
  border-left: 4px solid var(--accent-rose);
  padding: 1rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  color: #fecdd3;
}

/* Steps & Guides Styling */
.step-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.step-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
}

.step-card h3 {
  font-size: 1.15rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.step-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.option-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.option-card h4 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.option-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Quick Import Box */
.quick-import-box {
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.08) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0 1.5rem;
}

.quick-import-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.quick-import-header h3 {
  font-size: 1.15rem;
  color: var(--text-main);
  margin: 0;
}

.badge-quick {
  background: rgba(251, 191, 36, 0.2);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.quick-import-fallback {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.1);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  margin-top: 0.75rem;
}

/* View Transition support */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
