@font-face {
  font-family: 'Sahel';
  src: url('/font/Sahel.woff2') format('woff2'),
       url('/font/Sahel.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   ROOT VARIABLES
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --success: #7F151B;
  --pahvaz-brown: #7F151B;
  --pahvaz-brown-dark: #5f1014;
  --pahvaz-orange: #EB8C23;
  --pahvaz-surface: #f5f2f2;
  --pahvaz-header-gray: #949393;
  --pahvaz-header-gray-dark: #858585;
  --pahvaz-header-text: #5c5c5c;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  --transition: all 0.3s ease;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Sahel', sans-serif;
  line-height: 1.6;
  color: var(--gray-900);
  background-color: var(--pahvaz-surface);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

p {
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  line-height: clamp(1.5em, 4.5vw, 1.75em);
}

h1 {
  font-size: clamp(1.5rem, 5.3vw, 2.1rem);
}

h2 {
  font-size: clamp(1.3rem, 4.8vw, 1.6rem);
}

h3 {
  font-size: clamp(1.2rem, 4.2vw, 1.4rem);
}

button,
input,
textarea,
select {
  font-family: inherit;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: var(--spacing-md);
  text-decoration: none;
  z-index: 100;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ============================================
   HEADER
   ============================================ */

.header {
  background: var(--pahvaz-header-gray);
  color: white;
  padding: 0.65rem 0;
  border-bottom: 3px solid var(--pahvaz-brown);
  box-shadow: 0 4px 16px rgba(92, 92, 92, 0.22);
  position: sticky;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
  /* position: sticky;
  top: 0;
  z-index: 50; */
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.logo-icon {
  font-size: 2rem;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 16px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 4px;
  background: var(--pahvaz-brown);
  color: white;
  font-weight: 800;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.language-switch:hover,
.language-switch:focus {
  background: var(--pahvaz-brown-dark);
  border-color: var(--pahvaz-orange);
  color: white;
  outline: none;
  transform: translateY(-1px);
}

html[dir="ltr"] body {
  direction: ltr;
  text-align: left;
}

html[dir="ltr"] .site-nav,
html[dir="ltr"] .site-nav .links-wrapper,
html[dir="ltr"] .teacher-section,
html[dir="ltr"] .seo-intro,
html[dir="ltr"] .courses-section,
html[dir="ltr"] .calculators-section,
html[dir="ltr"] .course-info,
html[dir="ltr"] .clip-content,
html[dir="ltr"] .free-clip-detail-shell,
html[dir="ltr"] .calculator-shell {
  direction: ltr;
  text-align: left;
}

html[dir="ltr"] .course-card,
html[dir="ltr"] .course-card h3,
html[dir="ltr"] .course-price,
html[dir="ltr"] .calculator-card,
html[dir="ltr"] .calculator-card h3,
html[dir="ltr"] .calculator-price,
html[dir="ltr"] .calculator-badge,
html[dir="ltr"] .free-clip-comments,
html[dir="ltr"] .free-clip-comment-card,
html[dir="ltr"] .free-clip-comment-meta {
  direction: ltr;
  text-align: left;
}

html[dir="ltr"] .course-card p,
html[dir="ltr"] .calculator-card p,
html[dir="ltr"] .library-card p,
html[dir="ltr"] .article-card p,
html[dir="ltr"] .my-article-card p,
html[dir="ltr"] .free-clip-comment-card p {
  direction: ltr;
  text-align: justify;
  text-justify: auto;
}

html[dir="ltr"] .footer {
  direction: ltr;
  text-align: center;
}


.site-nav {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  direction: rtl;
  text-align: center;
}

.site-nav .links-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  width: 100%;
  margin: 0 auto;
}

.site-nav .nav-link {
  padding: 0;
  text-align: center;
}

.site-nav .nav-link a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: white;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.site-nav .nav-link a:hover,
.site-nav .nav-link a:focus,
.site-nav .nav-link a.is-active {
  color: var(--pahvaz-orange);
  background-color: #dedcdc;
  border-color: var(--pahvaz-orange);
  outline: none;
  transform: translateY(-1px);
}/* ============================================
   AUTHENTICATION SECTION
   ============================================ */

.auth-section {
  flex: 1;
  min-width: 300px;
}

.auth-form {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.auth-inputs {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(260px, 0.85fr);
  gap: 0.75rem;
  flex: 1 1 560px;
  min-width: min(100%, 540px);
  align-items: center;
}

.input-group {
  flex: 1;
  min-width: 120px;
}

.password-field {
  position: relative;
  min-width: 0;
}

.auth-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
}

.auth-password-row .language-switch {
  min-height: 44px;
  padding-inline: 14px;
  border-radius: 10px;
}

.auth-inputs > .auth-input {
  min-width: 0;
}

.auth-input {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(127, 21, 27, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--pahvaz-header-text);
  font-size: 0.95rem;
  font-weight: 600;
  direction: ltr;
  text-align: left;
  transition: var(--transition);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 7px 18px rgba(92, 92, 92, 0.18);
}

.password-field .auth-input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pahvaz-header-gray-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.password-eye-icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.password-toggle:hover,
.password-toggle:focus {
  color: var(--pahvaz-red);
  background: rgba(127, 21, 27, 0.08);
  outline: none;
}

.auth-input::placeholder {
  color: var(--pahvaz-header-gray-dark);
  font-weight: 500;
}

.auth-input:focus {
  outline: none;
  background: white;
  border-color: var(--pahvaz-header-gray);
  box-shadow: 0 0 0 3px rgba(148, 147, 147, 0.26), 0 9px 22px rgba(127, 21, 27, 0.18);
}

.auth-buttons {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.auth-btn {
  min-height: 44px;
  padding: 0.7rem 1.15rem;
  border: 1px solid rgba(127, 21, 27, 0.14);
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  box-shadow: 0 7px 18px rgba(92, 92, 92, 0.18);
}

.btn-primary {
  background: white;
  color: var(--pahvaz-brown);
}

.btn-primary:hover {
  background: var(--pahvaz-brown);
  color: white;
  transform: translateY(-2px);
  border-color: var(--pahvaz-header-gray);
  box-shadow: 0 9px 22px rgba(127, 21, 27, 0.22);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: var(--pahvaz-brown);
  color: white;
}

.btn-danger:hover {
  background: var(--pahvaz-brown-dark);
  border-color: var(--pahvaz-header-gray);
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(127, 21, 27, 0.22);
}

.btn-danger:active {
  transform: translateY(0);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 0.875rem;
}

.user-email {
  background: rgba(255, 255, 255, 0.94);
  color: var(--pahvaz-brown);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  box-shadow: 0 7px 18px rgba(92, 92, 92, 0.18);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  padding: var(--spacing-2xl) 0;
  min-height: 60vh;
}

.davy-mascot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: ltr;
  width: 5cm;
  height: 5cm;
  opacity: 0.94;
  pointer-events: none;
  transform: translate3d(var(--davy-x, 16px), var(--davy-y, 230px), 0) rotate(var(--davy-rotate, 0deg));
  transition: transform 5.6s cubic-bezier(0.42, 0, 0.18, 1), opacity 0.3s ease;
  will-change: transform;
}

.davy-mascot[hidden] {
  display: none;
}

.davy-mascot img {
  display: block;
  height: 5cm;
  width: auto;
  max-width: 5cm;
  transform-origin: 50% 90%;
  filter: drop-shadow(0 10px 18px rgba(92, 92, 92, 0.22));
  animation: davyBob 2.8s ease-in-out infinite;
}

@keyframes davyBob {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(0, -9px, 0) scale(1.015);
  }
}

@media (prefers-reduced-motion: reduce) {
  .davy-mascot {
    transition: none;
  }

  .davy-mascot img {
    animation: none;
  }
}

.section-title {
  font-size: clamp(1.3rem, 4.8vw, 1.6rem);
  margin-bottom: var(--spacing-xl);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  color: var(--pahvaz-brown);
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.section-title::after {
  content: none;
}

.seo-intro {
  display: grid;
  gap: var(--spacing-md);
  padding: 0 0 var(--spacing-2xl);
  margin-bottom: var(--spacing-2xl);
  border-bottom: 1px solid rgba(127, 21, 27, 0.14);
}

.seo-intro[hidden] {
  display: none;
}

.seo-intro-kicker {
  margin: 0;
  color: var(--pahvaz-orange);
  font-weight: 800;
  font-size: 0.98rem;
}

.seo-intro h1 {
  margin: 0;
  color: var(--pahvaz-brown);
  line-height: 1.55;
  max-width: 880px;
}

.seo-intro p {
  margin: 0;
  max-width: 980px;
  color: var(--gray-700);
  text-align: justify;
  text-justify: auto;
}

.seo-intro-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: var(--spacing-sm) 0 0;
}

.seo-intro-list li {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(127, 21, 27, 0.14);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--pahvaz-brown-dark);
  font-weight: 700;
  line-height: 1.6;
}

.seo-intro-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 6px;
  border: 0;
  background: var(--pahvaz-brown);
  color: white;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.5;
  transition: var(--transition);
}

.seo-intro-link:hover,
.seo-intro-link:focus {
  background: var(--pahvaz-brown-dark);
  outline: 2px solid rgba(148, 147, 147, 0.42);
  outline-offset: 2px;
}

/* ============================================
   COURSES SECTION
   ============================================ */

.courses-section {
  margin-bottom: var(--spacing-2xl);
  min-width: 0;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
  min-width: 0;
}

.course-card {
  position: relative;
  overflow: hidden;
  background: white;
  border-radius: 0.5rem;
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border: 1px solid rgba(127, 21, 27, 0.14);
  border-top: 6px solid var(--pahvaz-brown);
  min-width: 0;
}

.course-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 6px;
  background: var(--pahvaz-header-gray);
}

