/* ============================================
 * NOYA Platform - 主要樣式
 * 配色:亮橘 #FF8C42 + 蛋黃 #F4D35E + 暖灰
 * ============================================ */

:root {
  --color-primary: #FF8C42;
  --color-primary-dark: #e87529;
  --color-secondary: #F4D35E;
  --color-accent: #D4A574;
  --color-bg: #f5f1ea;
  --color-bg-cream: #FFF9E6;
  --color-sidebar: #faf6ed;
  --color-text: #2c2c2c;
  --color-text-muted: #888;
  --color-success: #16A34A;
  --color-danger: #DC2626;
  --color-border: #e8dfc8;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(212, 165, 116, 0.12);
  --shadow-lg: 0 10px 30px rgba(212, 165, 116, 0.15);
}

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

body {
  font-family: "Noto Sans TC", -apple-system, "Microsoft JhengHei", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ===== 頂部列 ===== */
.top-bar {
  background: #1a1a1a;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.top-logo {
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 3px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.top-logo .brand { color: var(--color-primary); }
.top-logo .sub {
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: #aaa;
  letter-spacing: 2px;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
}
.top-version {
  background: rgba(255, 140, 66, 0.2);
  border: 1px solid rgba(255, 140, 66, 0.4);
  padding: 3px 10px;
  border-radius: 6px;
  color: var(--color-primary);
  font-family: "JetBrains Mono", monospace;
}
.top-date { color: #888; }
.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.08);
  color: #aaa;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
  font-size: 15px;
  margin-left: 6px;
}
.logout-btn:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ===== 主框架 ===== */
.platform-frame {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 50px);
}

/* ===== 左側欄 ===== */
.sidebar {
  width: 260px;
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13.5px;
  color: #555;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--color-bg-cream);
  color: var(--color-primary);
}
.nav-item.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.nav-item .icon { font-size: 15px; }

.api-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
  margin-top: 8px;
}
.api-row:first-of-type { margin-top: 0; }

.api-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  background: #fafafa;
  color: #555;
}

.api-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  display: inline-block;
}
.api-dot.off { background: #ccc; }

.btn-small {
  width: 100%;
  padding: 8px 10px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-small:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.history-item {
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
  color: #555;
  margin-bottom: 3px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
}
.history-item:hover {
  background: var(--color-bg-cream);
  color: var(--color-primary);
}
.history-item .date {
  color: #aaa;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
}

.empty-hint {
  color: #aaa;
  font-size: 12px;
  text-align: center;
  padding: 10px;
}

/* ===== 右側主區 ===== */
.main-area {
  flex: 1;
  padding: 28px 32px;
  background: #fff;
  overflow-y: auto;
}

.view { display: none; }
.view.active { display: block; }

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 2px solid #f0f0f0;
}

.main-title {
  font-size: 22px;
  color: #1a1a1a;
  font-weight: 700;
}

.main-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.btn-primary {
  padding: 9px 20px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13.5px;
  transition: all 0.2s;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 140, 66, 0.25);
}

/* ===== 分類 Tabs ===== */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.category-tabs .tab {
  padding: 6px 14px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border-radius: 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.category-tabs .tab:hover {
  background: var(--color-bg-cream);
  color: var(--color-primary);
}
.category-tabs .tab.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* ===== 範本卡片 ===== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.template-card {
  background: #fafafa;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #f0e8d8;
  transition: all 0.3s;
  cursor: pointer;
}
.template-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(255, 140, 66, 0.15);
  border-color: var(--color-primary);
}

.template-thumb {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 36px;
  font-family: "Inter", sans-serif;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.template-info {
  padding: 14px 16px;
}
.template-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 6px;
}
.template-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.template-tag {
  font-size: 10px;
  color: #888;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 8px;
}

/* ===== 提示框 ===== */
.phase-note {
  background: linear-gradient(135deg, var(--color-bg-cream), #fff);
  border: 1px solid var(--color-secondary);
  border-radius: 10px;
  padding: 18px 22px;
  font-size: 13px;
  color: #555;
  line-height: 1.8;
  margin-top: 20px;
}
.phase-note strong { color: var(--color-primary); }

.placeholder-box {
  background: #fafafa;
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  padding: 60px 30px;
  text-align: center;
  color: var(--color-text-muted);
}
.placeholder-icon { font-size: 48px; margin-bottom: 14px; }
.placeholder-box h3 {
  color: var(--color-text);
  font-size: 18px;
  margin-bottom: 8px;
}
.placeholder-box p { font-size: 13px; }

/* ===== 響應式 ===== */
@media (max-width: 900px) {
  .platform-frame { flex-direction: column; }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .main-area { padding: 20px; }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .top-date { display: none; }
}

@media (max-width: 600px) {
  .template-grid { grid-template-columns: 1fr; }
  .main-title { font-size: 18px; }
  .main-header { flex-direction: column; align-items: flex-start; gap: 14px; }
}
