/* 
 * Dream Tool Styles 
 * Requires html[data-night="night"] for dark mode
 */

.dream-search-box {
  margin-bottom: 30px;
}

.dream-search-box input {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  border: 1px solid var(--classC);
  border-radius: 8px;
  background: var(--background);
  color: var(--main);
  outline: none;
  transition: border-color 0.3s;
  margin-bottom: 15px;
  box-sizing: border-box;
}

.dream-search-box input:focus {
  border-color: var(--theme);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.dream-categories {
  margin-top: 20px;
}

.cat-title {
  font-size: 1.1rem;
  color: var(--main);
  margin-bottom: 15px;
  border-left: 3px solid var(--theme);
  padding-left: 10px;
}

.dream-cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cat-btn {
  background: var(--classD, #f5f5f5);
  border: 1px solid var(--classC, #e0e0e0);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.9rem;
  color: var(--main, #333);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
}

.cat-btn:hover, .cat-btn.active {
  background: var(--theme, #3b82f6);
  color: #fff;
  border-color: var(--theme, #3b82f6);
}

.dream-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.dream-empty-state svg {
  margin-bottom: 15px;
  opacity: 0.5;
  color: var(--theme);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--classC);
  padding-bottom: 10px;
}

.result-title {
  font-size: 1.3rem;
  color: var(--theme, #3b82f6);
  margin: 0;
}

.result-count {
  font-size: 0.9rem;
  color: var(--muted);
}

.dream-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-right: 5px;
}

.dream-item {
  background: var(--classD, #f5f5f5);
  border: 1px solid var(--classC);
  border-radius: 8px;
  padding: 20px;
}

.dream-item-title {
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--main);
  margin: 0 0 15px 0;
  display: flex;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--classC);
}

.dream-item-title::before {
  content: "✦";
  color: var(--theme);
  margin-right: 8px;
  font-size: 1rem;
}

.dream-item-type {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: normal;
  margin-left: 10px;
}

/* === 內容排版 === */
.dream-item-body {
  font-size: 0.95rem;
  color: var(--main);
  line-height: 1.8;
}

.dream-item-body p {
  margin: 0 0 0.8em 0;
  text-indent: 2em;
}

.dream-item-body p:last-child {
  margin-bottom: 0;
}

/* 摺疊態：超長內容只顯示前 300px */
.dream-item-body.dream-collapsed {
  max-height: 300px;
  overflow: hidden;
  position: relative;
}

.dream-item-body.dream-collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, var(--classD, #f5f5f5));
  pointer-events: none;
}

/* 展開/收起按鈕 */
.dream-expand-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 0;
  background: none;
  border: 1px dashed var(--classC);
  border-radius: 6px;
  color: var(--theme);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.dream-expand-btn:hover {
  background: var(--theme);
  color: #fff;
  border-color: var(--theme);
}

/* === 書籍來源標記 === */
.dream-source {
  color: var(--theme);
  font-size: 0.85em;
  font-style: italic;
  opacity: 0.8;
}

/* === 段落內小標題 === */
.dream-section-title {
  font-size: 1rem;
  font-weight: bold;
  color: var(--theme);
  margin: 1.2em 0 0.5em 0;
  padding-left: 10px;
  border-left: 3px solid var(--theme);
}

/* === 吉凶標籤 === */
.dream-badge-good {
  background: #10b981;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 10px;
  font-weight: normal;
}

.dream-badge-bad {
  background: #ef4444;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 10px;
  font-weight: normal;
}

/* === Tabs UI === */
.dream-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--classC);
  padding-bottom: 10px;
}

.dream-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.dream-tab-btn:hover {
  background: var(--classD);
  color: var(--main);
}

.dream-tab-btn.active {
  background: var(--theme);
  color: #fff;
  border-color: var(--theme);
  font-weight: bold;
}

.dream-tab-pane {
  display: none;
  font-size: 0.95rem;
  color: var(--main);
  line-height: 1.8;
  animation: fadeIn 0.3s;
}

.dream-tab-pane.active {
  display: block;
}

.dream-tab-pane p {
  margin: 0 0 0.8em 0;
  text-indent: 2em;
}

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

/* Spinner */
.spinner {
  animation: rotate 2s linear infinite;
}
.spinner .path {
  stroke: var(--theme);
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate {
  100% { transform: rotate(360deg); }
}
@keyframes dash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}