.course-card:hover {
  border-color: rgba(127, 21, 27, 0.28);
  box-shadow: 0 14px 28px rgba(127, 21, 27, 0.14);
  transform: translateY(-4px);
}

.course-card h3 {
  font-size: clamp(1.2rem, 4.2vw, 1.4rem);
  margin-bottom: var(--spacing-lg);
  padding-bottom: 0;
  color: var(--pahvaz-brown);
  line-height: 1.45;
  position: relative;
  transition: color 0.3s ease;
  overflow-wrap: anywhere;
}

.course-card h3 a,
.article-card h3 a,
.my-article-card h3 a {
  color: inherit;
  text-decoration: none;
}

.course-card h3 a:hover,
.course-card h3 a:focus,
.article-card h3 a:hover,
.article-card h3 a:focus,
.my-article-card h3 a:hover,
.my-article-card h3 a:focus {
  color: var(--pahvaz-brown-dark);
  outline: none;
  text-decoration: none;
}

.course-card h3::after {
  content: none;
}

.course-card:hover h3 {
  color: var(--pahvaz-brown-dark);
}

.course-card p {
  color: var(--gray-700);
  margin-bottom: var(--spacing-md);
  flex-grow: 1;
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  direction: rtl;
  text-align: justify;
  text-justify: auto;
  overflow-wrap: anywhere;
}

