:root {
  --red: #b30000;
  --blue: #2f2eff;
  --purple: #4700b3;
  --green: #076600;
  --text-primary: #000000;
  --text-secondary: #4f4f4f;
  --link-color: #2f2eff;
  --body-bg: #ffffff;
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --overlay-bg: rgba(0, 0, 0, 0.4);
  --header-height: 60px;
  --accent-color: #005f61;
  --blue-transparent-focus: rgba(47, 46, 255, 0.2);
  --white: #ffffff;
  --card-shadow: 0 2px 8px var(--shadow-color);
  --footer-bg: #f8f9fa;
  --footer-text: #4f4f4f;
  --footer-border: #e0e0e0;
  --category-badge-bg: #005f61;
  --border-radius:10px;
  --btn:#B30000;
  --spinner-border: rgba(0, 0, 0, 0.1);
  --primary-color: #2f2eff;
  --primary-hover-color: #0000e6;
  --danger-color: #e53935;
  --muted-text-color: #6c757d;
  --widget-background-color: #ffffff;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  --input-bg: #f8f9fa;
  --button-hover-bg: #f1f3f5;
  --comment-body-text: #212529;
}
html[data-theme="dark"] {
  --red: #ffd6d6;
  --blue: #9f94ff;
  --purple: #ff99db;
  --green: #116600;
  --text-primary: #ffffff;
  --text-secondary: #dbfff3;
  --link-color: #ffd6d6;
  --body-bg: #0e0e20;
  --header-bg: #242a57;
  --card-bg: #242a57;
  --border-color: #434b9e;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --accent-color: #ff99db;
  --blue-transparent-focus: rgba(159, 148, 255, 0.25);
  --white: #ffffff;
  --card-shadow: 0 4px 12px var(--shadow-color);
  --footer-bg: #000000;
  --footer-text: #dbfff3;
  --footer-border: #434b9e;
  --category-badge-bg: #000000;
  --btn:#F5FFDB;
  --spinner-border: rgba(255, 255, 255, 0.2);
  --primary-color: #9f94ff;
  --primary-hover-color: #bfb8ff;
  --danger-color: #ef9a9a;
  --muted-text-color: #adb5bd;
  --widget-background-color: #242a57;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --input-bg: #0e0e20;
  --button-hover-bg: #434b9e;
  --comment-body-text: #e9ecef;
}

body,
.header,
.menu,
.search-input,
.theme-switcher,
.burger,
.back-icon,
.search-icon,
.suggestions,
.suggestions .result-card {
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease;
}

body {
  margin: 0;
  padding-top: var(--header-height);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--text-primary);
  background-color: var(--body-bg);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes push-right {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(4px);
  }
}

@keyframes push-left {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-4px);
  }
}
.container {
  max-width: 65%;
  margin: 0 auto;
  padding: 24px 16px;
  text-align: justify;
  line-height: 2;
}
/* === HEADER & NAVBAR STRUCTURE === */
.header {
  background: var(--header-bg);
  box-shadow: 0 1px 3px var(--shadow-color);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
}
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 1rem;
  position: relative;
}
.brand {
  flex-shrink: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* === DESKTOP MENU === */
.menu {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  position: relative;
}
.menu-inner {
  display: flex;
  gap: 0.25rem;
  overflow: auto;
      align-items: center;
}
.menu-inner a {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size:22px;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.menu-inner a:hover:not(.active) {
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 10px;
}
.menu-inner a.active {
  color: var(--link-color);
  font-weight: bold;
}

.search-container {
  display: flex;
  align-items: center;
}

/* === SHARED ACTION BUTTONS & INPUT === */
.search-icon,
.theme-switcher {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.search-icon:hover,
.theme-switcher:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}
.search-icon svg,
.theme-switcher svg {
  width: 22px;
  height: 22px;
}

.back-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
}
.back-icon:hover {
  background-color: var(--border-color);
}

.search-input {
  height: 44px;
  border-radius: 22px;
  border: 1px solid var(--border-color);
  background-color: var(--header-bg);
  font-size: 1rem;
  color: var(--text-primary);
  box-sizing: border-box;
  padding: 0 1rem;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--blue-transparent-focus);
}

/* === THEME SWITCHER ICONS === */
.theme-switcher .sun {
  animation: spin 8s linear infinite;
}
.theme-switcher .moon {
  display: none;
}
html[data-theme="dark"] .theme-switcher .sun {
  display: none;
}
html[data-theme="dark"] .theme-switcher .moon {
  display: block;
}

