/* CSS Variables for Dark/Light Mode */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a68;
  --accent-color: #0066cc;
  --accent-hover: #0052a3;
  --border-color: #e1e4e8;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.1);
  --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent-color: #58a6ff;
  --accent-hover: #79b8ff;
  --border-color: #30363d;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.3);
  --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.4);
}

/* Base Styles */
body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.7;
}

/* Wrapper */
.wrapper {
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease;
}

/* Header */
header {
  background-color: var(--bg-primary) !important;
  border-right: 1px solid var(--border-color) !important;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

header h1 a {
  color: var(--text-primary) !important;
  transition: color 0.2s ease;
}

header p {
  color: var(--text-secondary) !important;
}

/* Section */
section {
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary) !important;
  font-weight: 600;
  transition: color 0.3s ease;
}

p {
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* Links */
a {
  color: var(--accent-color) !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover) !important;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease;
}

th, td {
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary);
  transition: border-color 0.3s ease, color 0.3s ease;
}

th {
  background: var(--bg-secondary) !important;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

tr {
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease;
}

tr:nth-child(even) {
  background-color: var(--bg-secondary);
}

/* Dark Mode Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: var(--card-shadow);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--card-shadow-hover);
}

/* Profile Image */
header img {
  border-radius: 12px;
  border: 3px solid var(--accent-color);
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

header img:hover {
  transform: scale(1.02);
}

/* Lists */
ul, ol {
  color: var(--text-primary);
}

li {
  margin: 8px 0;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* Horizontal Rules */
hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 32px 0;
  transition: background-color 0.3s ease;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  transition: all 0.3s ease;
}

/* Code Blocks */
code {
  background: var(--bg-secondary) !important;
  color: var(--accent-color) !important;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  transition: background-color 0.3s ease, color 0.3s ease;
}

pre {
  background: var(--bg-secondary) !important;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

/* Details/Summary */
details {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  transition: all 0.3s ease;
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}

summary:hover {
  color: var(--accent-color);
}

/* Strong/Bold */
strong, b {
  color: var(--text-primary);
  font-weight: 600;
}

/* Emphasis */
em, i {
  color: var(--text-secondary);
}

/* Images in content */
section img {
  border-radius: 4px;
  transition: transform 0.2s ease;
}

section img:hover {
  transform: scale(1.02);
}

/* Checkboxes */
input[type="checkbox"] {
  accent-color: var(--accent-color);
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection */
::selection {
  background: var(--accent-color);
  color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .theme-toggle {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

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

section {
  animation: fadeIn 0.5s ease forwards;
}

/* Footer */
footer {
  color: var(--text-secondary) !important;
  border-top: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

/* Font Awesome Icons */
.fa {
  color: var(--accent-color);
  transition: color 0.2s ease;
}

.fa:hover {
  color: var(--accent-hover);
}

/* Medium SVG icon - white in dark mode */
[data-theme="dark"] img[src*="medium.svg"] {
  filter: invert(1) brightness(2);
}

/* Blog Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

/* Blog Card */
.blog-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-color);
}

.blog-card h4 {
  margin: 10px 0;
  font-size: 1.05em;
  line-height: 1.4;
}

.blog-card h4 a {
  color: var(--text-primary) !important;
  text-decoration: none;
}

.blog-card h4 a:hover {
  color: var(--accent-color) !important;
}

.blog-card p {
  color: var(--text-secondary);
  font-size: 0.88em;
  margin: 10px 0;
  line-height: 1.5;
}

.blog-date {
  color: var(--text-secondary);
  font-size: 0.8em;
  font-weight: 500;
}

.blog-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-color);
  color: white !important;
  border-radius: 15px;
  font-size: 0.72em;
  margin-top: 10px;
  margin-right: 5px;
  font-weight: 500;
}

.blog-card .read-more {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--accent-color) !important;
}

.blog-card .read-more:hover {
  text-decoration: underline;
}

/* Mobile responsive for blog grid */
@media (max-width: 600px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

/* Blog Card Thumbnail */
.blog-card img.blog-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
}
