/* ===== Daily Digest - Dark Theme ===== */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --red: #f85149;
  --orange: #d29922;
  --purple: #bc8cff;
  --cyan: #39d2c0;
  --gold: #ffd700;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Layout ===== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header h1 .badge {
  font-size: 11px;
  background: var(--accent);
  color: #000;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Calendar Widget ===== */
.calendar-widget {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-nav button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}

.calendar-nav button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--accent);
}

.calendar-nav .month-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.calendar-grid .day-header {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0;
  font-weight: 600;
}

.calendar-grid .day {
  font-size: 12px;
  padding: 4px 0;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  position: relative;
}

.calendar-grid .day:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.calendar-grid .day.has-digest {
  color: var(--text-primary);
  font-weight: 600;
}

.calendar-grid .day.has-digest::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar-grid .day.active {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.calendar-grid .day.active.has-digest::after {
  background: #000;
}

.calendar-grid .day.other-month {
  color: var(--text-muted);
  opacity: 0.4;
}

.calendar-grid .day.today {
  border: 1px solid var(--accent);
}

/* ===== Digest List ===== */
.digest-list-section {
  flex: 1;
  padding: 12px 16px;
  overflow-y: auto;
}

.digest-list-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.digest-list {
  list-style: none;
}

.digest-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}

.digest-list li:hover {
  background: var(--bg-tertiary);
}

.digest-list li.active {
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
}

.digest-list li .date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.digest-list li .summary {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.digest-list li .tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.digest-list li .tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--accent);
  border: 1px solid var(--border);
}

/* Search */
.search-box {
  position: relative;
  margin: 0 16px 12px;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  padding: 32px 48px;
  max-width: 900px;
  overflow-y: auto;
}

.content-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.content-header .content-date {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.content-header .content-nav {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.content-header .content-nav button {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.content-header .content-nav button:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* ===== Typography for digest content ===== */
.digest-content {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.8;
}

.digest-content h1 { font-size: 26px; margin: 28px 0 12px; color: var(--text-primary); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.digest-content h2 { font-size: 20px; margin: 24px 0 10px; color: var(--text-primary); }
.digest-content h3 { font-size: 17px; margin: 20px 0 8px; color: var(--text-primary); }
.digest-content h4 { font-size: 15px; margin: 16px 0 6px; color: var(--text-secondary); }

.digest-content p { margin: 8px 0; }
.digest-content strong { color: var(--text-primary); }

.digest-content a { color: var(--accent); text-decoration: none; }
.digest-content a:hover { text-decoration: underline; }

.digest-content ul, .digest-content ol { margin: 8px 0 8px 24px; }
.digest-content li { margin: 4px 0; }

/* Tables */
.digest-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.digest-content th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.digest-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.digest-content tr:hover td {
  background: var(--bg-secondary);
}

/* Price highlights */
.digest-content .price-up { color: var(--red); font-weight: 600; }
.digest-content .price-down { color: var(--green); font-weight: 600; }

/* Code blocks */
.digest-content pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  overflow-x: auto;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 0;
}

.digest-content code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  font-family: 'SF Mono', 'Consolas', monospace;
}

/* Blockquote */
.digest-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

/* Dividers */
.digest-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ===== Status badges ===== */
.badge-buy {
  display: inline-block;
  background: var(--red);
  color: #000;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.badge-sell {
  display: inline-block;
  background: var(--green);
  color: #000;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.badge-hold {
  display: inline-block;
  background: var(--orange);
  color: #000;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.badge-watch {
  display: inline-block;
  background: var(--purple);
  color: #000;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

/* ===== Loading skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .app-container {
    flex-direction: column;
  }
  .main-content {
    padding: 20px;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
