:root {
  --bg: linear-gradient(135deg, #e6f0ec 0%, #f5f7fb 100%);
  --card-bg: #ffffff;
  --border: #d1d5db;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #54796d; /* Fenway green */
  --accent-soft: #dbe7e1;
  --accent-2: #b91c1c; /* Red Sox red */
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  color: var(--accent);
}

.subtle-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-btn {
  border: none;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 600;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-top: 4px solid var(--accent);
}

.full-width {
  grid-column: 1 / -1;
}

.card-header {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.mlb-card-nav {
  margin: -4px 0 16px;
}

.baseball-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6f2 0%, #e0ece6 100%);
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(84, 121, 109, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.baseball-link:hover {
  background: linear-gradient(135deg, #eaf4ef 0%, #d7e8df 100%);
  box-shadow: 0 10px 22px rgba(84, 121, 109, 0.14);
  transform: translateY(-1px);
}

.baseball-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.weather-content {
  display: flex;
  align-items: center;
  gap: 18px;
}

.weather-temp {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

.weather-details p {
  margin: 6px 0;
  color: var(--muted);
}

.upcoming-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.upcoming-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.upcoming-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.item-title {
  font-weight: 600;
}

.item-meta {
  color: var(--muted);
  white-space: nowrap;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.task-row:hover {
  transform: translateY(-1px);
  background: #fafafa;
}

.task-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.task-text {
  font-weight: 500;
}

.task-tag {
  font-size: 0.85rem;
  color: var(--muted);
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 999px;
}

.task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.task-row:hover .task-actions {
  opacity: 1;
}

.task-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
  transition: background 0.2s ease;
}

.task-actions button:hover {
  background: #e5e7eb;
}

.task-row.completed {
  opacity: 0.6;
}

.task-row.completed .task-text {
  text-decoration: line-through;
}

.task-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.task-form input {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
}

.task-form button {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.task-form button:hover {
  filter: brightness(0.96);
}

.notes-card textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fcfcfd;
}

@media (max-width: 800px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .full-width {
    grid-column: auto;
  }

  .weather-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-row {
    grid-template-columns: auto 1fr;
  }

  .task-tag {
    grid-column: 2;
    justify-self: start;
  }
}

/* Weather Settings Button */
.settings-btn {
  background: none;
  border: none;
  font-size: 1.3em;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

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

/* Weather Modal */
.weather-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.weather-modal.active {
  display: flex;
}

.weather-modal .modal-content {
  background: white;
  padding: 24px;
  border-radius: 14px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.weather-modal h3 {
  margin: 0 0 16px;
  font-size: 1.3rem;
  color: var(--text);
}

.modal-input {
  width: 100%;
  padding: 12px;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.modal-buttons button {
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  font-size: 0.95rem;
}

#set-zip-btn {
  background: #0066cc;
  color: white;
}

#set-zip-btn:hover {
  filter: brightness(1.1);
}

#set-zip-btn:active {
  transform: scale(0.98);
}

#use-location-btn {
  background: #28a745;
  color: white;
}

#use-location-btn:hover {
  filter: brightness(1.1);
}

#use-location-btn:active {
  transform: scale(0.98);
}

#close-settings-btn {
  background: #6c757d;
  color: white;
}

#close-settings-btn:hover {
  filter: brightness(1.1);
}

#close-settings-btn:active {
  transform: scale(0.98);
}

.location-status {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 0;
  min-height: 20px;
}

/* Upcoming Events Modal */
.upcoming-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.upcoming-modal.active {
  display: flex;
}

.upcoming-modal .modal-content {
  background: white;
  padding: 24px;
  border-radius: 14px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.upcoming-modal h3 {
  margin: 0 0 16px;
  font-size: 1.3rem;
  color: var(--text);
}

.event-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.event-type {
  display: flex;
  gap: 16px;
}

.event-type label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.events-list {
  margin: 20px 0;
}

.event-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fafafa;
}

.event-item .event-info {
  flex: 1;
}

.event-item .event-name {
  font-weight: 500;
}

.event-item .event-date {
  font-size: 0.85rem;
  color: var(--muted);
}

.event-item .event-actions {
  display: flex;
  gap: 8px;
}

.event-item button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
  transition: background 0.2s ease;
}

.event-item button:hover {
  background: #e5e7eb;
}

/* MLB Standings Styles */
.mlb-standings {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 12px;
}

.standings-division {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--accent-soft);
}

.division-title {
  margin: 0 0 16px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.division-teams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.standings-team {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.standings-team:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(84, 121, 109, 0.25);
}

.team-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 10px 0;
  color: var(--text);
}

.standings-stat {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.9rem;
}

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

.standings-stat-value {
  font-weight: 500;
  color: var(--text);
}

.loading-text,
.error-text {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.error-text {
  color: #dc2626;
}

#mlb-refresh-btn {
  transition: transform 0.3s ease;
}

#mlb-refresh-btn:hover {
  transform: rotate(180deg);
}

#mlb-refresh-btn:active {
  transform: rotate(360deg);
}


# Card hover lift effect
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.15);
}

/* Keep fixed-position modals anchored to the viewport instead of a transformed card. */
.card:has(.weather-modal.active),
.card:has(.upcoming-modal.active) {
  transform: none;
  box-shadow: var(--shadow);
}
