@font-face {
  font-family: "Samim";
  src: url("../fonts/Samim.ttf") format("truetype");
}

@font-face {
  font-family: "Samim-Bold";
  src: url("../fonts/Samim-Bold.ttf") format("truetype");
}

/* General Styles */
body {
  font-family: "Samim", sans-serif;
  margin: 0;
  padding: 0;
  transition: background-color 0.5s, color 0.5s;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Samim-Bold", sans-serif;
  font-weight: 700;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px;
}

/* Light Theme */
body.light-theme {
  background-color: #e0e5ec;
  color: #3d4a5d;
}

/* Dark Theme */
body.dark-theme {
  background-color: #1a1a1a;
  color: #e0e5ec;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 20px 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 15px;
  margin: 20px;
  margin-bottom: 40px;
  transition: all 0.3s ease;
  position: relative; /* Add position relative for mobile menu positioning */
  z-index: 1001; /* Ensure header is on top */
}

body.dark-theme header {
  background: rgba(40, 40, 40, 0.2);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

header nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

header nav ul li {
  display: inline-block;
  margin-right: 25px;
}

header nav a {
  text-decoration: none;
  color: #3d4a5d;
  font-weight: 600;
  font-size: 1.2em;
  transition: color 0.3s ease, transform 0.3s ease;
}

header nav a:hover {
  color: #007bff;
  transform: translateY(-3px);
}

/* Hamburger Menu */
.hamburger {
  display: none;
  cursor: pointer;
}

.hamburger i {
  font-size: 1.5rem;
}

body.dark-theme header nav a {
  color: #e0e5ec;
}

body.dark-theme header nav a:hover {
  color: #17a2b8;
}

/* Theme-switcher */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.8em;
  transition: transform 0.3s ease;
}

#theme-toggle:hover {
  transform: scale(1.2);
}

body.dark-theme #theme-toggle {
  color: #fff;
}

/* Main Content */
main {
  padding: 30px;
  margin-bottom: 40px;
}

#introduction {
  display: flex;
  align-items: center;
  gap: 40px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 50px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.4s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#introduction:hover {
  transform: translateY(-10px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.profile-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#introduction h1 {
  font-family: "Samim-Bold", sans-serif;
}

@media (max-width: 768px) {
  #introduction {
    flex-direction: column;
    text-align: center;
  }

  #introduction h1 {
    font-size: 1.8rem;
  }

  body:not(.admin-panel) header nav ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 0 0 15px 15px;
    padding: 1rem 0;
    z-index: 1000;
  }

  body:not(.admin-panel) header nav ul.show {
    display: flex;
  }

  body.dark-theme:not(.admin-panel) header nav ul {
    background: rgba(40, 40, 40, 0.9);
  }

  body:not(.admin-panel) header nav ul li {
    margin: 0.5rem 0;
    text-align: center;
  }

  .hamburger {
    display: block;
  }

  [lang="fa"] header nav ul li {
    margin-left: 0;
  }
}

