/* 樂樂園共用主題 */
:root {
  --sand-primary: #0f766e;
  --sand-primary-deep: #115e59;
  --sand-accent: #f59e0b;
  --sand-ink: #0f172a;
  --sand-mist: #f8fafc;
  --sand-surface: rgba(255,255,255,0.92);
  --sand-border: rgba(15, 23, 42, 0.08);
  --sand-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

/* 基礎全域設定 */
body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background:
    radial-gradient(circle at top, rgba(15, 118, 110, 0.10), transparent 34%),
    linear-gradient(180deg, #edf8f7 0%, #f6fbff 48%, #f9fafb 100%);
  color: var(--sand-ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

header {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.96), rgba(8, 47, 73, 0.96));
  color: white;
  padding: 0.95rem 1rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

/* 導覽列 */
.main-nav a {
  color: white;
  text-decoration: none;
  margin-left: 15px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background-color 0.2s, transform 0.2s;
}

.main-nav a:hover {
  background-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

.main-nav a.current-page {
  background-color: rgba(255,255,255,0.3);
  font-weight: bold;
}

.main-nav span {
  margin-left: 15px;
  font-size: 0.9em;
}

.main-nav button {
  background: rgba(255,255,255,0.14);
  color: white;
  border: 1px solid rgba(255,255,255,0.24);
  padding: 8px 14px;
  margin-left: 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9em;
}

.main-nav button:hover {
  background-color: rgba(255,255,255,0.24);
}

/* 漢堡選單 (手機版) */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* 主內容區塊 */
main {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
  min-height: calc(100vh - 140px);
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

/* 按鈕樣式 */
.btn-primary {
  background: linear-gradient(135deg, var(--sand-primary), #14b8a6);
  color: white;
  border: none;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: white;
  color: var(--sand-primary);
  border: 1px solid rgba(15, 118, 110, 0.26);
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: #ecfdf5;
}

.btn-danger {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-danger:hover {
  background-color: #d32f2f;
}

/* 卡片與容器 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.card {
  background: var(--sand-surface);
  border-radius: 20px;
  box-shadow: var(--sand-shadow);
  border: 1px solid var(--sand-border);
  overflow: hidden;
  transition: transform 0.2s;
  backdrop-filter: blur(10px);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-body {
  padding: 15px;
}

.card-title {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 1.2rem;
}

.card-text {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 15px;
  line-height: 1.5;
}

.card-footer {
  padding: 15px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 表單樣式 */
.form-container {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.96));
  padding: 30px;
  border-radius: 24px;
  box-shadow: var(--sand-shadow);
  border: 1px solid rgba(255,255,255,0.7);
  max-width: 500px;
  margin: 40px auto;
  backdrop-filter: blur(16px);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  font-size: 1rem;
  box-sizing: border-box;
  background: rgba(255,255,255,0.95);
}

.form-input:focus {
  border-color: #2196f3;
  outline: none;
}

/* 首頁 Hero Section (原始版) */
.hero-section {
  text-align: center;
  padding: 60px 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  margin-bottom: 30px;
}

.hero-title {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 20px;
}

.hero-description {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 30px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* 功能特色區域 */
.features-section {
  margin-top: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.feature-card {
  text-align: center;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.feature-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon img {
  max-width: 100%;
  max-height: 100%;
}

.feature-title {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: #333;
}

.feature-description {
  color: #666;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  color: #666;
  border-top: 1px solid #eee;
  margin-top: 40px;
  background-color: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px);
}

/* 任務篩選器 */
.task-filter {
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

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

.task-modal.show {
  display: flex;
}

.task-modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

/* 響應式調整 */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .hamburger {
    display: block;
    position: absolute;
    right: 20px;
    top: 15px;
  }

  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    margin-top: 15px;
  }

  .header-content.open .main-nav {
    display: flex;
  }

  .main-nav a, .main-nav span, .main-nav button {
    margin: 5px 0;
    display: block;
    width: 100%;
  }

  main {
    margin: 12px auto;
    padding: 0 12px calc(90px + env(safe-area-inset-bottom, 0px));
  }

  .form-container {
    margin: 12px auto 24px;
    padding: 20px 16px 18px;
    border-radius: 22px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero-buttons {
    flex-direction: column;
  }
}

/* Loading */
.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 2s linear infinite;
  margin: 20px auto;
}

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