/* --- Core Readability and Layout --- */

:root {
  --bg-color: #ffffff;
  --text-color: #111111;
  --accent-color: #2386c8;
}

[data-theme="dark"] {
  --bg-color: #1e1e1e;
  --text-color: #e0e0e0;
  --accent-color: #8ab4f8;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.6;
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  background-color: #ffffff;
  color: #111111;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #eaeaea;
}

a {
  color: #2386c8;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3 {
  line-height: 1.2;
}
article {
  border-bottom: 1px solid #ccc;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
article:last-of-type {
  border-bottom: none;
}
footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.9rem;
  color: #555;
}
button {
  font-size: 1rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #f4f4f4;
  border-radius: 4px;
}

/* --- THEME TOGGLE STYLING --- */
body[data-theme="dark"] {
  background-color: #1e1e1e;
  color: #e0e0e0;
}
body[data-theme="dark"] a {
  color: #8ab4f8;
}
body[data-theme="dark"] article {
  border-bottom-color: #444;
}
body[data-theme="dark"] footer {
  color: #aaa;
}
body[data-theme="dark"] button {
  border-color: #555;
  background-color: #333;
  color: #e0e0e0;
}

/* --- STYLES FOR BLOG POST ELEMENTS --- */

/* On a single post page, the article doesn't need a bottom border */
main > article {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 3rem;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 4px; /* A very subtle curve */
}

figure {
  margin: 2rem 0; /* Add space around images/figures */
}

figcaption {
  text-align: center;
  font-size: 0.9em;
  color: #555;
  margin-top: 0.5rem;
}

/* Style for blockquotes */
blockquote {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
  border-left: 3px solid #ccc;
  font-style: italic;
  color: #555;
}

blockquote cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.9em;
}

/* Style for code blocks */
pre {
  background-color: #f4f4f4;
  padding: 1rem;
  overflow-x: auto; /* Allow horizontal scrolling for long code lines */
  border-radius: 4px;
  font-size: 0.9em;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Simple horizontal rule */
hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 2rem 0;
}

/* "Back to posts" navigation link */
main > nav {
  text-align: center;
}

/* --- [NEW] DARK MODE STYLES FOR POST ELEMENTS --- */

body[data-theme="dark"] figcaption {
  color: #aaa;
}

body[data-theme="dark"] blockquote {
  border-left-color: #555;
  color: #bbb;
}

body[data-theme="dark"] pre {
  background-color: #2a2a2a;
}

body[data-theme="dark"] hr {
  border-top-color: #444;
}

/* --- [CORRECTED] STYLES FOR CHART CONTAINER --- */

.chart-container {
  position: relative; /* This is crucial for the child canvas */
  height: 0; /* The container's height is set to 0... */
  overflow: hidden; /* Prevents any content from spilling out */

  /* ...and its height is created by this padding */
  /* 56.25% creates a 16:9 aspect ratio. Use 75% for 4:3, or 50% for 2:1 */
  padding-bottom: 56.25%;

  /* Optional styling */
  margin: 2rem 0;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

/* This rule ensures the canvas inside fills the container we've created */
.chart-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* --- [CORRECTED] DARK MODE STYLE FOR CHART CONTAINER --- */

body[data-theme="dark"] .chart-container {
  border-color: #444;
  /* You might want to remove the background color or adjust Chart.js colors */
}

.video-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  /* 16:9 Aspect Ratio (9 / 16 = 56.25%) */
  padding-top: 56.25%;
  margin: 2rem 0; /* Use same vertical margin as figures */
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Reduce space when a video follows a figure */
figure + .video-container {
  margin-top: 1rem;
}

/* --- [NEW] STYLES FOR MESSAGES (Loading/Error) --- */

.message {
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #f4f4f4;
  text-align: center;
}

.message.error {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

/* A simple utility class to hide elements */
.hidden {
  display: none;
}

/* --- [NEW] DARK MODE STYLES FOR MESSAGES --- */

body[data-theme="dark"] .message {
  background-color: #2a2a2a;
  border-color: #444;
}

body[data-theme="dark"] .message.error {
  color: #f5c6cb;
  background-color: #491f22;
  border-color: #721c24;
}

/* --- [NEW] STYLES FOR SOCIAL ICONS IN FOOTER --- */

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem; /* Space between icons */
  margin-bottom: 1rem;
}

.social-links a {
  /* Prevent the underline from appearing on the icon */
  text-decoration: none;
  /* Add a subtle fade on hover */
  opacity: 0.7;
  transition: opacity 0.2s ease-in-out;
}

.social-links a:hover {
  opacity: 1;
}

.social-links svg {
  width: 24px;
  height: 24px;
  /* This magic line makes the SVG take the color of the parent link */
  fill: currentColor;
}

/* --- Search Box Styles --- */
.search-container {
  margin-bottom: 2rem;
}

#search-box {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: 5px;
  border: 1px solid var(--text-color);
  background-color: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box; /* Ensures padding doesn't affect the width */
}

