/* Stock Study - Mobile-First Design */
:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #22223a;
  --accent: #4fc3f7;
  --accent-dim: #2196f3;
  --green: #66bb6a;
  --red: #ef5350;
  --yellow: #ffd54f;
  --text: #e0e0e0;
  --text-dim: #9e9e9e;
  --text-bright: #ffffff;
  --border: #2a2a40;
  --radius: 12px;
  --header-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --tag-morning-bg: #1a3a5c; --tag-morning: #64b5f6;
  --tag-afternoon-bg: #3e2723; --tag-afternoon: #ffab91;
  --tag-weekly-bg: #1b3a1b; --tag-weekly: #81c784;
  --tag-trade-bg: #4a1a2e; --tag-trade: #f48fb1;
  --chart-tooltip-bg: #1a1a2e; --chart-tooltip-border: #2a2a40;
  --chart-grid: rgba(255,255,255,0.04);
  --summary-bull-bg: #1b3a1b; --summary-bear-bg: #3e1a1a; --summary-neutral-bg: #2a2a1a;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f5f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f5;
  --accent: #1976d2;
  --accent-dim: #1565c0;
  --green: #2e7d32;
  --red: #c62828;
  --yellow: #f9a825;
  --text: #333333;
  --text-dim: #757575;
  --text-bright: #111111;
  --border: #e0e0e0;
  --header-bg: linear-gradient(135deg, #ffffff 0%, #e8eaf6 100%);
  --tag-morning-bg: #e3f2fd; --tag-morning: #1565c0;
  --tag-afternoon-bg: #fff3e0; --tag-afternoon: #e65100;
  --tag-weekly-bg: #e8f5e9; --tag-weekly: #2e7d32;
  --tag-trade-bg: #fce4ec; --tag-trade: #c62828;
  --chart-tooltip-bg: #ffffff; --chart-tooltip-border: #e0e0e0;
  --chart-grid: rgba(0,0,0,0.06);
  --summary-bull-bg: #e8f5e9; --summary-bear-bg: #ffebee; --summary-neutral-bg: #fffde7;
}

/* Sepia theme */
[data-theme="sepia"] {
  --bg: #f4ecd8;
  --bg-card: #faf6eb;
  --bg-card-hover: #f0e8d4;
  --accent: #8b5e3c;
  --accent-dim: #6d4c41;
  --green: #558b2f;
  --red: #bf360c;
  --yellow: #f57f17;
  --text: #3e2723;
  --text-dim: #795548;
  --text-bright: #1b0f0a;
  --border: #d7cbb0;
  --header-bg: linear-gradient(135deg, #faf6eb 0%, #efe6d0 100%);
  --tag-morning-bg: #e8dcc8; --tag-morning: #5d4037;
  --tag-afternoon-bg: #f5e0c8; --tag-afternoon: #bf360c;
  --tag-weekly-bg: #dce8c8; --tag-weekly: #33691e;
  --tag-trade-bg: #f5d0c8; --tag-trade: #880e4f;
  --chart-tooltip-bg: #faf6eb; --chart-tooltip-border: #d7cbb0;
  --chart-grid: rgba(0,0,0,0.06);
  --summary-bull-bg: #e8f0d8; --summary-bear-bg: #f5e0d8; --summary-neutral-bg: #f5f0d8;
}

/* Theme toggle button */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:active { transform: scale(0.9); }

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Header */
.header {
  background: var(--header-bg);
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.3px;
}

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

/* Summary Bar */
.summary-bar {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.summary-bar::-webkit-scrollbar { display: none; }

.summary-chip {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.summary-chip .value {
  font-weight: 600;
  color: var(--text-bright);
}
.summary-chip.up .value { color: var(--red); }
.summary-chip.down .value { color: var(--accent); }

/* Tab Navigation */
.tab-nav {
  display: flex;
  padding: 0 20px;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab {
  flex-shrink: 0;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-schedule {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
  align-self: center;
  white-space: nowrap;
  padding-right: 4px;
}

/* Report List */
.report-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: block;
}
.report-card:active {
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

.report-card .date {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-card .title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 4px;
}

.report-card .preview {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-card .tags {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.tag.morning { background: var(--tag-morning-bg); color: var(--tag-morning); }
.tag.afternoon { background: var(--tag-afternoon-bg); color: var(--tag-afternoon); }
.tag.weekly { background: var(--tag-weekly-bg); color: var(--tag-weekly); }
.tag.trade { background: var(--tag-trade-bg); color: var(--tag-trade); }

/* Report Detail Page */
.report-content {
  padding: 20px;
  max-width: 680px;
  margin: 0 auto;
}

.report-content h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.3;
  margin-bottom: 8px;
}

.report-content .meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Section Cards */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.section-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
}

.section-header .toggle {
  font-size: 18px;
  color: var(--text-dim);
  transition: transform 0.3s;
}

.section.open .toggle {
  transform: rotate(180deg);
}

.section-body {
  padding: 0 16px 16px;
  font-size: 14px;
  line-height: 1.7;
  display: none;
}

.section.open .section-body {
  display: block;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

th {
  background: var(--bg);
  color: var(--text-dim);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }

/* Term Cards */
.term-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.term-card .term-name {
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

.term-card .term-level {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 6px;
}

.term-card .term-def {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
}

.term-card .term-example {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

/* Charts */
.chart-img {
  width: 100%;
  border-radius: 8px;
  margin: 10px 0;
}

/* Summary Boxes */
.summary-boxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-box {
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
}
.summary-box.bull { background: var(--summary-bull-bg); border-left: 3px solid var(--green); }
.summary-box.bear { background: var(--summary-bear-bg); border-left: 3px solid var(--red); }
.summary-box.neutral { background: var(--summary-neutral-bg); border-left: 3px solid var(--yellow); }

.summary-box .box-title {
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}

/* Up/Down Colors */
.up { color: var(--red); }
.down { color: var(--accent); }

/* Back Button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 0;
  margin-bottom: 12px;
}

/* Empty State */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty .icon { font-size: 48px; margin-bottom: 16px; }
.empty p { font-size: 14px; }

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.report-card { animation: fadeIn 0.3s ease forwards; }
.report-card:nth-child(2) { animation-delay: 0.05s; }
.report-card:nth-child(3) { animation-delay: 0.1s; }
.report-card:nth-child(4) { animation-delay: 0.15s; }

/* Responsive */
@media (min-width: 768px) {
  .report-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .report-content { padding: 32px; }
}
