/* 課程計劃生成器樣式 */

/* 自訂檔案上傳按鈕樣式 */
.custom-file-upload {
  position: relative;
  display: inline-block;
  width: 100%;
}

.custom-file-button {
  background: #007bff;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.custom-file-button:hover {
  background: #0056b3;
}

.file-name-display {
  margin-left: 10px;
  color: #666;
  font-size: 14px;
}

/* 隱藏原生檔案輸入框 */
#upload-file[style*="opacity"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 100% !important;
  height: 100% !important;
  cursor: pointer !important;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f7fa;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* 側邊欄 */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  color: white;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.sidebar-header {
  padding: 20px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
  font-size: 1.3em;
  margin-bottom: 6px;
  color: white;
  line-height: 1.3;
}

.sidebar-header .subtitle {
  font-size: 0.75em;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.2;
}

/* 步驟導航 */
.steps-nav {
  flex: 1;
  padding: 15px 0;
  overflow-y: auto;
}

.step-item {
  display: flex;
  align-items: center;
  padding: 10px 18px;
  margin: 3px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.7);
}

.step-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.step-item.active {
  background-color: #3498db;
  color: white;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.step-item.completed {
  color: rgba(255, 255, 255, 0.9);
}

.step-item.completed .step-number {
  background-color: #27ae60;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.85em;
  margin-right: 10px;
  transition: all 0.3s ease;
}

.step-item.active .step-number {
  background-color: white;
  color: #3498db;
}

.step-label {
  font-size: 0.85em;
}

/* AI 模型選擇器 */
.ai-model-selector {
  padding: 15px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-model-selector h3 {
  font-size: 0.85em;
  margin-bottom: 8px;
}

.ai-model-selector select {
  font-size: 0.85em;
}

.sidebar-select {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sidebar-select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.sidebar-select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.sidebar-select option {
  background: #2c3e50;
  color: white;
}

.sidebar-footer {
  padding: 15px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-settings {
  width: 100%;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.3s ease;
}

.btn-settings:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* 主內容區 */
.main-content {
  flex: 1;
  overflow-y: auto;
  background-color: #f5f7fa;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 60px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.settings-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.settings-card h2 {
  color: white;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.settings-card label {
  color: rgba(255, 255, 255, 0.95);
}

.settings-card input,
.settings-card select {
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.step {
  transition: all 0.3s ease;
}

.step h2 {
  color: #2c3e50;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid #3498db;
  font-size: 1.8em;
}

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

label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: 500;
  font-size: 0.95em;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
  background-color: white;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.modern-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
  appearance: none;
}

small {
  display: block;
  margin-top: 6px;
  color: #7f8c8d;
  font-size: 0.85em;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  margin-right: 10px;
  margin-top: 10px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2980b9 0%, #1f6398 100%);
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

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

.btn-success {
  background-color: #27ae60;
  color: white;
}

.btn-success:hover {
  background-color: #229954;
}

.generated-content {
  padding: 30px 40px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  margin-bottom: 20px;
  white-space: pre-wrap;
  line-height: 2;
  border-left: 4px solid #3498db;
  min-height: 100px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  font-size: 16px;
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

#api-key-status {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  font-weight: 500;
}

.status-success {
  background-color: #d4edda;
  color: #155724;
}

.status-error {
  background-color: #f8d7da;
  color: #721c24;
}

footer {
  text-align: center;
  margin-top: 30px;
  padding: 20px;
  color: #7f8c8d;
}

footer a {
  color: #3498db;
  text-decoration: none;
  transition: all 0.3s ease;
}

footer a:hover {
  text-decoration: underline;
  color: #2980b9;
}

/* Loading 狀態 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Prompt 編輯器樣式 */
.prompt-editor-controls {
  margin-bottom: 25px;
}

.prompt-editor-content {
  animation: fadeIn 0.3s ease;
}

.prompt-info {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.prompt-info h3 {
  color: #1976d2;
  margin-bottom: 10px;
}

.prompt-info p {
  color: #555;
}

.prompt-textarea {
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
}

.prompt-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.prompt-status {
  margin-top: 15px;
  padding: 12px;
  border-radius: 8px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 響應式設計 */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 300px;
  }

  .main-content {
    overflow-y: visible;
  }
}

/* 滾動條樣式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Gamma 設定面板 */
.gamma-settings-panel {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gamma-settings-panel .setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gamma-settings-panel .setting-group label {
  font-size: 0.9em;
  font-weight: 500;
  color: #333;
}

.gamma-settings-panel .modern-select,
.gamma-settings-panel .modern-input {
  width: 100%;
  padding: 10px 15px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: #333;
  font-size: 1em;
  transition: all 0.3s ease;
}

.gamma-settings-panel .modern-select:focus,
.gamma-settings-panel .modern-input:focus {
  outline: none;
  border-color: #4a90e2;
  background: #f8f9fa;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.gamma-settings-panel .modern-select option {
  background: white;
  color: #333;
}

/* 按鈕樣式 */
.btn-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-info.btn-active {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 狀態訊息 */
.status-success {
  background: rgba(46, 204, 113, 0.2);
  border-left: 4px solid #2ecc71;
  color: #2ecc71;
  padding: 15px;
  border-radius: 8px;
  white-space: pre-line;
}

.status-error {
  background: rgba(231, 76, 60, 0.2);
  border-left: 4px solid #e74c3c;
  color: #e74c3c;
  padding: 15px;
  border-radius: 8px;
  white-space: pre-line;
}

.status-info {
  background: rgba(52, 152, 219, 0.2);
  border-left: 4px solid #3498db;
  color: #3498db;
  padding: 15px;
  border-radius: 8px;
  white-space: pre-line;
}

/* ==================== 歷史記錄頁面樣式 ==================== */

.history-list {
  margin: 30px 0;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.history-item {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.history-item:hover {
  background: #e9ecef;
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-item h3 {
  margin: 0 0 10px 0;
  color: #212529;
  font-size: 1.2em;
}

.history-meta {
  display: flex;
  gap: 15px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.history-meta span {
  color: #6c757d;
  font-size: 0.9em;
}

.history-date {
  color: #868e96;
  font-size: 0.85em;
  margin-top: 10px;
}

/* 課程計劃詳情頁面 */
.plan-detail-content {
  margin-top: 30px;
}

.plan-detail-section {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 2px solid #e9ecef;
}

.plan-detail-section:last-child {
  border-bottom: none;
}

.plan-detail-section h3 {
  color: #212529;
  margin-bottom: 20px;
  font-size: 1.3em;
  padding-bottom: 10px;
  border-bottom: 2px solid #3b82f6;
}

.plan-detail-section p {
  margin: 10px 0;
  color: #495057;
}

.plan-detail-section .generated-content {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 100%;
}