.course-price {
  font-weight: bold;
  color: var(--pahvaz-brown);
  margin-bottom: var(--spacing-md);
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.course-card button {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  border-radius: 0.375rem;
  background: var(--pahvaz-brown);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: auto;
}

.course-card button:hover {
  background: var(--pahvaz-orange);
  transform: translateY(-2px);
}

.course-card button:focus {
  outline: 2px solid var(--pahvaz-header-gray);
  outline-offset: 2px;
}

/* ============================================
   ONLINE CALCULATORS
   ============================================ */

.calculators-section {
  margin-bottom: var(--spacing-2xl);
  min-width: 0;
}

.calculators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
  min-width: 0;
}

.calculator-card {
  position: relative;
  overflow: hidden;
  background: white;
  border-radius: 0.5rem;
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(235, 140, 35, 0.3);
  border-inline-start: 6px solid var(--pahvaz-orange);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: var(--transition);
}

.calculator-card:hover {
  border-color: rgba(235, 140, 35, 0.54);
  box-shadow: 0 14px 28px rgba(235, 140, 35, 0.13);
  transform: translateY(-4px);
}

.calculator-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--pahvaz-brown);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

.calculator-badge.is-free {
  background: #dcfce7;
  color: #166534;
}

.calculator-card .calculator-badge {
  background: rgba(148, 147, 147, 0.16);
  color: var(--pahvaz-brown);
  border: 1px solid var(--pahvaz-header-gray);
  box-shadow: none;
}

.calculator-card .calculator-badge.is-free {
  background: rgba(235, 140, 35, 0.14);
  color: var(--pahvaz-brown);
  border-color: var(--pahvaz-orange);
}

.calculator-card h3 {
  font-size: clamp(1.2rem, 4.2vw, 1.4rem);
  margin-bottom: var(--spacing-lg);
  padding-bottom: 0;
  color: var(--pahvaz-orange);
  line-height: 1.45;
  position: relative;
  transition: color 0.3s ease;
  overflow-wrap: anywhere;
  text-shadow: none;
}

.calculator-card h3::after {
  content: none;
}

.calculator-card:hover h3 {
  color: var(--pahvaz-brown-dark);
}

.calculator-card p {
  color: var(--gray-700);
  margin-bottom: var(--spacing-md);
  flex-grow: 1;
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  direction: rtl;
  text-align: justify;
  text-justify: auto;
  overflow-wrap: anywhere;
}

.calculator-price {
  font-weight: 700;
  color: var(--pahvaz-brown);
  text-shadow: none;
  margin-bottom: var(--spacing-md);
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.calculator-card button,
.calculator-submit-btn,
.calculator-buy-btn,
.calculator-back-btn {
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.calculator-card button,
.calculator-submit-btn,
.calculator-buy-btn {
  width: 100%;
  min-height: 46px;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--pahvaz-orange);
  color: white;
  margin-top: auto;
}

.calculator-card button:hover,
.calculator-submit-btn:hover,
.calculator-buy-btn:hover {
  background: var(--pahvaz-brown);
  transform: translateY(-2px);
}

.calculator-submit-btn:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.calculator-detail-section {
  animation: slideIn 0.3s ease;
}

.calculator-shell {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(127, 21, 27, 0.12);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
}

.calculator-header {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.calculator-heading {
  flex: 1;
  min-width: 0;
}

.calculator-heading h2 {
  color: var(--pahvaz-brown);
  font-size: 1.55rem;
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
}

.calculator-heading p {
  color: var(--gray-700);
  line-height: 1.9;
  margin: 0;
}

.calculator-back-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  background: var(--gray-100);
  color: var(--pahvaz-brown);
  border: 1px solid var(--gray-200);
}

.calculator-back-btn:hover {
  background: var(--gray-100);
  border-color: var(--pahvaz-header-gray);
}

.calculator-access-panel {
  display: grid;
  gap: var(--spacing-lg);
  padding: var(--spacing-xl);
  border: 1px solid var(--pahvaz-header-gray);
  border-radius: 8px;
  background: var(--gray-100);
  direction: ltr;
  text-align: left;
}

.calculator-access-panel p {
  margin: 0;
  color: var(--pahvaz-brown);
  line-height: 1.9;
  font-weight: 700;
}

.calculator-buy-btn {
  max-width: 260px;
  margin-top: 0;
}

.calculator-form {
  display: grid;
  gap: var(--spacing-lg);
  direction: ltr;
  text-align: left;
}

.calculator-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--spacing-lg);
}

.calculator-field {
  display: grid;
  gap: 8px;
  color: var(--gray-700);
  font-weight: 700;
  min-width: 0;
}

.calculator-field span {
  font-size: 0.94rem;
}

.calculator-field input,
.calculator-field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  direction: ltr;
  text-align: left;
  color: var(--gray-900);
  background: #fff;
}

.calculator-field select {
  direction: ltr;
  text-align: left;
}

.calculator-field input:focus,
.calculator-field select:focus {
  outline: 2px solid rgba(148, 147, 147, 0.35);
  border-color: var(--pahvaz-header-gray);
}

.calculator-actions {
  width: min(100%, 260px);
}

.calculator-output-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-xl);
  direction: ltr;
  text-align: left;
}

.calculator-output-panel.has-error {
  display: block;
}

