/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-glass: rgba(18, 18, 26, 0.65);
  --bg-glass-active: rgba(30, 30, 46, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(29, 180, 70, 0.5);
  
  --text-main: #f3f3f6;
  --text-muted: #8e8e9f;
  --text-highlight: #1db446;
  --text-danger: #ff4a6b;
  
  --primary-gradient: linear-gradient(135deg, #1db446 0%, #158f35 100%);
  --secondary-gradient: linear-gradient(135deg, #2d2d3f 0%, #1a1a26 100%);
  --purple-gradient: linear-gradient(135deg, #e6005c 0%, #a30040 100%);
  --shadow-lg: 0 16px 32px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 4px 12px 0 rgba(0, 0, 0, 0.2);
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: center;
}

/* Background gradient blobs */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 20%, rgba(29, 180, 70, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(230, 0, 92, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(51, 153, 255, 0.05) 0%, transparent 50%);
  background-size: cover;
}

/* Grid Layout */
.container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */
.header {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bot-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff 30%, #a2a2bd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.bot-status-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(29, 180, 70, 0.1);
  border: 1px solid rgba(29, 180, 70, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 50px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-highlight);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--text-highlight);
}

.status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-highlight);
}

.push-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.push-info strong {
  color: var(--text-main);
}

/* Main Workspace Grid */
.main-content {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* Cards (Glassmorphism panels) */
.left-col, .right-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tab-box, .preview-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem 1.8rem;
  min-height: 520px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--text-main);
  background: var(--bg-glass-active);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-content {
  display: none;
  animation: fadeEffect 0.4s ease-out;
}

.tab-content.active {
  display: block;
}

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

/* Forms & Inputs */
.section-header {
  margin-bottom: 1.2rem;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-main);
}

.section-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
select {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: all 0.25s ease;
  width: 100%;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--text-highlight);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(29, 180, 70, 0.15);
}

.form-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.primary-btn {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(29, 180, 70, 0.2);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(29, 180, 70, 0.35);
}

.secondary-btn {
  background: var(--secondary-gradient);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.danger-btn {
  background: var(--purple-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(230, 0, 92, 0.2);
}

.danger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(230, 0, 92, 0.35);
}

.text-danger {
  color: var(--text-danger);
}

.text-danger:hover {
  border-color: rgba(255, 74, 107, 0.3);
}

.icon-btn {
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  font-size: 1rem;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Schedule List */
.list-header {
  margin-top: 1.8rem;
  border-top: 1px solid var(--border-glass);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-container {
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.list-container::-webkit-scrollbar {
  width: 5px;
}

.list-container::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 5px;
}

.schedule-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.schedule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.schedule-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.sched-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sched-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

.sched-datetime {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
}

.sched-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  transition: color 0.2s;
}

.sched-delete-btn:hover {
  color: var(--text-danger);
}

.sched-edit-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  transition: color 0.2s;
}

.sched-edit-btn:hover {
  color: var(--text-highlight);
}


.loading-item {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem 0;
  font-style: italic;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
  margin-top: 0.2rem;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--border-glass);
}

.toggle-switch label:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + label {
  background-color: rgba(29, 180, 70, 0.25);
  border-color: rgba(29, 180, 70, 0.5);
}

.toggle-switch input:checked + label:before {
  transform: translateX(24px);
  background-color: var(--text-highlight);
}

/* Guide Container */
.guide-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 480px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.guide-container::-webkit-scrollbar {
  width: 5px;
}

.guide-container::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 5px;
}

.guide-container h3 {
  font-size: 1rem;
  margin-top: 0.8rem;
  color: var(--text-main);
  border-left: 3px solid var(--text-highlight);
  padding-left: 0.5rem;
}

.guide-container ol, .guide-container ul {
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.guide-container li {
  margin-bottom: 0.4rem;
}

.guide-container a {
  color: var(--text-highlight);
  text-decoration: none;
}

.guide-container a:hover {
  text-decoration: underline;
}

.code-block {
  display: block;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  color: #33a3ff;
  font-family: monospace;
  font-size: 0.8rem;
  margin: 0.4rem 0;
}

/* Live Simulator / Preview (Right Column) */
.preview-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.preview-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.preview-header .actions {
  display: flex;
  gap: 0.5rem;
}

/* Chat simulator */
.chat-simulator {
  background: #0f0f15;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 480px;
  overflow-y: auto;
}

.chat-simulator::-webkit-scrollbar {
  width: 5px;
}

.chat-simulator::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 5px;
}

