/* ===== Layout constants ===== */
:root {
  --header-h: 70px;
  --footer-h: 70px;
  --sticky-gap: 1.5rem;          /* top gap under header */
  --sticky-bottom-gap: 1.5rem;    /* bottom gap above footer */
}

/* Reserve space for the vertical scrollbar to avoid layout shifting */
html {
  scrollbar-gutter: stable both-edges;
}

/* ===== Global: dark theme ===== */
body {
  background-color: #0f172a;
  color: #3B82F6;
  font-family: "Segoe UI", Roboto, sans-serif;
  padding-top: var(--header-h);
  padding-bottom: var(--footer-h);
}

/* Fixed header/footer */
header, footer {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 1030;
}
header { top: 0; }
footer { bottom: 0; }

/* Content wrapper max width */
.content-wrapper {
  max-width: 1900px;
  margin: 0 auto;
}

/* Main row must at least fill viewport minus header/footer */
.content-row {
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

/* Allow inner scroll containers inside Bootstrap flex columns */
.content-row > [class^="col-"],
.content-row > [class*=" col-"] {
  min-height: 0;
}

/* Sticky wrapper fills full height between header and footer */
.layout-box {
  position: sticky;
  top: calc(var(--header-h) + var(--sticky-gap));

  /* exact height from below header to above footer (with gaps) */
  height: calc(100vh - var(--header-h) - var(--footer-h) - var(--sticky-gap) - var(--sticky-bottom-gap));

  display: flex;
  flex-direction: column;
}

/* Inner scroller takes the remaining height */
.layout-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Make the visual sidebar box stretch to full height and scroll inside */
.layout-scroll > .sidebar-box {
  height: 100%;
  overflow-y: auto;   /* scroll inside the styled box */
}

/* ===== Cards, images, tags ===== */
.blog-card {
  border: 1px solid rgba(0, 153, 255, 0.2);
  border-radius: 1rem;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  background-color: #1e293b;
}
.blog-card:hover {
  box-shadow: 0 0 12px rgba(0, 153, 255, 0.6);
  border-color: rgba(0, 153, 255, 0.6);
}

.blog-image {
  border-radius: 0.5rem;
  max-height: 180px;
  object-fit: cover;
  width: 100%;
}

.blog-tags { margin-top: -0.5rem; }
.blog-tag {
  background-color: #1B2433;
  color: #3A7FEF;
  border-radius: 999px;
  padding: 0.25em 0.75em;
  font-size: 0.8rem;
  margin-right: 0.4rem;
  display: inline-block;
  white-space: nowrap;
  box-shadow: 0 0 3px rgba(37, 99, 235, 0.5);
}

/* ===== Typography & links ===== */
h1, h4 { font-weight: 700; }
h4 { font-weight: 600; }

a {
  color: #38bdf8;
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Logo gradient text */
.logo {
  font-size: 2.8rem;
  font-weight: 800;
  color: #3b82f6;
  text-decoration: none;
  background: linear-gradient(45deg, #3b82f6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sidebar boxes */
.bg-light {
  background-color: #1e293b !important;
  color: #e2e8f0;
}

.rounded { border-radius: 0.75rem !important; }
.shadow { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3) !important; }

.sidebar-box {
  background-color: #1e293b;
  border: 1px solid #3b82f6;
  border-radius: 1rem;
  padding: 1.5rem;
  color: #cbd5e1;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
}
.sidebar-box h5 {
  font-weight: bold;
  color: #3b82f6;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-box a {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  margin: 0.25rem 0;
  transition: color 0.2s;
}
.sidebar-box a:hover { color: #ffffff; }
.sidebar-box .emoji { font-size: 1rem; }

/* ===== Content box ===== */
.content-body {
  background-color: #1e293b;
  border: 1px solid #3b82f6;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
  color: #cbd5e1;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.content-body h1 {
  font-size: 1.75rem;
  color: #e2e8f0;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.content-body h2 {
  font-size: 1.5rem;
  color: #e2e8f0;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.content-body h3 {
  font-size: 1.25rem;
  color: #e2e8f0;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.content-body h4 {
  font-size: 1.125rem;
  color: #e2e8f0;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.content-body p,
.content-body ul,
.content-body ol { margin-bottom: 1rem; }

.content-body a { color: #58a6ff; }
.content-body a:hover {
  color: #79c0ff;
  text-decoration: underline;
}

.content-body code {
  background-color: #161b22;
  color: #ffcb6b;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
}
.content-body pre {
  background-color: #161b22;
  color: #c9d1d9;
  font-family: 'Fira Code', monospace;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.content-body blockquote {
  border-left: 4px solid #30363d;
  background-color: #161b22;
  color: #8b949e;
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  border-radius: 0.25rem;
}
.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
.content-body th,
.content-body td {
  border: 1px solid #30363d;
  padding: 0.5rem;
}
.content-body th { background-color: #21262d; }

/* ===== ACE editor wrapper ===== */
.ace-wrapper {
  margin: 2rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
}
.ace-wrapper .ace-header {
  background-color: #24303f;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ace-wrapper .language-label {
  background-color: #3b82f6;
  color: #ffffff !important;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 700;
}

.ace-wrapper .copy-btn i {
  font-size: 1.25rem;
  color: #ffffff; /* bright by default */
  opacity: 0.85;  /* slightly softer than pure white */
  transition: color 0.2s ease, opacity 0.2s ease;
}

.ace-wrapper .copy-btn:hover i { color: #38b2ac; }
.ace-wrapper .ace-editor {
  background-color: #212835;
  font-size: 1rem !important;
  line-height: 1.6 !important;
}
.ace_editor,
.ace_editor .ace_scroller {
  font-size: 1rem !important;
  line-height: 1.6 !important;
  padding: 1rem !important;
}