.calculator-output-card {
  min-height: 112px;
  padding: var(--spacing-lg);
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.calculator-output-card span {
  color: var(--gray-700);
  font-size: 0.94rem;
  line-height: 1.5;
}

.calculator-output-card strong {
  color: var(--pahvaz-brown);
  font-size: 1.45rem;
  line-height: 1.25;
  direction: ltr;
  text-align: left;
  overflow-wrap: anywhere;
}

.calculator-status {
  margin: 0;
  color: var(--gray-700);
  background: #f8fafc;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: var(--spacing-lg);
  text-align: center;
}

/* ============================================
   CLIPS SECTION
   ============================================ */

.clips-section {
  animation: slideIn 0.3s ease;
}

#clips-container h2 {
  font-size: clamp(1.3rem, 4.8vw, 1.6rem);
  margin-bottom: var(--spacing-lg);
}

#clips-container > p {
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  color: var(--gray-700);
  margin-bottom: var(--spacing-xl);
}

.course-info {
  background: white;
  padding: var(--spacing-xl);
  border-radius: 0.5rem;
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
}

.course-info h2 {
  font-size: clamp(1.3rem, 4.8vw, 1.6rem);
  margin-bottom: var(--spacing-md);
  color: var(--pahvaz-brown);
}

.course-info p {
  color: var(--gray-700);
  margin-bottom: var(--spacing-md);
  text-align: justify;
  text-justify: auto;
}

.course-meta {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: var(--spacing-lg);
}

.course-meta span {
  margin-right: var(--spacing-lg);
}

.purchased-badge {
  display: inline-block;
  background: var(--pahvaz-brown);
  color: white;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: var(--spacing-lg);
}

.buy-course-btn {
  background: var(--pahvaz-brown);
  color: white;
  padding: var(--spacing-md) var(--spacing-xl);
  border: none;
  border-radius: 0.375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: var(--spacing-lg);
}

.buy-course-btn:hover {
  background: var(--pahvaz-brown-dark);
  transform: translateY(-2px);
}

.login-required {
  background: var(--gray-100);
  border: 1px solid var(--pahvaz-header-gray);
  color: #92400e;
  padding: var(--spacing-lg);
  border-radius: 0.375rem;
  margin-bottom: var(--spacing-lg);
}

.clip-item {
  background: white;
  border-left: 4px solid var(--pahvaz-brown);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border-radius: 0.375rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
}

.clip-item:hover {
  box-shadow: var(--shadow-md);
}

.clip-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--pahvaz-brown);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  font-size: .95rem;
}

.clip-content {
  flex: 1;
}

.clip-item h4 {
  font-size: clamp(1.2rem, 4.2vw, 1.4rem);
  margin-bottom: var(--spacing-sm);
  color: var(--pahvaz-brown);
}

.clip-badge {
  display: inline-block;
  background: var(--pahvaz-header-gray);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: var(--spacing-sm);
}

.clip-duration {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-left: var(--spacing-sm);
}

.clip-description {
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  color: var(--gray-600);
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  
}

.clip-item button {
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--pahvaz-orange);
  color: white;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  margin-top: var(--spacing-md);
  white-space: nowrap;
}

.clip-item button:hover:not(:disabled) {
  background: #d97918;
  transform: translateY(-2px);
}

.clip-item button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--gray-400);
}

/* ============================================
   VIDEO SECTION
   ============================================ */

.video-section {
  background: var(--gray-900);
  border-radius: 0.5rem;
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
}

.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  color: white;
}

.video-title {
  font-size: clamp(1.2rem, 4.2vw, 1.4rem);
  margin: 0;
}

.btn-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  transition: var(--transition);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close:hover {
  opacity: 0.8;
}

.video-container {
  width: 100%;
  background: black;
  border-radius: 0.375rem;
  overflow: hidden;
}

.video-player {
  width: 100%;
  height: auto;
  display: block;
  max-height: 70vh;
}
.course-clip-comments {
  margin-top: var(--spacing-lg);
}

/* ============================================
   LOADERS & SPINNERS
   ============================================ */

.loader {
  border: 4px solid var(--gray-200);
  border-top: 4px solid var(--pahvaz-brown);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.spinner {
  border: 8px solid rgba(255, 255, 255, 0.3);
  border-top: 8px solid white;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--spacing-lg);
  background: var(--success);
  color: white;
  border-radius: 0.375rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: bottom 0.3s ease;
  max-width: 90%;
  word-wrap: break-word;
  text-align: center;
  font-weight: 500;
}

.toast.show {
  bottom: var(--spacing-xl);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* ============================================
   ERROR & STATE STYLES
   ============================================ */

.error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: var(--spacing-lg);
  border-radius: 0.375rem;
  text-align: center;
  margin: var(--spacing-lg) 0;
}

.no-courses {
  background: var(--gray-100);
  padding: var(--spacing-2xl);
  text-align: center;
  color: var(--gray-700);
  border-radius: 0.375rem;
  margin: var(--spacing-lg) 0;
}

/* footer styles from pahvazco.com */
.footer {
  font-family: 'Sahel', sans-serif;
  direction: rtl;
  background-color: #7F151B;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 560px;
  height: auto;
  margin-top: 0;
  padding: 42px 20px 28px;
  gap: 12px;
  font-weight: 100;
  text-align: center;
  overflow: visible;
}

.footer>.logo-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
}

.footer>.logo-footer img {
  width: 88px;
  max-width: 24vw;
  height: auto;
  max-height: 120px;
  border-radius: 10px;
  object-fit: contain;
  display: block;
}

.footer>.brand-name {
  font-weight: 100;
  color: white;
}

.footer>.brand-name h3 {
  margin: 0;
  color: white;
  line-height: 1.7;
}


.footer>.links-wrapper>.nav-link {
  padding: 0;
}

