:root {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-strong: #273549;
  --surface-soft: rgba(30, 41, 59, 0.72);
  --text: #ffffff;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.16);
  --primary: #e3350d;
  --secondary: #ffd54f;
  --success: #22c55e;
  --warning: #facc15;
  --danger: #ef4444;
  --info: #38bdf8;
  --card-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(circle at top, rgba(227, 53, 13, 0.12), transparent 30%),
    linear-gradient(180deg, #0b1220 0%, var(--bg) 100%);
  color: var(--text);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(227, 53, 13, 0.75);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: clamp(18px, 3vw, 32px);
  padding: clamp(16px, 3vw, 24px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 24px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--card-shadow);
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #e3350d, #ff9f43);
  font-size: 1.4rem;
  font-weight: 800;
}

.brand-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.nav-menu {
  display: grid;
  gap: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  width: 100%;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(227, 53, 13, 0.16);
}

.nav-icon {
  font-size: 1.1rem;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.sidebar-action,
.primary-button,
.secondary-button,
.danger-button,
.pill-button,
.icon-button,
.text-button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  transition: transform 0.2s ease, background 0.2s ease;
}

.sidebar-action,
.primary-button,
.secondary-button,
.danger-button {
  width: 100%;
}

.sidebar-action,
.primary-button {
  background: var(--primary);
  color: #fff;
}

.secondary-button,
.text-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.pill-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  min-width: 120px;
}

.icon-button {
  background: rgba(255, 255, 255, 0.08);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
}

.icon-button:hover,
.text-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.pill-button:hover {
  transform: translateY(-1px);
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.mobile-nav {
  display: none;
}

.page-header,
.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.page-header {
  align-items: center;
}

.page-header h1,
.page-toolbar h2 {
  margin: 0;
}

.page-header .eyebrow,
.section-title,
.card-label,
.panel-title,
.help-text,
.timestamp {
  margin: 0;
}

.eyebrow,
.help-text,
.timestamp,
.card-label,
.panel-subtitle {
  color: var(--text-muted);
}

.page-header h1,
.section-title,
.panel-title {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.page-toolbar h2 {
  margin-bottom: 6px;
  font-size: 1.6rem;
}

.search-panel {
  display: grid;
  gap: 16px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 18px;
}

.search-panel.hidden {
  display: none;
}

.search-panel input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-grid,
.stats-grid,
.settings-grid {
  display: grid;
  gap: 20px;
}

/* Settings page polish: consistent vertical rhythm + control sizing */
#settingsPage.settings-grid,
#settingsPage .settings-grid {
  align-items: start;
}

.settings-card {
  display: grid;
  gap: 14px;
}

.settings-card .file-upload {
  width: 100%;
  justify-content: center;
  padding: 14px 18px;
  min-height: 46px;
}

/* Make the 3 storage actions feel like a single aligned control stack */
.settings-card .primary-button,
.settings-card .danger-button,
.settings-card .secondary-button {
  width: 100%;
  min-height: 46px;
  padding-left: 18px;
  padding-right: 18px;
}

/* Weekly reset section: tighten spacing between toggle and action */
.settings-card input[type='checkbox'] {
  width: 18px;
  height: 18px;
}

.settings-card label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}



.dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.status-card,
.card,
.stat-card,
.stat-panel,
.calendar-card,
.settings-card,
.dashboard-panel {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.status-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.status-card h2,
.status-card p,
.status-card .card-label {
  line-height: 1.2;
  margin: 0;
}

.status-card p,
.status-card h2 {
  display: block;
}

.status-card > div {
  display: grid;
  gap: 10px;
  align-content: center;
}

.card-icon {
  width: 64px;
  height: 64px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.6rem;
}

.accent-card {
  border-color: rgba(227, 53, 13, 0.3);
}

.warning-card {
  border-color: rgba(250, 204, 21, 0.3);
}

.info-card {
  border-color: rgba(56, 189, 248, 0.3);
}

.success-card {
  border-color: rgba(34, 197, 94, 0.3);
}

.purple-card {
  border-color: rgba(168, 85, 247, 0.3);
}

.dashboard-panel .insights-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.insight-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  padding: 18px;
}

.boss-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.region-group-header {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 16px 0 8px 0;
  margin-top: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.region-group-header:first-child {
  margin-top: 0;
}

.region-group {
  display: grid;
  gap: 14px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.boss-list,
.calendar-grid,
.boss-stack {
  display: grid;
  gap: 14px;
}

.boss-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.boss-card {
  display: grid;
  gap: 12px;
  border-radius: 20px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 150px;
}

.boss-card.is-flagged {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(59, 18, 18, 0.9) 100%);
  border-color: rgba(248, 113, 113, 0.45);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.16);
}

.boss-card.is-cooling {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(20, 54, 30, 0.85) 100%);
  border-color: rgba(74, 222, 128, 0.35);
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.12);
}

.boss-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.boss-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
}


.boss-location {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 600;
}

.boss-status,
.boss-countdown,
.boss-timer {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.3;
}


.region-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
  z-index: 10;
}

.region-badge.badge-kanto {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.32);
}

.region-badge.badge-johto {
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.32);
}

.region-badge.badge-hoenn {
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.32);
}

.region-badge.badge-sinnoh {
  background: rgba(34, 211, 238, 0.16);
  color: #a5f3fc;
  border-color: rgba(34, 211, 238, 0.32);
}

