/* ============================================
   AdventurePack — Camping Theme
   ============================================ */

:root {
  --forest-dark: #1a2e0a;
  --forest: #2d5016;
  --forest-light: #3d6b1e;
  --earth: #8b6914;
  --earth-light: #c9a84c;
  --campfire: #e8731a;
  --campfire-glow: #ff9b3d;
  --ember: #d4442a;
  --sky-dark: #0f1d2b;
  --sky: #1a3a4a;
  --cream: #f5f0e1;
  --cream-dark: #e8dcc6;
  --sand: #d4c5a0;
  --bark: #4a3728;
  --bark-light: #6b5442;
  --text: #2c2416;
  --text-light: #7a6e5f;
  --text-muted: #a89e8c;
  --white: #ffffff;
  --danger: #c0392b;
  --success: #27ae60;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.2);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   Landing Page
   ============================================ */

.landing {
  background: linear-gradient(170deg, var(--forest-dark) 0%, #0d1f06 40%, var(--sky-dark) 100%);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  position: relative;
}

.landing::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 300px at 20% 80%, rgba(232, 115, 26, 0.06) 0%, transparent 100%),
    radial-gradient(ellipse 400px 400px at 80% 20%, rgba(45, 80, 22, 0.15) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Fireflies */
.fireflies {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.firefly {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--campfire-glow);
  box-shadow: 0 0 8px 2px rgba(255, 155, 61, 0.6);
  animation: firefly-float 8s ease-in-out infinite, firefly-glow 3s ease-in-out infinite alternate;
}

.firefly:nth-child(1) { left: 15%; top: 30%; animation-delay: 0s, 0s; animation-duration: 9s, 2.5s; }
.firefly:nth-child(2) { left: 70%; top: 20%; animation-delay: -2s, -1s; animation-duration: 11s, 3.2s; }
.firefly:nth-child(3) { left: 40%; top: 60%; animation-delay: -4s, -0.5s; animation-duration: 8s, 2.8s; }
.firefly:nth-child(4) { left: 80%; top: 70%; animation-delay: -1s, -2s; animation-duration: 10s, 3.5s; }
.firefly:nth-child(5) { left: 25%; top: 80%; animation-delay: -3s, -1.5s; animation-duration: 12s, 2.2s; }
.firefly:nth-child(6) { left: 60%; top: 45%; animation-delay: -5s, -0.8s; animation-duration: 7s, 3s; }
.firefly:nth-child(7) { left: 90%; top: 50%; animation-delay: -6s, -2.5s; animation-duration: 9s, 2.6s; }
.firefly:nth-child(8) { left: 50%; top: 15%; animation-delay: -7s, -1.2s; animation-duration: 11s, 3.4s; }

@keyframes firefly-float {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(30px, -20px); }
  50% { transform: translate(-15px, 25px); }
  75% { transform: translate(20px, 10px); }
}

@keyframes firefly-glow {
  0% { opacity: 0.2; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

.landing-container {
  position: relative;
  z-index: 2;
  max-width: 520px;
  width: 100%;
  padding: 60px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.landing-hero {
  text-align: center;
  margin-bottom: 40px;
}

.logo-mark {
  font-size: 64px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(232, 115, 26, 0.3));
  animation: gentle-bounce 4s ease-in-out infinite;
}

@keyframes gentle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.landing-hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--cream);
  margin-bottom: 8px;
}

.accent {
  color: var(--campfire);
}

.tagline {
  font-size: 1.1rem;
  color: var(--sand);
  line-height: 1.5;
  opacity: 0.9;
}

/* Auth card */
.auth-card {
  width: 100%;
  background: rgba(245, 240, 225, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(245, 240, 225, 0.1);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 24px;
  transition: all var(--transition);
  text-decoration: none;
  width: 100%;
}

.btn-google {
  background: var(--white);
  color: #333;
  box-shadow: var(--shadow);
}

.btn-google:hover {
  background: #f7f7f7;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.google-icon {
  flex-shrink: 0;
}

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(245, 240, 225, 0.15);
}

.magic-form .input-group {
  display: flex;
  gap: 8px;
}

.magic-form input[type="email"] {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid rgba(245, 240, 225, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  color: var(--cream);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
}

.magic-form input[type="email"]::placeholder {
  color: var(--text-muted);
}

.magic-form input[type="email"]:focus {
  border-color: var(--campfire);
}

.btn-magic {
  background: var(--forest);
  color: var(--cream);
  white-space: nowrap;
  min-width: 140px;
}

.btn-magic:hover {
  background: var(--forest-light);
  transform: translateY(-1px);
}

.magic-msg {
  margin-top: 12px;
  font-size: 0.9rem;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.magic-msg.success {
  color: #a7f3d0;
  background: rgba(39, 174, 96, 0.15);
}

.magic-msg.error {
  color: #fca5a5;
  background: rgba(192, 57, 43, 0.15);
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(245, 240, 225, 0.3);
  border-top-color: var(--cream);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}

.feature {
  text-align: center;
  padding: 20px 12px;
  border-radius: var(--radius);
  background: rgba(245, 240, 225, 0.04);
  border: 1px solid rgba(245, 240, 225, 0.06);
  transition: all var(--transition);
}

.feature:hover {
  background: rgba(245, 240, 225, 0.08);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.feature h3 {
  font-size: 0.95rem;
  color: var(--cream);
  margin-bottom: 4px;
}

.feature p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.landing-footer {
  position: relative;
  z-index: 2;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.landing-footer a {
  color: var(--campfire);
  text-decoration: none;
}

/* ============================================
   App Page
   ============================================ */

.app-page {
  background: var(--cream);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--forest-dark);
  color: var(--cream);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

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

.logo-small {
  font-size: 1.6rem;
}

.app-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--campfire);
}

.user-name {
  font-size: 0.85rem;
  color: var(--sand);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon {
  background: rgba(245, 240, 225, 0.1);
  border: none;
  font-size: 1.2rem;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
  width: auto;
}

.btn-icon:hover {
  background: rgba(245, 240, 225, 0.2);
  transform: scale(1.05);
}

/* Progress bar */
.progress-bar-container {
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cream);
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--cream-dark);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest) 0%, var(--success) 100%);
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 90px;
  text-align: right;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  background: var(--cream);
  border-bottom: 2px solid var(--cream-dark);
}

.tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-align: center;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--forest);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform var(--transition);
}

.tab.active {
  color: var(--forest);
}

.tab.active::after {
  transform: scaleX(1);
}

.tab:hover {
  color: var(--forest-light);
}

/* Toolbar */
.toolbar {
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--cream);
  position: sticky;
  top: 56px;
  z-index: 50;
  border-bottom: 1px solid var(--cream-dark);
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.search-box input:focus {
  border-color: var(--forest);
}

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

.filter-select {
  padding: 10px 12px;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.btn-sm {
  padding: 10px 16px;
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--cream-dark);
  color: var(--text-light);
  width: auto;
}

.btn-outline:hover {
  border-color: var(--forest);
  color: var(--forest);
  background: rgba(45, 80, 22, 0.05);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border: none;
  width: auto;
}

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

/* Checklist */
.content {
  flex: 1;
  padding: 0 20px 40px;
}

.checklist {
  max-width: 720px;
  margin: 0 auto;
}

.category-group {
  margin-bottom: 8px;
}

.category-header {
  position: sticky;
  top: 120px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-top: 16px;
  background: var(--forest-dark);
  color: var(--cream);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}

.category-header:hover {
  background: var(--forest);
}

.category-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sand);
  background: rgba(245, 240, 225, 0.12);
  padding: 2px 10px;
  border-radius: 12px;
}

.category-items {
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.category-items.collapsed {
  max-height: 0 !important;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-top: 2px;
  background: var(--white);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  animation: item-in 0.3s ease backwards;
}

.checklist-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
}

/* Custom checkbox */
.check-wrapper {
  position: relative;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.check-wrapper input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
}

.check-mark {
  position: absolute;
  inset: 0;
  border: 2px solid var(--sand);
  border-radius: 6px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-mark::after {
  content: '✓';
  font-size: 14px;
  color: var(--white);
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition);
}

.check-wrapper input:checked + .check-mark {
  background: var(--forest);
  border-color: var(--forest);
}

.check-wrapper input:checked + .check-mark::after {
  opacity: 1;
  transform: scale(1);
}

.item-name {
  flex: 1;
  font-size: 0.95rem;
  color: var(--text);
  transition: all var(--transition);
}

.checklist-item.checked .item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.btn-delete {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition);
  padding: 4px;
  border-radius: 4px;
  width: auto;
  color: var(--text-muted);
}

.checklist-item:hover .btn-delete {
  opacity: 1;
}

.btn-delete:hover {
  color: var(--danger);
  background: rgba(192, 57, 43, 0.08);
}

/* Delete animation */
.checklist-item.deleting {
  animation: item-out 0.35s ease forwards;
}

@keyframes item-out {
  to {
    opacity: 0;
    transform: translateX(40px);
    max-height: 0;
    padding: 0 16px;
    margin: 0;
  }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 1.1rem;
}

/* ============================================
   Tips
   ============================================ */

.tips-grid {
  max-width: 720px;
  margin: 16px auto 0;
  display: grid;
  gap: 16px;
}

.tip-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border-left: 4px solid var(--campfire);
  transition: all var(--transition);
  animation: tip-in 0.4s ease backwards;
}

.tip-card:nth-child(even) {
  border-left-color: var(--forest);
}

.tip-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

@keyframes tip-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.tip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.tip-icon {
  font-size: 1.6rem;
}

.tip-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--campfire);
  background: rgba(232, 115, 26, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
}

.tip-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.tip-text {
  font-size: 0.92rem;
  color: var(--text-light);
  line-height: 1.6;
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.3s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
}

.modal h3 {
  color: var(--text);
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-light);
  font-size: 0.92rem;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
  .landing-container {
    padding: 40px 16px 32px;
  }

  .landing-hero h1 {
    font-size: 2.2rem;
  }

  .logo-mark {
    font-size: 48px;
  }

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

  .feature {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 12px;
    padding: 14px 16px;
  }

  .feature-icon {
    font-size: 1.6rem;
    margin-bottom: 0;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .magic-form .input-group {
    flex-direction: column;
  }

  .btn-magic {
    min-width: unset;
  }

  .app-header {
    padding: 10px 14px;
  }

  .user-name {
    display: none;
  }

  .toolbar {
    top: 52px;
    padding: 12px 14px;
  }

  .toolbar-actions {
    width: 100%;
  }

  .filter-select {
    flex: 1;
  }

  .category-header {
    top: 108px;
  }

  .content {
    padding: 0 14px 32px;
  }

  .btn-delete {
    opacity: 0.6;
  }
}

@media (min-width: 768px) {
  .tips-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Print styles
   ============================================ */

@media print {
  .app-header, .toolbar, .tabs, .btn-delete, .progress-bar-container {
    display: none !important;
  }

  .content {
    padding: 0;
  }

  .checklist-item {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #eee;
  }

  .category-header {
    position: static;
    color: #000;
    background: #eee;
  }
}