.footer>.links-wrapper>.nav-link a:hover {
    color: #cea135;
}

.footer>.footer-phone-hours>span {
  margin-left: 20px;
}

.footer>.footer-phone-hours>.hours {
  color: #cea135;
}

.footer>.social-media-icons-wrapper {
  width: min(300px, 100%);
  display: flex;
  justify-content: center;
  gap: 28px;
}

.footer>.social-media-icons-wrapper>a {
  color: #cbcbcb;
  transition: 0.5s;
}


.footer>.social-media-icons-wrapper>a:hover {
  color: #cea135;
}

.footer>.trust-seal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 600px;
  margin: 6px auto 4px;
}

.footer>.trust-seal-wrapper p {
  margin: 0;
  color: #f7f0df;
  font-size: 0.95rem;
  line-height: 1.9;
}

.footer>.trust-seal-wrapper a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.footer>.trust-seal-wrapper img {
  display: block;
  width: 96px;
  max-width: 30vw;
  height: auto;
}

.footer>.trust-seal-wrapper .trust-seal-fallback {
  display: inline-block;
  max-width: 320px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: #f7f0df;
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer>.trust-seal-wrapper .trust-seal-fallback[hidden] {
  display: none;
}

.footer>.copyright-wrapper {
  color: #cbcbcb;
  max-width: 1000px;
  line-height: 1.8;
}


.footer>.links-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  max-width: 1100px;
  width: 100%;
  margin: 8px auto;
}

.footer>.links-wrapper>.nav-link {
  text-align: center;
}

.footer>.links-wrapper>.nav-link a {
  display: inline-block;
  text-decoration: none;
  color: white;
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  font-size: 1.05rem;
  padding: 4px 8px;
  border: 1px solid transparent;

}

.footer>.links-wrapper>.nav-link a:hover {
  color: #EB8C23;
  background-color: #dedcdc;
  border-color: #EB8C23;
  border-radius: 4px;
}















/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .footer {
    min-height: auto;
    height: auto;
    padding: 34px 14px 26px;
    gap: 12px;
    font-weight: 100;
  }

  .footer>.links-wrapper {
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 18px;
  }

  .footer>.links-wrapper>.nav-link {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.2em;
    width: 100%;
    padding-left: 0;
  }

 .header {
   position: static;
   padding: 0.75rem 0;
  }

  .header-content {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 0.75rem;
  }

  .logo {
    width: min(100%, 330px);
    justify-content: center;
    flex-direction: row;
    flex-wrap: nowrap;
    white-space: normal;
    text-align: center;
    gap: 0.6rem;
    font-size: clamp(1rem, 5vw, 1.25rem);
    line-height: 1.15;
    min-width: 0;
  }

  .logo img {
    width: min(96px, 30vw);
    max-width: 96px;
    height: auto;
    flex: 0 0 auto;
  }

  .logo span {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .auth-section {
    flex: 0 1 auto;
    min-width: 0;
    width: min(100%, 330px);
  }

  .auth-form {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 0.65rem;
  }

  .auth-inputs {
    flex: none;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    min-width: 0;
    align-content: start;
    grid-auto-rows: min-content;
  }

  .auth-input {
    min-height: 42px;
    padding: 0.62rem 0.85rem;
  }

  .auth-password-row {
    gap: 0.5rem;
  }

  .auth-password-row .language-switch {
    min-height: 42px;
    padding-inline: 12px;
  }

  .auth-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .auth-btn {
    width: 100%;
    justify-content: center;
    min-height: 42px;
    padding: 0.62rem 0.75rem;
    font-size: 0.85rem;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .courses-grid {
    grid-template-columns: 1fr;
  }

  .calculators-grid,
  .calculator-input-grid,
  .calculator-output-panel {
    grid-template-columns: 1fr;
  }

  .calculator-shell {
    padding: var(--spacing-lg);
  }

  .calculator-header {
    flex-direction: column;
  }

  .calculator-actions {
    width: 100%;
  }

  .calculator-buy-btn {
    max-width: 100%;
  }

  .clip-item {
    flex-direction: column;
    align-items: stretch;
  }

  .clip-number {
    width: 100%;
    margin-bottom: var(--spacing-md);
  }

  .video-player {
    max-height: 50vh;
  }

  .toast {
    max-width: 85%;
  }

.navigation-wrapper {
        flex-direction: column;
        height: auto;
    }
    .navigation-wrapper > .left-column {
        order: -1 ;
        margin-top: 10px;
        margin-bottom: 15px;
    }
    .navigation-wrapper > .center-column {
        order: 2;
        margin-top:15px ;
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .navigation-wrapper > .right-column {
        order: 1;
        margin-top:15px ;
    }
    .links-wrapper {
        flex-direction:column;
        margin-bottom: 20px;
    }
    .links-wrapper > .nav-link {
        margin-top: 10px;
        margin-bottom: 10px;
        font-size: 1.2em;
        width: 100%;        
    }

  /* .logo img,
  .logo span {
    display: none !important;


  } */



}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--spacing-sm);
  }

  .header {
    padding: 0.75rem 0;
    position: static;
  }

  .logo {
    flex-direction: row;
    gap: 0.5rem;
    font-size: clamp(1rem, 5vw, 1.18rem);
  }

  .logo img {
    width: min(88px, 30vw);
  }

  .auth-section {
    width: min(100%, 320px);
  }

  .logo-icon {
    font-size: 1.5rem;
  }

  .auth-input {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 42px;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .course-card {
    padding: var(--spacing-lg);
  }

  .calculator-card,
  .calculator-shell {
    padding: var(--spacing-lg);
  }

  .calculator-heading h2 {
    font-size: 1.25rem;
  }

  .calculator-output-card strong {
    font-size: 1.25rem;
  }

  .clip-item {
    padding: var(--spacing-md);
  }

  .video-title {
    font-size: 1.25rem;
  }

  .navigation-wrapper {
        flex-direction: column;
        height: auto;
    }
    .navigation-wrapper > .left-column {
        order: -1 ;
        margin-top: 10px;
        margin-bottom: 15px;
    }
    .navigation-wrapper > .center-column {
        order: 2;
        margin-top:15px ;
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .navigation-wrapper > .right-column {
        order: 1;
        margin-top:15px ;
    }
    .links-wrapper {
        flex-direction:column;
        margin-bottom: 20px;
    }
    .links-wrapper > .nav-link {
        margin-top: 10px;
        margin-bottom: 10px;
        font-size: 1.2em;
        width: 100%;        
    }

  /* .logo span,
  .logo img   
  {
    display: none !important;
} */
}

.teacher-section {
  width: 100%;
  padding: 28px 20px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.teacher-content {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.teacher-photo-wrap {
  width: 170px;
  aspect-ratio: 624 / 812;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
}

.teacher-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.teacher-copy {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.teacher-copy h2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: 0.375rem;
  background: var(--pahvaz-orange);
  color: white;
  font-size: clamp(1.3rem, 4.8vw, 1.6rem);
  line-height: 1.2;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(235, 140, 35, 0.22);
}

.teacher-copy p {
  margin: 0;
  color: var(--text-light);
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  line-height: clamp(1.5em, 4.5vw, 1.75em);
  text-align: justify;
  text-justify: auto;
}

.teacher-resume-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--pahvaz-brown);
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.teacher-resume-link:hover {
  background: var(--pahvaz-brown-dark);
  filter: none;
}

@media (max-width: 640px) {
  .teacher-section {
    padding: 22px 16px;
  }

  .teacher-content {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .teacher-photo-wrap {
    width: min(170px, 48vw);
    justify-self: center;
  }

  .teacher-copy h2 {
    font-size: clamp(1.3rem, 4.8vw, 1.6rem);
  }
}

.course-pdfs {
  margin-top: 20px;
}

.course-pdfs h3 {
  margin: 0 0 12px;
  font-size: clamp(1.2rem, 4.2vw, 1.4rem);
}

.pdf-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--pahvaz-brown);
  color: white;
  text-decoration: none;
  font-weight: 600;
}

.pdf-download:hover {
  background: var(--pahvaz-brown-dark);
  filter: none;
}

/* ============================================
   FREE TRAINING CLIPS
   ============================================ */

.free-clips-section {
  margin-bottom: var(--spacing-2xl);
}

.free-clip-card {
  border: 1px solid rgba(148, 147, 147, 0.56);
  border-top: 0;
  box-shadow: inset 0 0 0 2px rgba(148, 147, 147, 0.16), var(--shadow-md);
}

.free-clip-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  bottom: auto;
  width: auto;
  height: 6px;
  background: var(--pahvaz-header-gray);
}