.boss-status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
}

.boss-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.boss-actions .icon-button,
.boss-actions .pill-button {
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.8rem;
}

.boss-actions .details-button {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(227, 53, 13, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #e0f2fe;
  font-weight: 700;
  padding: 8px 12px;
  min-height: 36px;
}

.badge-ready {
  color: var(--success);
}

.badge-cooling {
  color: var(--warning);
}

.badge-never {
  color: var(--info);
}

.stat-panel {
  display: grid;
  gap: 18px;
}

.stat-panel-row,
.settings-row,
.calendar-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.progress-group {
  display: grid;
  gap: 10px;
}

.progress-bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #e3350d, #ffd54f);
  transition: width 0.35s ease;
}

.calendar-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calendar-item {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

input[type='file'] {
  display: none;
}

.file-upload {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  color: var(--text);
}

/* Settings page controls (Export / Import / Reset / Manual Reset) */
#settingsPage .settings-grid {
  /* keep the two cards side-by-side on desktop */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

#settingsPage .settings-card {
  display: grid;
  gap: 16px;
  align-content: start;
}

#settingsPage .settings-card .section-title {
  font-size: 1.05rem;
  font-weight: 700;
}

#settingsPage .settings-card label,
#settingsPage .settings-card p.help-text {
  color: var(--text-muted);
}

/* Make Export + Import + Reset fit nicely in a single row when space allows */
#settingsPage .settings-card .settings-controls-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#settingsPage .settings-card .settings-controls-row #exportButton,
#settingsPage .settings-card .settings-controls-row #resetButton,
#settingsPage .settings-card .settings-controls-row .file-upload {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 18px;
  padding-right: 18px;
}

/* Weekly Reset controls: keep full width */
#settingsPage .settings-card #manualResetButton {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Responsive: collapse the 3-control row into 1 column on small screens */
@media (max-width: 640px) {
  #settingsPage .settings-grid {
    grid-template-columns: 1fr;
  }

  #settingsPage .settings-card .settings-controls-row {
    grid-template-columns: 1fr;
  }
}




.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.96);
  color: var(--text);
  padding: 16px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.45);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.boss-dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: min(680px, calc(100vw - 32px));
  border: none;
  border-radius: 32px;
  padding: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  color: var(--text);
  box-shadow: 0 30px 90px rgba(2, 8, 23, 0.65);
}

.reset-confirm-dialog .dialog-panel {
  max-width: 520px;
}

.reset-confirm-dialog .reset-actions {
  width: 100%;
}

.reset-confirm-dialog .reset-actions button {
  flex: 1;
}


.boss-dialog::backdrop {
  background: rgba(2, 8, 23, 0.72);
  backdrop-filter: blur(6px);
}

.boss-dialog[open] {
  display: grid;
  gap: 20px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 24px 0;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  padding: 0 24px;
}

.dialog-panel {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row span {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.detail-row strong {
  font-size: 1rem;
  text-align: right;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.dialog-actions .pill-button,
.dialog-actions .secondary-button {
  padding: 10px 14px;
  min-height: 42px;
}

.dialog-actions .easy-button {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.22), rgba(34, 197, 94, 0.12));
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #dcfce7;
}

.dialog-actions .medium-button {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #e0f2fe;
}

.dialog-actions .hard-button {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(239, 68, 68, 0.12));
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fee2e2;
}

.notes-panel textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.notes-panel textarea:focus {
  border-color: rgba(227, 53, 13, 0.4);
  box-shadow: inset 0 0 0 1px rgba(227, 53, 13, 0.2);
}

.history-panel {
  margin: 0 24px 24px;
  padding: 20px;
  border-radius: 24px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-list p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

@media (max-width: 1200px) {
  .dashboard-grid,
  .stats-grid,
  .settings-grid,
  .dashboard-panel .insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .boss-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .boss-card {
    padding: 20px;
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto;
  }

  .page-header,
  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .boss-actions {
    justify-content: flex-start;
  }

  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--border);
    border-radius: 24px;
  }

  .mobile-nav .nav-item {
    justify-content: center;
    padding: 14px 0;
    border-radius: 18px;
  }
}

@media (max-width: 640px) {
  .search-panel,
  .sidebar,
  .status-card,
  .card,
  .stat-card,
  .stat-panel,
  .calendar-card,
  .settings-card,
  .dashboard-panel,
  .boss-card {
    border-radius: 22px;
    padding: 18px;
  }

  .app-shell {
    gap: 18px;
  }

  .nav-item {
    padding: 14px 16px;
  }

  .boss-list {
    grid-template-columns: 1fr;
  }

  .boss-meta,
  .boss-status-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .boss-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .boss-actions .icon-button,
  .boss-actions .pill-button {
    min-width: 0;
    width: 100%;
  }

  .dialog-header,
  .dialog-grid,
  .history-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .sidebar-action,
  .primary-button,
  .secondary-button,
  .danger-button,
  .pill-button,
  .icon-button,
  .text-button {
    padding: 12px 14px;
  }
}

/* Dashboard: align "View all" button on the right (Ready Bosses section) */
#dashboardPage .boss-summary .section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

#dashboardPage .boss-summary .section-header #showReadyList {
  margin-left: auto;
}

@media (max-width: 640px) {
  #dashboardPage .boss-summary .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #dashboardPage .boss-summary .section-header #showReadyList {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