/* Footer */
footer {
  text-align: center;
  padding: 25px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin: 20px;
  border-radius: 15px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-theme footer {
  background: rgba(40, 40, 40, 0.2);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* RTL Styles */
[lang="fa"] {
  direction: rtl;
}

[lang="fa"] header nav ul li {
  margin-right: 0;
  margin-left: 25px;
  padding: 0.5em;
}

[lang="fa"] #introduction {
  text-align: right;
}

[lang="fa"] .introduction-text h1,
[lang="fa"] .introduction-text h2,
[lang="fa"] .introduction-text p {
  text-align: right;
}

[lang="fa"] .blog-post {
  text-align: right;
}

[lang="fa"] .post-full {
  text-align: right;
}

/* Blog list styles */
.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

.blog-post {
  border: none;
  padding: 25px;
  border-radius: 15px;
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.blog-post:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.blog-post h2 a {
  text-decoration: none;
  color: #3d4a5d;
}

body.dark-theme .blog-post h2 a {
  color: #e0e5ec;
}

.post-meta {
  font-size: 0.9em;
  color: #5a6a7d;
  margin-bottom: 12px;
}

body.dark-theme .post-meta {
  color: #a0b0c0;
}

.post-summary {
  margin-bottom: 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reaction-widget {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(90, 106, 125, 0.2);
}

.reaction-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  direction: rtl;
}

.reaction-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  direction: ltr;
}

.reaction-chip,
.reaction-picker-toggle {
  display: inline-flex;
  min-width: 48px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid rgba(90, 106, 125, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #455468;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.reaction-chip:hover:not(:disabled),
.reaction-picker-toggle:hover:not(:disabled) {
  border-color: #3390ec;
  background: #edf7ff;
  transform: translateY(-2px);
}

.reaction-chip.selected {
  border-color: #3390ec;
  background: #e1f1ff;
  color: #1686df;
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.11);
}

.reaction-chip:disabled,
.reaction-picker-toggle:disabled,
.reaction-picker-option:disabled {
  cursor: wait;
  opacity: 0.65;
}

.reaction-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.12rem;
  line-height: 1;
}

.reaction-count {
  min-width: 1ch;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.reaction-picker-wrap {
  position: relative;
}

.reaction-picker-toggle {
  position: relative;
  min-width: 39px;
  width: 39px;
  padding: 0;
  font-size: 1rem;
}

.reaction-picker-toggle > span {
  position: absolute;
  top: 1px;
  right: 4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #3390ec;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 13px;
}

.reaction-picker {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 9px);
  left: 0;
  display: flex;
  gap: 4px;
  padding: 7px;
  border: 1px solid rgba(90, 106, 125, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 30px rgba(37, 52, 70, 0.2);
  direction: ltr;
}

.reaction-picker[hidden] {
  display: none;
}

.reaction-picker.reaction-picker-right {
  left: auto;
  right: 0;
}

.reaction-picker.reaction-picker-right::after {
  left: auto;
  right: 14px;
}


.reaction-picker::after {
  position: absolute;
  bottom: -5px;
  left: 14px;
  width: 10px;
  height: 10px;
  background: inherit;
  content: "";
  transform: rotate(45deg);
}

.reaction-picker-option {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.45rem;
  transition: transform 0.16s ease, background 0.16s ease;
}

.reaction-picker-option:hover:not(:disabled) {
  background: #edf7ff;
  transform: scale(1.2) translateY(-2px);
}

.reaction-picker-option.selected {
  background: #dceeff;
}

.reaction-status {
  min-height: 1.4em;
  margin: 7px 0 0;
  color: #5a6a7d;
  font-size: 0.78rem;
}

body.dark-theme .reaction-widget {
  border-top-color: rgba(255, 255, 255, 0.12);
}

body.dark-theme .reaction-status {
  color: #a0b0c0;
}

body.dark-theme .reaction-chip,
body.dark-theme .reaction-picker-toggle {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #d8dee8;
}

body.dark-theme .reaction-chip:hover:not(:disabled),
body.dark-theme .reaction-picker-toggle:hover:not(:disabled),
body.dark-theme .reaction-chip.selected {
  border-color: #65b5f6;
  background: rgba(51, 144, 236, 0.22);
  color: #b9ddfa;
}

body.dark-theme .reaction-picker {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(38, 45, 56, 0.98);
}

body.dark-theme .reaction-picker-option:hover:not(:disabled),
body.dark-theme .reaction-picker-option.selected {
  background: rgba(51, 144, 236, 0.24);
}

.read-more {
  display: inline-block;
  padding: 10px 18px;
  background-image: linear-gradient(45deg, #007bff, #17a2b8);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: none;
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.read-more:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 123, 255, 0.4);
}

/* Single post styles */
.post-full {
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body.dark-theme .post-full {
  background-color: rgba(40, 40, 40, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.post-content {
  line-height: 1.8;
  font-size: 1.15em;
}

.post-content > :first-child {
  margin-top: 0;
}

.post-content > :last-child {
  margin-bottom: 0;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  line-height: 1.35;
  margin: 1.5em 0 0.6em;
}

.post-content a {
  color: #007bff;
  overflow-wrap: anywhere;
}

.post-content img,
.post-content video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5em auto;
  border-radius: 10px;
}

.post-content blockquote {
  margin: 1.5em 0;
  padding: 0.5em 1.2em;
  border-inline-start: 4px solid #17a2b8;
  background: rgba(23, 162, 184, 0.08);
  border-radius: 6px;
}

.post-content blockquote > :first-child {
  margin-top: 0;
}

.post-content blockquote > :last-child {
  margin-bottom: 0;
}

.post-content code {
  direction: ltr;
  unicode-bidi: embed;
  padding: 0.15em 0.4em;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.09);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.post-content pre {
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  padding: 1.1em;
  border-radius: 10px;
  background: #1f2937;
  color: #f3f4f6;
}

.post-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.post-content ul,
.post-content ol {
  padding-inline-start: 1.7em;
}

.post-content .task-list-item {
  list-style: none;
}

.post-content .task-list-item input {
  margin-inline-end: 0.45em;
}

.markdown-table {
  overflow-x: auto;
  margin: 1.5em 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
}

.post-content th,
.post-content td {
  padding: 0.65em 0.8em;
  border: 1px solid rgba(90, 106, 125, 0.35);
}

.post-content th {
  background: rgba(23, 162, 184, 0.1);
}

.markdown-video {
  position: relative;
  width: 100%;
  margin: 1.5em 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: #000;
}

.markdown-video iframe,
.markdown-video video {
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.markdown-help {
  display: block;
  margin-top: 0.5em;
  color: #5a6a7d;
  line-height: 1.5;
}

body.dark-theme .post-content code {
  background: rgba(255, 255, 255, 0.12);
}

body.dark-theme .markdown-help {
  color: #a0b0c0;
}

/* Login Form Styles */
.login-container {
  width: 350px;
  margin: 120px auto;
  padding: 30px;
  border: none;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
  text-align: center;
  margin-bottom: 25px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.login-container button {
  width: 100%;
  padding: 12px;
  background-image: linear-gradient(45deg, #007bff, #17a2b8);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.login-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 123, 255, 0.4);
}

/* Admin Panel Styles */

}

.admin-panel header {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 0;
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.admin-panel header h1 {
  font-size: 1.6em;
  color: #3d4a5d;
}

.admin-panel nav ul li a {
  color: #3d4a5d;
}

.admin-panel main {
  padding: 40px;
}

.admin-panel table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 25px;
  background-color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.admin-panel th,
.admin-panel td {
  border: 1px solid #e0e5ec;
  padding: 15px;
  text-align: left;
}

.admin-panel th {
  background-color: #f8f9fa;
}

.admin-panel .btn {
  display: inline-block;
  padding: 12px 20px;
  background-image: linear-gradient(45deg, #007bff, #17a2b8);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  margin-top: 25px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.admin-panel .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 123, 255, 0.4);
}

.admin-panel .action-links a {
  margin-right: 12px;
  color: #007bff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.admin-panel .action-links a:hover {
  color: #0056b3;
  text-decoration: underline;
}

.post-summary a {
    color: #007bff;
    text-decoration: none;
}

.post-summary a:hover {
    text-decoration: underline;
}

#load-more {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#load-more:hover {
    background-color: #0056b3;
}