.free-clip-card::after {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  bottom: 0;
  width: 42%;
  height: 5px;
  background: var(--pahvaz-orange);
  pointer-events: none;
}

.free-clip-card:hover {
  border-color: rgba(148, 147, 147, 0.82);
  box-shadow: inset 0 0 0 2px rgba(148, 147, 147, 0.24), 0 14px 28px rgba(148, 147, 147, 0.16);
}

.free-clip-card .course-price {
  color: var(--pahvaz-brown);
}

.free-clip-card button {
  background: var(--pahvaz-header-gray);
  color: white;
}

.free-clip-card button:hover {
  background: var(--pahvaz-orange);
  color: white;
}

.free-clip-detail-section {
  margin-bottom: var(--spacing-2xl);
  min-width: 0;
}

.free-clip-detail-shell {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  gap: var(--spacing-lg);
  min-width: 0;
}

.free-clip-detail-shell h2 {
  margin: 0;
  color: var(--pahvaz-brown);
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.free-clip-detail-description {
  margin: 0;
  color: var(--gray-700);
  font-size: clamp(1rem, 2.8vw, 1.12rem);
  line-height: 1.85;
  text-align: justify;
  text-justify: auto;
  overflow-wrap: anywhere;
}

.free-clip-video-panel {
  background: #111827;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.free-clip-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #111827;
}

.free-clip-comments {
  background: white;
  border: 1px solid rgba(127, 21, 27, 0.12);
  border-radius: 8px;
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--spacing-md);
}

.free-clip-comments h3 {
  margin: 0;
  color: var(--pahvaz-brown);
  font-size: clamp(1.2rem, 4vw, 1.45rem);
}

.free-clip-comments-list {
  display: grid;
  gap: var(--spacing-md);
}

.free-clip-empty-comments,
.free-clip-comments .login-required {
  margin: 0;
  color: var(--gray-600);
  line-height: 1.8;
}

.free-clip-comment-card {
  border: 1px solid rgba(127, 21, 27, 0.1);
  border-radius: 8px;
  padding: var(--spacing-md);
  background: #fffaf5;
}

.free-clip-comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  color: var(--gray-600);
  font-size: 0.92rem;
  margin-bottom: var(--spacing-sm);
}

.free-clip-comment-meta strong {
  color: var(--pahvaz-brown);
  overflow-wrap: anywhere;
}