#search-box:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 5px var(--accent-color);
}

#theme-toggle {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-color); /* Icon color will inherit this */
  line-height: 0; /* Helps with vertical alignment */
}
#theme-toggle:hover {
  opacity: 0.7;
}

/* --- TAGS / CATEGORIES PILLS --- */

.post-meta {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 50px; /* Makes them pill-shaped */
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* --- COLOR SCHEMES (Light Mode) --- */

/* Coding: Blue */
.tag.coding {
  background-color: #e3f2fd;
  color: #1565c0;
}

/* Economics: Green */
.tag.economics {
  background-color: #e8f5e9;
  color: #2e7d32;
}

/* Hobbies (Photo/Recipes): Orange */
.tag.hobbies {
  background-color: #fff3e0;
  color: #ef6c00;
}

/* Default/Other: Grey */
.tag.general {
  background-color: #f5f5f5;
  color: #616161;
}

/* --- COLOR SCHEMES (Dark Mode) --- */

body[data-theme="dark"] .tag.coding {
  background-color: #103044;
  color: #90caf9;
}

body[data-theme="dark"] .tag.economics {
  background-color: #0f3315;
  color: #a5d6a7;
}

body[data-theme="dark"] .tag.hobbies {
  background-color: #422503;
  color: #ffcc80;
}

body[data-theme="dark"] .tag.general {
  background-color: #333;
  color: #bdbdbd;
}

/* Adjust the H3 so it sits closer to the tag */
article h3 {
  margin-top: 0;
}

/* --- START OF FILE styles1.css --- */
/* ... keep all your existing CSS ... */

/* --- NEW: Rate Summary Cards --- */
.rate-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.rate-card {
  background-color: var(--bg-color);
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rate-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.rate-card h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  color: #555;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.rate-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1;
}

.rate-date {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.5rem;
  display: block;
}

/* Trend indicators (Up/Down arrows) */
.trend {
  font-size: 1rem;
  vertical-align: middle;
  margin-left: 5px;
}
.trend.up {
  color: #d32f2f;
} /* Red for increase */
.trend.down {
  color: #2e7d32;
} /* Green for decrease */
.trend.flat {
  color: #777;
}

/* Dark mode adjustments for cards */
body[data-theme="dark"] .rate-card {
  border-color: #444;
  background-color: #252525;
}
body[data-theme="dark"] .rate-card h2,
body[data-theme="dark"] .rate-date {
  color: #aaa;
}
body[data-theme="dark"] .trend.up {
  color: #ff5252;
}
body[data-theme="dark"] .trend.down {
  color: #69f0ae;
}

/* --- NEW: Data Table --- */
.table-container {
  overflow-x: auto;
  margin-top: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  font-weight: 600;
  color: #555;
  background-color: #f9f9f9;
}

/* Dark mode table */
body[data-theme="dark"] th {
  background-color: #2a2a2a;
  color: #ccc;
  border-bottom-color: #444;
}
body[data-theme="dark"] td {
  border-bottom-color: #333;
}

/* Utility for Loading Spinner */
.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: #777;
  font-style: italic;
}

/* --- RAG / AGENT CONTEXT STYLING --- */
.rag-container {
  margin: 3rem 0;
  border: 1px solid #333;
  background-color: #f8f8f8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  border-radius: 4px;
  overflow: hidden;
}

.rag-header {
  background-color: #333;
  color: #fff;
  padding: 0.5rem 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.rag-content {
  padding: 1.5rem;
}

.rag-content dl {
  display: grid;
  grid-template-columns: max-content 1fr; /* NEW: Snaps col 1 to text width */
  gap: 1.5rem; /* Increased gap for better breathing room */
  margin: 0;
  align-items: start; /* Prevents border from stretching weirdly if content is short */
}

/* Ensure the border spans the full height of the row */
.rag-content dt {
  font-weight: 700;
  color: #555;
  border-right: 2px solid var(--accent-color);
  padding-right: 1rem;
  text-align: right;
  white-space: nowrap;
  height: 100%; /* Forces height match */
}

.rag-content dd {
  margin: 0;
  color: var(--text-color);
}

/* Mobile Responsiveness for RAG Box */
@media (max-width: 600px) {
  .rag-content dl {
    grid-template-columns: 1fr;
  }
  .rag-content dt {
    border-right: none;
    border-bottom: 2px solid var(--accent-color);
    text-align: left;
    padding-right: 0;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
    width: fit-content;
  }
  .rag-content dd {
    margin-bottom: 1.5rem;
  }
}

/* Dark Mode Overrides for RAG Box */
body[data-theme="dark"] .rag-container {
  background-color: #111;
  border-color: #444;
}

body[data-theme="dark"] .rag-header {
  background-color: #222;
  color: #8ab4f8;
}

body[data-theme="dark"] .rag-content dt {
  color: #aaa;
}
