/* ─── Logo Colors ────────────────────────── */
/* Primary: #00b4a5 (teal)                    */
/* Dark:    #003c78 (navy)                     */
/* Accent:  #78b44b (green)                    */

/* ─── 基礎重置 ───────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 40px 0;
  min-height: 100vh;
  background: #fff;
}

/* ─── Header ───────────────────────────── */
.header {
  background: linear-gradient(135deg, #00b4a5 0%, #008f82 100%);
  color: #fff;
  padding: 24px 20px 18px;
  text-align: center;
}

.header-logo {
  margin-bottom: 8px;
}

.logo-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  display: block;
  margin: 0 auto;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.header-subtitle {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 2px;
}

/* ─── Stats Bar ─────────────────────────── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.stat-item {
  flex: 1;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #00b4a5;
}

.stat-label {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

#stat-rated-item:hover .stat-label {
  color: #00b4a5;
}

#stat-total-item:hover .stat-label {
  color: #00b4a5;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: #e0e0e0;
}

/* ─── Section ──────────────────────────── */
.section {
  padding: 16px 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #003c78;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 13px;
  color: #888;
  margin-bottom: 12px;
}

/* ─── URL Input ──────────────────────────── */
.url-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.url-input {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  padding: 12px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.url-input:focus {
  border-color: #00b4a5;
}

.url-input::placeholder {
  color: #bbb;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.8;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #00b4a5;
  color: #fff;
  flex-shrink: 0;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: #00b4a5;
  color: #fff;
  font-size: 16px;
  margin-top: 16px;
}

/* ─── Error ───────────────────────────── */
.error-msg {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.error-msg.show {
  display: block;
}

/* ─── Loading ──────────────────────────── */
.loading-container {
  text-align: center;
  padding: 32px 20px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e0e0e0;
  border-top-color: #00b4a5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

.loading-text {
  font-size: 14px;
  color: #888;
}

/* ─── Course Card ──────────────────────── */
.course-card {
  margin: 0 20px;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #eee;
}

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

.course-platform {
  font-size: 12px;
  color: #00b4a5;
  font-weight: 600;
  background: rgba(0, 180, 165, 0.08);
  padding: 2px 10px;
  border-radius: 10px;
}

.course-status {
  font-size: 12px;
  color: #888;
}

.course-title {
  font-size: 17px;
  font-weight: 700;
  color: #003c78;
  margin-bottom: 10px;
  line-height: 1.4;
}

.course-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 8px;
}

.course-meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 11px;
  color: #999;
}

.meta-value {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.course-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  margin-top: 6px;
}

/* ─── Notice ──────────────────────────── */
.notice {
  margin: 0 20px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.notice-info {
  background: #e8f4fd;
  color: #2c7db3;
  border: 1px solid #b8dff5;
}

/* ─── Rating Buttons ───────────────────── */
.rating-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  background: #f5f5f5;
}

.rating-btn:active {
  transform: scale(0.96);
}

.rating-btn.selected {
  border-color: currentColor;
  font-weight: 700;
}

.rating-btn .rating-emoji {
  font-size: 28px;
  margin-bottom: 4px;
}

.rating-btn .rating-label {
  font-size: 13px;
}

.rating-great { color: #00b4a5; }
.rating-great.selected { background: rgba(0, 180, 165, 0.1); }
.rating-ok { color: #4a90d9; }
.rating-ok.selected { background: rgba(74, 144, 217, 0.1); }
.rating-warn { color: #f5a623; }
.rating-warn.selected { background: rgba(245, 166, 35, 0.1); }
.rating-bad { color: #e74c3c; }
.rating-bad.selected { background: rgba(231, 76, 60, 0.1); }

/* ─── Review Text ──────────────────────── */
.review-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.review-input:focus {
  border-color: #00b4a5;
}

.review-input::placeholder {
  color: #bbb;
}

/* ─── Warning Card (Non-friend) ────────── */
.warning-card {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.warning-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.warning-title {
  font-size: 16px;
  font-weight: 700;
  color: #f57f17;
  margin-bottom: 4px;
}

.warning-desc {
  font-size: 13px;
  color: #666;
}

/* ─── Join & Email Buttons ─────────────── */
.btn-join {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: #00b4a5;
  color: #fff;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.btn-join:active { opacity: 0.8; }

.btn-email-option {
  width: 100%;
  padding: 16px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-email-option:active { background: #f5f5f5; }

/* ─── Waiting Card ─────────────────────── */
.waiting-card {
  text-align: center;
  padding: 32px 16px;
}

.waiting-title {
  font-size: 16px;
  font-weight: 600;
  color: #003c78;
  margin-bottom: 8px;
}

.waiting-desc {
  font-size: 13px;
  color: #888;
  line-height: 1.6;
}

/* ─── Rating Result ────────────────────── */
#rating-result {
  display: none;
}

.rating-result-box {
  padding: 16px;
  border-radius: 10px;
  background: #e8f8e8;
  color: #1a7a1a;
  border: 1px solid #b8e0b8;
  font-size: 14px;
  line-height: 1.6;
}

/* ─── Research Note ────────────────────── */
.research-card {
  margin: 0 20px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
}

.research-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #f57f17;
  margin-bottom: 4px;
}

.research-card-desc {
  font-size: 13px;
  color: #666;
}

/* ─── Verify Code Panel ────────────────── */
.verify-card {
  background: #f0f9ff;
  border: 1px solid #b8dff5;
  border-radius: 12px;
  padding: 20px 16px;
}

.verify-title {
  font-size: 16px;
  font-weight: 700;
  color: #003c78;
  margin-bottom: 12px;
  text-align: center;
}

.verify-step {
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.5;
}

.verify-code {
  display: inline-block;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 6px;
  color: #00b4a5;
  background: #fff;
  border: 2px dashed #00b4a5;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'Courier New', monospace;
  margin-bottom: 8px;
}

.btn-copy {
  display: inline-block;
  padding: 8px 20px;
  border: 1.5px solid #00b4a5;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: #00b4a5;
  transition: all 0.2s;
}

.btn-copy:active {
  background: #f0fdf4;
}

.verify-status {
  text-align: center;
  font-size: 13px;
  margin-top: 12px;
  padding: 8px;
  border-radius: 6px;
}

.verify-status.pending {
  color: #f5a623;
  background: #fff8e1;
}

.verify-status.success {
  color: #00b4a5;
  background: #e8f8e8;
}

/* ─── Modal (Rated List) ──────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 40px;
}

.modal-content {
  background: #fff;
  border-radius: 14px;
  width: calc(100% - 32px);
  max-width: 440px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #003c78;
}

.modal-close {
  font-size: 24px;
  color: #999;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #f5f5f5;
}

.modal-body {
  padding: 12px 20px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-empty {
  text-align: center;
  padding: 32px 16px;
  color: #999;
  font-size: 14px;
}

.rated-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.rated-item:last-child {
  border-bottom: none;
}

.rated-item-emoji {
  font-size: 24px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
  padding-top: 2px;
}

.rated-item-content {
  flex: 1;
  min-width: 0;
}

.rated-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #003c78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.rated-item-meta {
  font-size: 12px;
  color: #999;
}

.rated-item-review {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  line-height: 1.4;
}

.rated-item-noscore {
  text-align: center;
  padding: 24px 16px;
  color: #999;
  font-size: 14px;
}

/* ─── Platform List (知識庫課程) ───────── */
.platform-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.platform-item {
  padding: 10px 12px;
  background: #f0faf8;
  border-radius: 8px;
  font-size: 13px;
  color: #003c78;
  font-weight: 500;
  border: 1px solid #d0ece8;
}

/* ─── Responsive ──────────────────────── */
@media (max-width: 480px) {
  .header-title { font-size: 18px; }
  .stat-value { font-size: 24px; }
  .rating-btn { padding: 14px 6px; }
  .rating-btn .rating-emoji { font-size: 24px; }
  .logo-img { width: 56px; height: 56px; }
  .modal-content { max-height: 80vh; }
  .url-input-group { flex-wrap: wrap; }
  .url-input { width: 100%; flex: 1 1 100%; }
  .btn-primary { width: 100%; }
}