.free-clip-comment-card p {
  margin: 0;
  color: var(--gray-800);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.free-clip-comment-form {
  display: grid;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.free-clip-comment-form textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: var(--spacing-md);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.7;
}

.free-clip-comment-form textarea:focus {
  outline: 2px solid var(--pahvaz-header-gray);
  outline-offset: 2px;
  border-color: var(--pahvaz-header-gray);
}

.free-clip-comment-form small {
  color: var(--gray-600);
}

.free-clip-comment-form button {
  justify-self: start;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  background: var(--pahvaz-orange);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.free-clip-comment-form button:disabled {
  opacity: 0.65;
  cursor: wait;
}


/* ============================================
   LIBRARY AND ARTICLES
   ============================================ */

.library-section,
.articles-section,
.article-detail-section {
  margin-bottom: var(--spacing-2xl);
  min-width: 0;
}

.articles-section,
.article-detail-section,
.admin-articles-section {
  direction: ltr;
  text-align: left;
}

.library-shell,
.articles-shell,
.article-detail-shell {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  gap: var(--spacing-lg);
  min-width: 0;
}

.library-page-header,
.articles-topbar,
.article-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.library-page-header .section-title,
.articles-topbar .section-title {
  margin-bottom: 0;
}

.articles-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.library-search-row {
  background: white;
  border: 1px solid rgba(127, 21, 27, 0.12);
  border-radius: 8px;
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
}

.library-search-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 11px 14px;
  background: #fff;
  color: var(--gray-900);
  font: inherit;
  direction: rtl;
  text-align: right;
}

.library-search-input:focus {
  outline: 2px solid rgba(148, 147, 147, 0.35);
  border-color: var(--pahvaz-header-gray);
}

#library-search,
#articles-search {
  direction: ltr;
  text-align: left;
}

.library-grid,
.articles-list,
.my-articles-list {
  display: grid;
  gap: var(--spacing-md);
}

.library-card,
.article-card,
.my-article-card,
.article-upload-panel,
.article-detail-content {
  background: white;
  border: 1px solid rgba(127, 21, 27, 0.12);
  border-top: 4px solid var(--pahvaz-brown);
  border-radius: 8px;
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.library-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  direction: ltr;
  text-align: left;
}

.library-card h3,
.article-card h3,
.my-article-card h3,
.article-detail-content h2 {
  margin: 0;
  color: var(--pahvaz-brown);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.library-card p,
.article-card p,
.my-article-card p,
.article-detail-content p {
  margin: 0;
  color: var(--gray-700);
  line-height: 1.85;
  text-align: left;
  text-justify: auto;
  overflow-wrap: anywhere;
}

.library-card-subtitle {
  color: var(--gray-700);
  direction: ltr;
  font-size: 0.96rem;
  line-height: 1.65;
  text-align: left;
}

.library-card-meta,
.article-card-meta,
.article-detail-meta,
.my-article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px 12px;
  color: var(--gray-600);
  font-size: 0.92rem;
  line-height: 1.8;
}

.library-card-tags,
.article-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.library-card-tags span,
.article-card-tags span,
.my-article-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--pahvaz-brown);
  font-size: 0.82rem;
  font-weight: 700;
}

.library-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px 12px;
  margin-top: auto;
  padding-top: var(--spacing-sm);
}

.library-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 6px;
  background: var(--pahvaz-orange);
  color: white;
  text-decoration: none;
  font-weight: 800;
  line-height: 1.4;
  transition: var(--transition);
}

.library-download-btn:hover,
.library-download-btn:focus {
  background: #d97918;
  color: white;
  outline: none;
  transform: translateY(-1px);
}

.library-file-detail,
.library-file-status {
  color: var(--gray-600);
  font-size: 0.88rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.library-file-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px dashed rgba(127, 21, 27, 0.22);
  color: var(--pahvaz-brown);
  font-weight: 700;
}

.article-submit-toggle,
.article-submit-btn,
.article-read-btn {
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  background: var(--pahvaz-orange);
  color: white;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.article-submit-toggle:hover,
.article-submit-btn:hover,
.article-read-btn:hover {
  background: #d97918;
  transform: translateY(-1px);
}

.article-submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.article-card-actions,
.article-admin-file-row,
.article-document-panel,
.article-document-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px 12px;
  min-width: 0;
}

.article-document-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 6px;
  background: var(--pahvaz-brown);
  color: white;
  text-decoration: none;
  font-weight: 800;
  line-height: 1.4;
  transition: var(--transition);
}

.article-discussion-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid rgba(127, 21, 27, 0.22);
  border-radius: 6px;
  background: #fff;
  color: var(--pahvaz-brown);
  font: inherit;
  font-weight: 800;
  line-height: 1.4;
  cursor: pointer;
  transition: var(--transition);
}

.article-document-link:hover,
.article-document-link:focus {
  background: var(--pahvaz-orange);
  color: white;
  outline: none;
  transform: translateY(-1px);
}

.article-discussion-link:hover,
.article-discussion-link:focus {
  border-color: var(--pahvaz-orange);
  background: rgba(239, 140, 34, 0.08);
  color: var(--pahvaz-brown);
  outline: none;
  transform: translateY(-1px);
}

.article-document-link:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.article-document-preview,
.article-document-panel,
.article-admin-file-row {
  color: var(--gray-700);
  line-height: 1.7;
}

.article-document-preview {
  padding: 10px 12px;
  border: 1px dashed rgba(127, 21, 27, 0.24);
  border-radius: 8px;
  background: #f8fafc;
}

.article-document-preview strong {
  color: var(--pahvaz-brown);
  overflow-wrap: anywhere;
}

.article-file-label input,
#article-document {
  direction: ltr;
  text-align: left;
}