.chat-time {
  align-self: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
}

.chat-message {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.avatar {
  width: 32px;
  height: 32px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.flex-bubble {
  background: #12121a;
  border: 1px solid #1f1f2e;
  border-radius: var(--radius-md);
  width: calc(100% - 40px);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.flex-bubble.purple-theme {
  border-color: #2d1f2e;
  background: #12121a;
}

/* Bubble Sections */
.bubble-section {
  padding: 0.8rem 1rem;
}

.header-sec {
  background: #1f1f2e;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.purple-theme .header-sec {
  background: #2d1f2e;
}

.title-main {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  background: rgba(29, 180, 70, 0.15);
  border: 1px solid rgba(29, 180, 70, 0.3);
  color: var(--text-highlight);
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.purple-theme .tag {
  background: rgba(230, 0, 92, 0.15);
  border: 1px solid rgba(230, 0, 92, 0.3);
  color: #e6005c;
}

.date-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sec-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.bazi-sec, .weather-sec, .schedules-sec, .news-sec, .trends-sec {
  border-top: 1px solid #1a1a26;
}

/* BaZi section styles */
.bazi-sec {
  background: #1c1917; /* 深暖石褐底色，襯托古風 */
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-left: 3px solid #d4af37; /* 黃金左邊條 */
  margin: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
}

.bazi-nongli {
  font-size: 0.7rem;
  color: #d4af37;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.bazi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
}

.bazi-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.2rem;
  border-radius: 4px;
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.bazi-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.bazi-char {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.bazi-char.stem {
  color: #ff5555; /* 天干紅色 */
}

.bazi-char.branch {
  color: #ffaa55; /* 地支橙色 */
}

.bazi-nayin {
  font-size: 0.55rem;
  color: #888888;
  margin-top: 0.3rem;
  white-space: nowrap;
}

/* Weather display in chat */
.weather-box {
  background: #1f1f2e;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.temp-range {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.weather-cond {
  font-size: 0.75rem;
  color: #dddddd;
  margin-top: 0.1rem;
}

.weather-emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.rain-chance {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 0.2rem;
}

/* Schedules list in chat */
.preview-schedules {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.preview-schedules li {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #f3f3f6;
  padding: 0.2rem 0;
}

/* News List in Chat */
.preview-news-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preview-news-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  cursor: pointer;
}

.news-title {
  font-size: 0.75rem;
  color: #ffffff;
  line-height: 1.4;
}

.news-link {
  font-size: 0.65rem;
  color: var(--text-highlight);
}

/* Trends Section inside Chat */
.trend-sub-sec {
  margin-top: 0.6rem;
}

.trend-sub-sec:first-of-type {
  margin-top: 0.2rem;
}

.sub-sec-title {
  font-size: 0.65rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.trend-google { color: #e6005c; }
.trend-dcard { color: #3399ff; }
.trend-youtube { color: #ff3333; }

.trend-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.2rem;
}

.trend-item {
  font-size: 0.7rem;
  color: #dddddd;
  line-height: 1.3;
}

.trend-item-meta {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-left: 0.4rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(20, 20, 30, 0.95);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  backdrop-filter: blur(10px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Animations */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-in {
  animation: slideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-slide-in-delay {
  animation: slideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Console Log Card styling */
.console-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  height: 250px;
  min-height: 250px;
  margin-top: 0rem;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.console-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.console-terminal {
  background: #07070a;
  border: 1px solid #1a1a26;
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  flex-grow: 1;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  overflow-y: auto;
  color: #dddddd;
  white-space: pre-wrap;
  word-break: break-all;
}

.console-terminal::-webkit-scrollbar {
  width: 5px;
}

.console-terminal::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 5px;
}

.log-line {
  margin-bottom: 0.3rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.02);
  padding-bottom: 0.2rem;
  font-size: 0.72rem;
}

.log-line.info {
  color: #33a3ff;
}

.log-line.warn {
  color: #ffaa55;
}

.log-line.error {
  color: var(--text-danger);
  font-weight: bold;
}

.log-line.success {
  color: var(--text-highlight);
}

.log-line.debug {
  color: #888888;
}

/* Currency Table Styles */
.rates-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 5px;
}

.rates-table th, .rates-table td {
  border-bottom: 1px solid var(--border-glass);
  padding: 12px;
  vertical-align: middle;
}

.rates-table tbody tr {
  transition: background-color 0.2s ease;
}

.rates-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.rates-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.rates-table td {
  color: var(--text-main);
}

