/* Sidebar Header Adjustments */
#sidebar .profile-wrapper {
  text-align: center;
  padding: 1.5rem 0;
  margin-bottom: 0.5rem;
}

#sidebar .profile-wrapper #avatar {
  display: inline-block;
  margin: 0 auto 0.5rem;
}

#sidebar .profile-wrapper .site-title {
  text-align: center;
  margin: 0.5rem 0 0;
  line-height: 1.2;
}

/* Sidebar Toggles Container */
.sidebar-toggles {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  margin-bottom: 1rem !important;
}

/* Language Toggle Switch Styling */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The switch - the box around the slider */
.lang-toggle .switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

/* Hide default HTML checkbox */
.lang-toggle .switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.lang-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(128, 128, 128, 0.3);
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 24px;
}

.lang-toggle .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--sidebar-bg);
  border: 2px solid var(--sidebar-btn-color);
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
  box-sizing: border-box;
}

.lang-toggle input:checked + .slider {
  background-color: var(--sidebar-active-color, #2196F3);
}

.lang-toggle input:focus + .slider {
  box-shadow: 0 0 1px var(--sidebar-active-color, #2196F3);
}

.lang-toggle input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
  border-color: var(--sidebar-active-color);
}

/* Language labels */
.lang-toggle .lang-label {
  font-size: 0.75rem;
  color: var(--sidebar-muted-color);
  font-weight: 500;
  min-width: 22px;
  text-align: center;
  user-select: none;
}

.lang-toggle input:not(:checked) ~ .lang-label-en {
  color: var(--sidebar-active-color);
  font-weight: 700;
}

.lang-toggle input:checked ~ .lang-label-fa {
  color: var(--sidebar-active-color);
  font-weight: 700;
}

/* Mode toggle button alignment */
.sidebar-toggles .mode-toggle {
  border: none;
  background: transparent;
  color: var(--sidebar-btn-color);
  padding: 0.5rem;
  cursor: pointer;
}

.sidebar-toggles .mode-toggle:hover {
  color: var(--sidebar-active-color);
}

.sidebar-toggles .icon-border {
  margin: 0 0.5rem;
}

/* Persian font for Persian text */
html[lang="fa"] body {
  font-family: "Vazir", "Tahoma", "Arial", sans-serif;
}

html[lang="fa"] h1, 
html[lang="fa"] h2, 
html[lang="fa"] h3, 
html[lang="fa"] h4, 
html[lang="fa"] h5, 
html[lang="fa"] h6 {
  font-family: "Vazir", "Tahoma", "Arial", sans-serif;
  font-weight: bold;
}

/* RTL for Persian post content only */
html[lang="fa"] .post-content,
html[lang="fa"] #post-wrapper .content,
html[lang="fa"] article .card-text,
html[lang="fa"] .post-tail-wrapper,
html[lang="fa"] article.px-1,
html[lang="fa"] main article,
html[lang="fa"] article p,
html[lang="fa"] article ul,
html[lang="fa"] article ol,
html[lang="fa"] article blockquote {
  direction: rtl;
  text-align: right;
}

/* Keep code blocks LTR even in Persian posts */
html[lang="fa"] pre,
html[lang="fa"] code,
html[lang="fa"] .highlighter-rouge,
html[lang="fa"] .language-plaintext {
  direction: ltr;
  text-align: left;
}

/* Persian post titles */
html[lang="fa"] .card-title,
html[lang="fa"] h1.dynamic-title,
html[lang="fa"] #post-wrapper h1 {
  direction: rtl;
  text-align: right;
}

/* ============================================
   Cover Image Styles
   ============================================ */

/* Cover image in post preview cards (home page) */
.post-preview .post-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.25rem;
}

/* Cover image at the top of post page */
.post-cover-container {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
}

.post-cover-full {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  display: block;
}

/* .post-cover-full {
  justify-self: stretch;
} */

/* Style the img tag inside .post-cover-full if needed */
.post-cover-full img {
  width: 100%;
  height: auto;
  max-height: 500px;  
  display: block;
  object-fit: contain;
}

/* RTL/LTR positioning for preview cards */
/* English mode: Image on right, content on left */
html[lang="en"] .post-preview.flex-md-row-reverse .col-md-5 {
  order: 2;
}

html[lang="en"] .post-preview.flex-md-row-reverse .col-md-7 {
  order: 1;
}

/* Persian mode: Image on left, content on right */
html[lang="fa"] .post-preview.flex-md-row .col-md-5 {
  order: 1;
}

html[lang="fa"] .post-preview.flex-md-row .col-md-7 {
  order: 2;
}

/* Ensure images maintain aspect ratio and don't distort */
.post-preview img {
  border-radius: 0.25rem;
}