.article-discussion {
  margin-top: var(--spacing-md);
}

.article-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: var(--spacing-lg);
  align-items: start;
}

.article-card-body {
  display: grid;
  gap: var(--spacing-sm);
  min-width: 0;
}

.article-card-cover,
.article-card-preview {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  object-fit: cover;
  background: var(--gray-100);
  border: 1px solid rgba(127, 21, 27, 0.1);
}

.article-card-preview {
  position: relative;
  overflow: hidden;
  background: white;
  box-shadow: inset 0 0 0 1px rgba(127, 21, 27, 0.04);
}

.article-card-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
  pointer-events: none;
}

.article-card-preview-open {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 8px;
  text-indent: -9999px;
  overflow: hidden;
}

.article-card-preview:hover,
.article-card-preview:focus-within {
  border-color: rgba(127, 21, 27, 0.26);
  box-shadow: 0 10px 22px rgba(127, 21, 27, 0.12);
}

.article-card-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  border: 1px solid rgba(127, 21, 27, 0.1);
  background: linear-gradient(135deg, #f8fafc, #f3f4f6);
  color: var(--pahvaz-brown);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.article-form {
  display: grid;
  gap: var(--spacing-md);
}

.article-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-md);
}

.article-form label {
  display: grid;
  gap: 7px;
  color: var(--gray-700);
  font-weight: 700;
  min-width: 0;
}

.article-form input,
.article-form textarea {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 11px 13px;
  font: inherit;
  color: var(--gray-900);
  background: white;
  direction: ltr;
  text-align: left;
}

.article-form input:focus,
.article-form textarea:focus {
  outline: 2px solid rgba(148, 147, 147, 0.35);
  border-color: var(--pahvaz-header-gray);
}

.article-form textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.85;
}

.article-form-hint {
  color: var(--gray-600);
  line-height: 1.8;
}

.article-image-preview,
.article-detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-md);
}

.article-image-preview figure,
.article-detail-images figure {
  margin: 0;
  display: grid;
  gap: 6px;
}

.article-image-preview img,
.article-detail-images img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(127, 21, 27, 0.12);
  background: var(--gray-100);
}

.article-image-preview figcaption,
.article-detail-images figcaption {
  color: var(--gray-600);
  font-size: 0.86rem;
  line-height: 1.6;
}

.article-detail-content {
  display: grid;
  gap: var(--spacing-md);
}

.article-detail-body {
  white-space: pre-wrap;
}

.my-articles-list {
  margin-top: var(--spacing-md);
}

.my-article-card {
  border-top-color: var(--pahvaz-header-gray);
}

.my-article-status.is-visible {
  background: #dcfce7;
  color: #166534;
}

.my-article-status.is-hidden {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 720px) {
  .article-card,
  .article-form-grid {
    grid-template-columns: 1fr;
  }

  .article-card-cover,
  .article-card-preview,
  .article-card-placeholder {
    max-width: 280px;
    justify-self: center;
  }
}
/* ============================================
   ADMIN COMMENT MODERATION
   ============================================ */

.admin-comments-btn {
  gap: 8px;
}

.admin-comments-section {
  margin-bottom: var(--spacing-2xl);
}

.admin-comments-shell {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  gap: var(--spacing-lg);
}

.admin-comments-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.admin-comments-topbar h2 {
  margin: 0;
  color: var(--pahvaz-brown);
  font-size: clamp(1.45rem, 4.5vw, 2rem);
  line-height: 1.4;
}

.admin-comments-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.admin-comments-filters button,
.admin-comment-actions button {
  border: 1px solid rgba(127, 21, 27, 0.18);
  border-radius: 8px;
  padding: 10px 14px;
  background: white;
  color: var(--pahvaz-brown);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.admin-comments-filters button:hover,
.admin-comments-filters button.is-active {
  background: var(--pahvaz-brown);
  color: white;
}

.admin-comments-list {
  display: grid;
  gap: var(--spacing-md);
}

.admin-comments-empty {
  background: white;
  border: 1px solid rgba(127, 21, 27, 0.12);
  border-radius: 8px;
  padding: var(--spacing-xl);
  color: var(--gray-700);
  line-height: 1.8;
  box-shadow: var(--shadow-sm);
}

.admin-comment-card {
  background: white;
  border: 1px solid rgba(127, 21, 27, 0.12);
  border-radius: 8px;
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--spacing-sm);
}

.admin-comment-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.admin-comment-card-header h3 {
  margin: 0;
  color: var(--pahvaz-brown);
  font-size: clamp(1.08rem, 3.4vw, 1.25rem);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.admin-comment-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--gray-100);
  color: #92400e;
}

.admin-comment-status.is-visible {
  background: #dcfce7;
  color: #166534;
}

.admin-comment-status.is-hidden {
  background: #fee2e2;
  color: #991b1b;
}

.admin-comment-meta {
  color: var(--gray-600);
  font-size: 0.92rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.admin-comment-body {
  margin: 0;
  color: var(--gray-800);
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.admin-comment-actions .admin-approve-btn {
  background: #166534;
  border-color: #166534;
  color: white;
}

.admin-comment-actions .admin-hide-btn {
  background: #991b1b;
  border-color: #991b1b;
  color: white;
}

.admin-comment-actions .admin-pending-btn {
  background: var(--gray-100);
  border-color: var(--pahvaz-header-gray);
  color: #92400e;
}

.admin-comment-actions button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .admin-comments-topbar,
  .admin-comment-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-comments-filters button,
  .admin-comment-actions button {
    flex: 1 1 140px;
  }
}