/* === MOBILE & RESPONSIVE STYLES === */
.burger,
.overlay,
.back-arrow {
  display: none;
}
.mobile-menu-header {
  display: none;
}
.close-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.close-menu-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}
.close-menu-btn svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 850px) {
 
  .container {
  max-width: 98%;
  margin: 0 auto;
  padding: 24px 16px;
  text-align: justify;
  line-height: 2;
}
  
  .menu {
    
    display: none;
  }
  .search-input,
  .back-icon {
    display: none;
  }

  .burger {
    fill: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1000;
  }
  .burger-line {
    width: 22px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .menu.is-active ~ .navbar .burger .burger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .menu.is-active ~ .navbar .burger .burger-line:nth-child(2) {
    opacity: 0;
  }
  .menu.is-active ~ .navbar .burger .burger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .menu {
    justify-content: left;
    display: flex;
    position: fixed;
    top: 0px;
    left: 0;
    width: 280px;
    height: 92%;

    background-color: var(--header-bg);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    flex-direction: column;
    padding-top: var(--header-height);
    z-index: 1001;
    box-shadow: 2px 0 5px var(--shadow-color);
  }
  .menu.is-active {
    transform: translateX(0);
  }
  .menu-inner {    align-items: flex-start;
              
    overflow: auto;
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
  }
  .menu-inner a {
    padding: 0.75rem 1rem;
  }

  .mobile-menu-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    box-sizing: border-box;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1002;
  }
  .menu-brand-text {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--red);
    text-decoration: none;
  }

  .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    z-index: 1000;
  }
  .overlay.is-active {
    display: block;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
  }

  /* Mobile Search Takeover */
  .header.search-active .navbar {
    display: none;
  }
  .header.search-active {
    display: flex;
    align-items: stretch;
    padding: 0;
  }
  .header.search-active .back-icon {
    display: flex;
    flex: 0 0 50px;
    align-items: center;
    justify-content: center;
    position: static;
    visibility: visible;
    opacity: 1;
  }
  .header.search-active .search-input {
    display: block;
    flex: 1 1 auto;
    width: auto;
    height: var(--header-height);
    margin-top: 1%;
  }
  .header.search-active .search-input {
    height: 44px;
  }
  .header {
    height: 60px;
  }
  .back-icon {
    margin-top: 1%;
    background: var(--header-bg);
  }
}

/* === DESKTOP SEARCH (OVERLAY BEHAVIOR) === */
@media (min-width: 851px) {
  .menu {
    overflow: auto;
    align-items: center;
    width: 68%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .menu::-webkit-scrollbar {
    display: none;
  }

  .search-input,
  .back-icon {
    position: fixed;
    top: 8px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
  }
  .search-input {
    right: 10px;
    width: 0;
  }
  .back-icon {
    background: var(--header-bg);
    right: calc(10px + 65% + 10px);
  }

  .header.search-active-desktop .search-input {
    opacity: 1;
    visibility: visible;
    width: 65%;
    transition: width 0.3s ease, opacity 0.3s ease;
  }
  .header.search-active-desktop .back-icon {
    display: flex;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease 0.1s;
  }
  .header.search-active-desktop .overlay {
    display: block;
    opacity: 1;
    visibility: visible;
    background: transparent;
    z-index: 1000;
  }
}

/* === SEARCH RESULTS === */
.suggestions {
  position: fixed;
  top: calc(var(--header-height) + 5px);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow-color);
  list-style: none;
  padding: 0.5rem;
  margin: 0;
  z-index: 9999;
  max-height: 400px;
  overflow-y: auto;
  display: none;
}
.suggestions .result-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  text-decoration: none;
  align-items: center;
}
.suggestions .result-card:hover {
  background-color: var(--border-color);
}
.result-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--border-color);
}
.result-icon svg {
  width: 100%;
  height: 100%;
}
.result-text {
  text-align: left;
  flex-grow: 1;
  min-width: 0;
}
.result-title {
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.result-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}
.result-title,
.result-description {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-arrow {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  transition: color 0.2s ease, transform 0.2s ease;
}
.suggestions .result-card:hover .result-arrow {
  color: var(--accent-color);
  transform: translateX(4px);
}
.suggestions li.no-results {
  padding: 1rem;
  text-align: center;
  color: var(--text-secondary);
}

@media (max-width: 850px) {
  .suggestions {
    width: 100%;
    top: var(--header-height);
    left: 0;
    right: 0;
    border-radius: 0 0 8px 8px;
    box-sizing: border-box;
  }
}
@media (min-width: 851px) {
  .suggestions {
    width: 50%;
    left: 50%;
    transform: translateX(-50%);
  }
}
.menu-arrow {
  display: none; /* JS will toggle visibility */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--header-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--text-primary);
  box-shadow: 0 2px 5px var(--shadow-color);
  z-index: 10;
}

.menu-arrow.left {
  left: -10px; /* 10px outside the menu container */
}

.menu-arrow.right {
  right: -10px; /* 10px outside the menu container */
}

