/* ==========================================
   高雄市立楠梓高級中學 - 幾何分析平台樣式表
   ========================================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #1e293b;
}

/* ==========================================
   新增：頁首與 Logo 樣式 (配合 Flexbox 佈局)
   ========================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  background: #ffffff;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.logo-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.school-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  /* 懸停平滑過渡動畫 */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 動態設計：滑鼠懸浮時放大並有些微旋轉 */
.school-logo:hover {
  transform: scale(1.1) rotate(5deg);
}

.header-text {
  flex-grow: 1;
}

.header-text h1 {
  text-align: left;
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  color: #1e293b;
}

.subtitle {
  margin: 0;
  text-align: left;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ==========================================
   頁籤與卡片樣式
   ========================================== */
.tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  background: #e2e8f0;
  color: #475569;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.tab-btn:hover {
  background: #cbd5e1;
  color: #1e293b;
}

.tab-btn.active {
  background: #2563eb;
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

/* ==========================================
   方程式輸入區排版
   ========================================== */
.equation-grid {
  display: grid;
  gap: 1rem;
}

.equation-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.equation-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.equation-row {
  margin-bottom: 1rem;
}

.inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

label {
  font-weight: 600;
  color: #4b5563;
}

input[type="number"] {
  width: 5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="number"]:focus {
  border-color: #2563eb;
}

button.solve-btn {
  margin-top: 1.5rem;
  padding: 0.9rem 2rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

button.solve-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.25);
}

#steps,
#solution {
  margin-top: 1rem;
}

.step-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ==========================================
   圖表控制面板與容器
   ========================================== */
.chart-controls {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
}

.chart-controls h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: #334155;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.control-group label {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
}

.control-group select {
  padding: 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: white;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.control-group select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.chart-container {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  position: relative;
  height: 450px;
  width: 100%;
}

/* ==========================================
   響應式設計 (RWD) 調整
   ========================================== */
@media (max-width: 680px) {
  .page-header {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
    gap: 1rem;
  }

  .header-text h1 {
    text-align: center;
    font-size: 1.5rem;
  }

  .subtitle {
    text-align: center;
  }

  .equation-grid-3,
  .equation-grid-2 {
    grid-template-columns: 1fr;
  }
}