.menu-arrow .arrow-svg {
  width: 22px;
  height: 22px;
}
.arrow-static {
  opacity: 0.4;
}
.menu-arrow.right .arrow-animated {
  animation: push-right 1.5s ease-in-out infinite;
}
.menu-arrow.left .arrow-animated {
  animation: push-left 1.5s ease-in-out infinite;
}

@media (min-width: 851px) {
  .menu-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
.menu-inner::-webkit-scrollbar {
  display: none;
}

.app-footer {
  color: var(--footer-text);
  background-color: var(--footer-bg);
  padding: 3rem 2rem;
  border-top: 1px solid var(--footer-border);
}
.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 2rem;
}
.footer-section h3,
.footer-section h4 {
  font-family: "Lora", serif;
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  text-align: left;
}
.footer-about p {
  line-height: 1.6;
  margin: 0;
  font-size: 0.95rem;
}
.footer-socials {
  display: flex;
  gap: 1.25rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.footer-socials a {
  color: inherit;
  display: inline-block;
}
.footer-socials svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: color 0.2s ease, transform 0.2s ease;
}
.footer-socials a:hover {
  color: var(--accent-color);
  transform: translateY(-2px);
}
.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-section ul li {
  margin-bottom: 0.75rem;
}
.footer-section a,
.app-footer .footer-about p {
  color: var(--footer-text);
  text-decoration: none;
  transition: color 0.2s ease;
  font-size: 0.95rem;
}
.footer-section a:hover {
  color: var(--accent-color);
}
.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--footer-border);
  font-size: 0.9rem;
}
/* Comments Widget */
.firebase-comments-widget {
    max-width: 700px;
    margin: 2rem auto;
    padding: 1rem;
}
.spinner {
    border: 4px solid var(--spinner-border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    margin: 20px auto;
    animation: spin 1s ease infinite;
}
.muted {
    color: var(--muted-text-color);
    text-align: center;
}
.muted.error {
    color: var(--danger-color);
}
.comment-form-shell {
    margin-bottom: 1.5rem;
}
.comment-form {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}
.replying-to {
    font-size: 0.9em;
    color: var(--muted-text-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.comment-form input[type="text"],
.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--blue-transparent-focus);
}
.comment-form textarea {
    resize: vertical;
    min-height: 80px;
}
.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
#char-counter {
    font-size: 0.8em;
    color: var(--muted-text-color);
}
.actions {
    display: flex;
    gap: 0.5rem;
}
.btn {
    display: inline-block;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
}
.btn:hover {
    background-color: var(--button-hover-bg);
}
.btn.primary {
    color: var(--white);
    background-color: var(--blue);
    border-color: var(--primary-color);
}
.btn.primary:hover {
    background-color: var(--primary-hover-color);
    border-color: var(--primary-hover-color);
}
.btn.primary:disabled {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    opacity: 0.65;
    cursor: not-allowed;
}
.btn.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 400;
    border: none;
    color: var(--muted-text-color);
}
.btn.small:hover {
    background: 0 0;
    color: var(--primary-color);
    text-decoration: underline;
}
.btn.small.danger {
    color: var(--danger-color);
}
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.comment-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    box-shadow: var(--card-shadow);
}
.comment-item.reply-item {
    margin-left: 20px;
}
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}
.comment-date {
    font-size: 0.8em;
    color: var(--muted-text-color);
}
.comment-body {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0.5rem 0;
    color: var(--comment-body-text);
}
.comment-actions {
    margin-top: 0.5rem;
}
.inline-reply-slot > .comment-form-shell {
    margin-top: 1rem;
    margin-bottom: 0;
}
@media (max-width: 600px) {
    .firebase-comments-widget {
        padding: 0.5rem;
        margin: 1rem auto;
    }
    .comment-form {
        padding: 1rem;
    }
    .form-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .actions {
        justify-content: flex-end;
    }
    #char-counter {
        text-align: right;
        margin-bottom: 0.5rem;
    }
    .comment-item.reply-item {
        margin-left: 10px;
    }
}


.post-meta-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.byline {
    font-size: 0.9rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.author-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
}

.author-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.author.vcard .name a {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.author.vcard .name a:hover {
    color: var(--accent-color);
}

.author-status.verified {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
}

.verified-author svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    fill: var(--accent-color);
}

.entry-modified-date {
    color: var(--text-secondary);
    white-space: nowrap;
    display: inline; /* Keep it on the same line if space allows */
}

.share-button-wrapper {
    display: flex;
    align-items: center;
}

.share-button {
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.share-button:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--white);
}

.share-button svg path {
    fill: currentColor;
}


@media (max-width: 520px) {
  
    .author-details {
      flex-basis: 100%; /* Allow details to take full width if they wrap */
    }
    .entry-modified-date {
       display: block; /* Stack date below author on small screens */
       margin-top: 4px;
    }
}
