/**
 * سِفر قيس Platform - Enhanced Scholarly Article Creation Excellence
 * Phase 2: Sophisticated Manuscript Aesthetic Implementation
 * 
 * A visually magnificent stylesheet inspired by Islamic manuscript illumination
 * and classical Arabic book design, creating a sacred space for knowledge creation.
 * 
 * Enhanced with sophisticated animations, deeper aesthetic elements,
 * and refined integration with the platform design system.
 * 
 * "قُلْ هَاتُوا بُرْهَانَكُمْ إِن كُنتُمْ صَادِقِينَ"
 * (Say: Bring your proof if you are truthful) - Al-Baqarah 2:111
 */

/* ===== ENHANCED MANUSCRIPT COLOR EXTENSIONS ===== */
:root {
  /* Sophisticated manuscript color palette */
  --manuscript-gold-primary: #D4A574;
  --manuscript-gold-secondary: #C9A961;
  --manuscript-gold-light: #E5CFA2;
  --manuscript-gold-dark: #B8925A;
  
  --manuscript-blue-primary: #1B4A72;
  --manuscript-blue-secondary: #2C5282;
  --manuscript-blue-light: #3A6BA8;
  --manuscript-blue-dark: #13354F;
  
  --manuscript-red-primary: #8B2C2C;
  --manuscript-red-secondary: #A44A4A;
  --manuscript-red-light: #B76565;
  --manuscript-red-dark: #6D2323;
  
  --manuscript-green-primary: #2A5530;
  --manuscript-green-secondary: #276749;
  --manuscript-green-light: #4A8B6D;
  --manuscript-green-dark: #1D4A34;
  
  /* Sacred geometry colors */
  --sacred-copper: #B87333;
  --sacred-silver: #C0C0C0;
  --sacred-bronze: #CD7F32;
  --sacred-platinum: #E5E4E2;
  
  /* Illumination gradients - Enhanced */
  --illumination-primary: linear-gradient(135deg, var(--manuscript-gold-primary) 0%, var(--manuscript-gold-secondary) 50%, var(--sacred-copper) 100%);
  --illumination-secondary: linear-gradient(45deg, var(--manuscript-blue-primary) 0%, var(--manuscript-blue-secondary) 100%);
  --illumination-tertiary: linear-gradient(225deg, var(--manuscript-red-primary) 0%, var(--manuscript-red-secondary) 100%);
  --illumination-quaternary: linear-gradient(315deg, var(--manuscript-green-primary) 0%, var(--manuscript-green-secondary) 100%);
  
  /* Sophisticated parchment gradients */
  --parchment-primary: radial-gradient(ellipse at center, #FDFCFA 0%, #F8F5F1 50%, var(--background-color, #F8F5F1) 100%);
  --parchment-secondary: linear-gradient(135deg, #FBF8F1 0%, #F4F1E8 50%, #F0EBE3 100%);
  --parchment-aged: radial-gradient(circle at 30% 20%, #F9F6F0 0%, #F4F0E6 40%, #EFEADD 100%);
  
  /* Enhanced glow effects */
  --illumination-glow-soft: 0 0 20px rgba(212, 165, 116, 0.15);
  --illumination-glow-medium: 0 0 30px rgba(212, 165, 116, 0.25);
  --illumination-glow-strong: 0 0 40px rgba(212, 165, 116, 0.35);
  --illumination-glow-divine: 0 0 60px rgba(212, 165, 116, 0.4);
  
  /* Manuscript shadows with warm undertones */
  --manuscript-shadow-soft: 0 4px 20px rgba(138, 90, 68, 0.08);
  --manuscript-shadow-medium: 0 8px 32px rgba(138, 90, 68, 0.12);
  --manuscript-shadow-strong: 0 12px 48px rgba(138, 90, 68, 0.16);
  --manuscript-shadow-dramatic: 0 20px 64px rgba(138, 90, 68, 0.2);
  
  /* Sacred geometry patterns */
  --geometric-pattern-primary: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23D4A574' fill-opacity='0.05'%3E%3Cpath d='M30 30L0 60h60z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  --geometric-pattern-secondary: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23C9A961' fill-opacity='0.03'%3E%3Cpath d='M20 20L0 0h40z'/%3E%3C/g%3E%3C/svg%3E");
  
  /* Typography enhancements */
  --calligraphy-weight: 500;
  --manuscript-letter-spacing: 0.02em;
  --poetry-line-height: 2.4;
  --quranic-line-height: 2.6;
}

/* ===== ENHANCED SACRED CREATION SPACE ===== */
.scholarly-creation-container {
  background: var(--parchment-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  /* Enhanced backdrop with sacred geometry */
  background-image: var(--geometric-pattern-primary);
  background-attachment: fixed;
  background-size: 120px 120px;
}

.scholarly-creation-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 300px;
  background: var(--illumination-primary);
  opacity: 0.08;
  pointer-events: none;
  background-image: var(--geometric-pattern-secondary);
  background-size: 80px 80px;
  animation: subtleFlow 20s ease-in-out infinite;
}

.scholarly-creation-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: var(--illumination-secondary);
  opacity: 0.04;
  pointer-events: none;
  transform: rotate(180deg);
}

/* ===== SOPHISTICATED ILLUMINATED HEADER ===== */
.creation-header {
  background: linear-gradient(to bottom, 
              var(--card-background-high, rgba(255,255,255,0.98)) 0%, 
              var(--card-background-medium, rgba(255,255,255,0.95)) 50%,
              var(--alt-background-high, rgba(248,245,241,0.98)) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--manuscript-shadow-medium);
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}

.creation-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--illumination-primary);
  opacity: 0.6;
}

.creation-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: var(--illumination-primary);
  border-radius: var(--radius-full, 9999px);
  box-shadow: var(--illumination-glow-soft);
}

.header-content {
  padding: var(--space-8) 0;
  text-align: center;
  position: relative;
  z-index: 2;
}

/* ===== ENHANCED CREATION TITLE ===== */
.creation-title {
  font-family: var(--font-display, 'Scheherazade New', serif);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  color: var(--manuscript-blue-primary);
  margin-bottom: var(--space-4);
  position: relative;
  display: inline-block;
  font-weight: var(--font-bold, 700);
  line-height: 1.2;
  letter-spacing: var(--manuscript-letter-spacing);
  text-shadow: 0 2px 8px rgba(27, 74, 114, 0.1);
  transition: all var(--duration-slow, 500ms) var(--ease-manuscript, ease);
}

.creation-title .highlight {
  color: var(--manuscript-gold-primary);
  font-weight: var(--font-extrabold, 800);
  position: relative;
  display: inline-block;
  animation: gentleGlow 4s ease-in-out infinite;
}

.creation-title .highlight::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -4px;
  right: -4px;
  bottom: -2px;
  background: var(--illumination-primary);
  opacity: 0.1;
  border-radius: var(--radius-base, 0.25rem);
  z-index: -1;
  transition: opacity var(--duration-base, 300ms) ease;
}

.creation-title:hover .highlight::before {
  opacity: 0.2;
}

/* Enhanced decorative elements with Islamic geometric patterns */
.creation-title::before,
.creation-title::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23D4A574'%3E%3Cpath d='M20 4L24 16L36 20L24 24L20 36L16 24L4 20L16 16z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.6;
  transition: all var(--duration-base, 300ms) ease;
  animation: ornamentalFloat 6s ease-in-out infinite;
}

.creation-title::before {
  right: -60px;
  animation-delay: 0s;
}

.creation-title::after {
  left: -60px;
  animation-delay: 3s;
}

.creation-title:hover::before,
.creation-title:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* ===== ENHANCED QURANIC GUIDANCE ===== */
.scholarly-context {
  margin-top: var(--space-6);
  animation: gracefulReveal 1.2s ease-out;
}

.quranic-guidance {
  background: var(--parchment-secondary);
  border: 2px solid var(--manuscript-gold-light);
  border-radius: var(--radius-xl, 0.75rem);
  padding: var(--space-6) var(--space-8);
  display: inline-block;
  position: relative;
  box-shadow: var(--illumination-glow-medium);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--duration-slow, 500ms) var(--ease-manuscript, ease);
  max-width: 600px;
}

.quranic-guidance::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: var(--illumination-primary);
  border-radius: inherit;
  z-index: -1;
  opacity: 0.8;
  transition: opacity var(--duration-base, 300ms) ease;
}

.quranic-guidance:hover {
  transform: translateY(-2px);
  box-shadow: var(--illumination-glow-strong);
}

.quranic-guidance:hover::before {
  opacity: 1;
}

/* Enhanced decorative corners for Quranic guidance */
.quranic-guidance::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='none' stroke='%23D4A574' stroke-width='1.5'%3E%3Cpath d='M2 2L18 18M18 2L2 18'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0.4;
}

.verse-text {
  font-family: var(--font-display, 'Scheherazade New', serif);
  font-size: clamp(var(--text-lg), 3vw, var(--text-2xl));
  color: var(--manuscript-blue-primary);
  display: block;
  margin-bottom: var(--space-3);
  line-height: var(--quranic-line-height, 2.6);
  text-align: center;
  font-weight: var(--calligraphy-weight, 500);
  letter-spacing: var(--manuscript-letter-spacing);
  word-spacing: 0.1em;
  position: relative;
  z-index: 2;
}

.verse-reference {
  font-size: var(--text-sm);
  color: var(--manuscript-gold-dark);
  font-style: italic;
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
  font-weight: var(--font-medium, 500);
  position: relative;
  z-index: 2;
}

/* ===== SOPHISTICATED PROGRESS JOURNEY ===== */
.creation-progress {
  padding: var(--space-8) 0;
  background: linear-gradient(135deg, 
              var(--card-background-light, rgba(255, 255, 255, 0.7)) 0%, 
              var(--alt-background-medium, rgba(248, 245, 241, 0.8)) 50%,
              var(--card-background-light, rgba(255, 255, 255, 0.7)) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin: 0 calc(-1 * var(--space-6));
  margin-bottom: var(--space-8);
  border-top: 1px solid rgba(212, 165, 116, 0.2);
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
  position: relative;
}

.creation-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--geometric-pattern-secondary);
  background-size: 60px 60px;
  opacity: 0.03;
  pointer-events: none;
}

.progress-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(var(--space-6), 8vw, var(--space-12));
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  z-index: 2;
}

/* Enhanced progress connection line */
.progress-steps::before {
  content: '';
  position: absolute;
  top: 32px;
  right: 15%;
  left: 15%;
  height: 3px;
  background: linear-gradient(90deg, 
              var(--border-color, #e0e0e0) 0%,
              var(--manuscript-gold-light) 50%,
              var(--border-color, #e0e0e0) 100%);
  z-index: 0;
  border-radius: var(--radius-full, 9999px);
  box-shadow: 0 1px 3px rgba(212, 165, 116, 0.2);
}

.step {
  position: relative;
  z-index: 1;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  padding: var(--space-2);
  border-radius: var(--radius-lg, 0.5rem);
}

.step:hover {
  transform: translateY(-2px);
}

.step-number {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--card-background, white);
  border: 3px solid var(--border-color, #e0e0e0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display, 'Scheherazade New', serif);
  font-size: var(--text-2xl);
  color: var(--text-muted, #718096);
  margin: 0 auto var(--space-3);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
  position: relative;
  overflow: hidden;
  font-weight: var(--font-bold, 700);
}

.step-number::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: var(--illumination-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all var(--duration-slow, 500ms) var(--ease-manuscript, ease);
  z-index: -1;
}

.step-label {
  font-size: var(--text-base);
  color: var(--text-muted, #718096);
  font-weight: var(--font-medium, 500);
  white-space: nowrap;
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  font-family: var(--font-heading, 'Cairo', sans-serif);
}

/* Enhanced active step styling */
.step.active .step-number {
  background: var(--illumination-primary);
  border-color: var(--manuscript-gold-primary);
  color: var(--button-text-light, white);
  transform: scale(1.1);
  box-shadow: var(--illumination-glow-medium);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.step.active .step-number::before {
  width: 120%;
  height: 120%;
}

.step.active .step-label {
  color: var(--manuscript-blue-primary);
  font-weight: var(--font-bold, 700);
  transform: translateY(-2px);
}

/* Enhanced completed step styling */
.step.completed .step-number {
  background: var(--illumination-quaternary);
  border-color: var(--manuscript-green-primary);
  color: var(--button-text-light, white);
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1));
}

.step.completed .step-number::after {
  content: '✓';
  font-size: var(--text-xl);
  font-weight: var(--font-bold, 700);
}

.step.completed .step-label {
  color: var(--manuscript-green-primary);
  font-weight: var(--font-semibold, 600);
}

/* Enhanced hover effects with manuscript aesthetics */
.step:hover:not(.active) .step-number {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-lg, 0 10px 15px rgba(0,0,0,0.1));
  border-color: var(--accent-color, var(--manuscript-gold-primary));
  background: var(--parchment-secondary);
}

.step:hover:not(.active) .step-label {
  color: var(--accent-color, var(--manuscript-gold-primary));
  transform: translateY(-1px);
}

/* ===== ENHANCED FORM STEPS ===== */
.enhanced-article-form {
  max-width: 1400px;
  margin: 0 auto;
  background: var(--parchment-primary);
  border-radius: var(--radius-2xl, 1rem);
  box-shadow: var(--manuscript-shadow-medium);
  overflow: hidden;
  position: relative;
}

.enhanced-article-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--geometric-pattern-primary);
  background-size: 100px 100px;
  opacity: 0.02;
  pointer-events: none;
}

.form-step {
  display: none;
  animation: elegantFadeIn 0.8s var(--ease-manuscript, ease);
  position: relative;
  z-index: 2;
}

.form-step.active {
  display: block;
}

.step-header {
  text-align: center;
  margin-bottom: var(--space-10);
  position: relative;
  padding-bottom: var(--space-6);
}

.step-header::before {
  content: '';
  position: absolute;
  top: -var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 2px;
  background: var(--illumination-primary);
  border-radius: var(--radius-full, 9999px);
}

.step-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: var(--illumination-primary);
  border-radius: var(--radius-full, 9999px);
  box-shadow: var(--illumination-glow-soft);
}

.step-header h2 {
  font-family: var(--font-display, 'Scheherazade New', serif);
  color: var(--manuscript-blue-primary);
  margin-bottom: var(--space-3);
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  font-weight: var(--font-bold, 700);
  letter-spacing: var(--manuscript-letter-spacing);
  position: relative;
  display: inline-block;
}

.step-header h2 i {
  color: var(--manuscript-gold-primary);
  margin-left: var(--space-3);
  font-size: 0.9em;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(212, 165, 116, 0.3));
}

.step-header p {
  color: var(--text-muted, #718096);
  font-size: var(--text-lg);
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
  font-weight: var(--font-medium, 500);
  max-width: 600px;
  margin: 0 auto;
  line-height: var(--leading-relaxed, 1.625);
}

/* ===== ENHANCED MAIN CONTENT AREA ===== */
.main-content-area {
  background: linear-gradient(135deg, 
              var(--card-background, white) 0%, 
              rgba(253, 252, 250, 0.8) 50%,
              var(--card-background, white) 100%);
  border-radius: var(--radius-2xl, 1rem);
  box-shadow: var(--manuscript-shadow-strong);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
  position: relative;
  border: 1px solid rgba(212, 165, 116, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.main-content-area::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 6px;
  background: var(--illumination-primary);
  border-radius: var(--radius-2xl, 1rem) var(--radius-2xl, 1rem) 0 0;
  opacity: 0.8;
}

.main-content-area::after {
  content: '';
  position: absolute;
  top: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%23D4A574' stroke-width='1' opacity='0.3'%3E%3Ccircle cx='30' cy='30' r='25'/%3E%3Cpath d='M30 5L35 25L55 30L35 35L30 55L25 35L5 30L25 25z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.6;
  animation: gentleRotate 20s linear infinite;
  z-index: 10;
  pointer-events: none;
}

/* ===== ENHANCED FORM FIELDS ===== */
.form-group {
  margin-bottom: var(--space-6);
  position: relative;
}

.form-group label {
  font-weight: var(--font-semibold, 600);
  color: var(--manuscript-blue-primary);
  margin-bottom: var(--space-3);
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  font-family: var(--font-heading, 'Cairo', sans-serif);
  transition: color var(--duration-base, 300ms) ease;
}

.form-group label.required::after {
  content: '*';
  color: var(--manuscript-red-primary);
  margin-right: var(--space-2);
  font-size: 1.2em;
  animation: gentlePulse 2s ease-in-out infinite;
}

.form-group:focus-within label {
  color: var(--manuscript-gold-primary);
  transform: translateX(-2px);
}

.large-input {
  font-size: var(--text-xl);
  padding: var(--space-5);
  font-family: var(--font-heading, 'Cairo', sans-serif);
  font-weight: var(--font-medium, 500);
  background: var(--parchment-secondary);
  border: 2px solid var(--manuscript-gold-light);
  border-radius: var(--radius-lg, 0.5rem);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  position: relative;
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
}

/* Light mode explicit styling */
body:not(.dark-mode) .large-input,
body.light-mode .large-input,
.large-input {
  background: var(--parchment-secondary);
  color: var(--text-color, #2D3748);
}

body:not(.dark-mode) .large-input:focus,
body.light-mode .large-input:focus,
.large-input:focus {
  border-color: var(--manuscript-gold-primary);
  box-shadow: var(--illumination-glow-soft);
  background: var(--card-background, white) !important;
  color: var(--text-color, #2D3748) !important;
  transform: translateY(-1px);
}

/* ===== SOPHISTICATED SEFREDITOR INTEGRATION ===== */
.sefr-editor-wrapper {
  border: 3px solid var(--manuscript-gold-light);
  border-radius: var(--radius-xl, 0.75rem);
  overflow: hidden;
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  background: var(--card-background, white);
  position: relative;
  box-shadow: var(--manuscript-shadow-medium);
}

.sefr-editor-wrapper::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  height: 8px;
  background: var(--illumination-primary);
  border-radius: var(--radius-xl, 0.75rem) var(--radius-xl, 0.75rem) 0 0;
  z-index: 1;
  opacity: 0.9;
}

.sefr-editor-wrapper:focus-within {
  border-color: var(--manuscript-gold-primary);
  box-shadow: var(--illumination-glow-medium);
  transform: translateY(-2px);
}

.sefr-editor-wrapper:focus-within::before {
  opacity: 1;
  background: var(--illumination-primary);
}

.sefr-editor-wrapper .sefr-editor-container {
  border: none;
  box-shadow: none;
  margin-bottom: 0;
  background: transparent;
}

/* Enhanced editor footer with manuscript aesthetics */
.editor-footer {
  background: var(--parchment-secondary);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--manuscript-gold-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.editor-stats {
  display: flex;
  gap: var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-muted, #718096);
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
}

.editor-stats span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--card-background, white);
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--manuscript-gold-light);
  transition: all var(--duration-base, 300ms) ease;
}

.editor-stats span:hover {
  background: var(--manuscript-gold-light);
  color: var(--manuscript-blue-primary);
  transform: translateY(-1px);
}

.editor-stats i {
  color: var(--manuscript-gold-primary);
  font-size: 1.1em;
}

.editor-actions {
  display: flex;
  gap: var(--space-2);
}

.editor-actions .btn {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
  min-height: 40px;
  border-radius: var(--radius-lg, 0.5rem);
  background: var(--card-background, white);
  border: 2px solid var(--manuscript-gold-light);
  color: var(--manuscript-blue-primary);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
}

.editor-actions .btn:hover {
  background: var(--manuscript-gold-primary);
  color: var(--button-text-light, white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1));
}

/* ===== ENHANCED SOURCES SECTION ===== */
.sources-container {
  background: var(--parchment-aged);
  border-radius: var(--radius-xl, 0.75rem);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  border: 2px solid var(--manuscript-gold-light);
  position: relative;
  box-shadow: var(--manuscript-shadow-soft);
}

.sources-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--illumination-secondary);
  border-radius: var(--radius-xl, 0.75rem) var(--radius-xl, 0.75rem) 0 0;
}

.sources-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--manuscript-gold-light);
}

.sources-header h3 {
  font-family: var(--font-display, 'Scheherazade New', serif);
  color: var(--manuscript-blue-primary);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold, 700);
  margin: 0;
}

.source-item {
  background: var(--card-background, white);
  border: 2px solid var(--manuscript-gold-light);
  border-radius: var(--radius-lg, 0.5rem);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  position: relative;
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
}

.source-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--illumination-tertiary);
  border-radius: var(--radius-lg, 0.5rem) 0 0 var(--radius-lg, 0.5rem);
}

.source-item:hover {
  box-shadow: var(--manuscript-shadow-medium);
  border-color: var(--manuscript-gold-primary);
  transform: translateY(-2px);
}

.source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--manuscript-gold-light);
}

.source-number {
  color: var(--manuscript-gold-primary);
  font-weight: var(--font-bold, 700);
  font-family: var(--font-display, 'Scheherazade New', serif);
  font-size: var(--text-lg);
}

/* Light Mode Source Form Explicit Styling - Prevents Dark Mode Cascade Bleeding */
body:not(.dark-mode) .source-item {
  background: var(--card-background, #ffffff) !important;
  border-color: var(--manuscript-gold-light, #E5CFA2) !important;
  color: var(--text-color, #1A202C) !important;
}

body:not(.dark-mode) .source-header {
  background: transparent !important;
  color: var(--text-color, #1A202C) !important;
  border-bottom-color: var(--manuscript-gold-light, #E5CFA2) !important;
}

body:not(.dark-mode) .source-number {
  color: var(--manuscript-gold-primary, #D4A574) !important;
}

.btn-remove-source {
  background: transparent;
  border: 2px solid var(--manuscript-red-light);
  color: var(--manuscript-red-primary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-base, 300ms) ease;
}

.btn-remove-source:hover {
  background: var(--manuscript-red-primary);
  color: var(--button-text-light, white);
  transform: scale(1.1);
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1));
}

/* ===== TEXT SELECTION LIGHT MODE STYLING ===== */

/* Global Text Selection - Light Mode */
body:not(.dark-mode) ::selection {
  background: rgba(212, 165, 116, 0.25); /* Gold background with transparency */
  color: var(--text-color, #1A202C); /* Dark text for visibility */
}

body:not(.dark-mode) ::-moz-selection {
  background: rgba(212, 165, 116, 0.25);
  color: var(--text-color, #1A202C);
}

/* Input Field Text Selection - Light Mode */
body:not(.dark-mode) input::selection,
body:not(.dark-mode) textarea::selection,
body:not(.dark-mode) .form-control::selection {
  background: rgba(201, 169, 97, 0.3); /* Manuscript gold for form inputs */
  color: var(--text-color, #1A202C);
}

body:not(.dark-mode) input::-moz-selection,
body:not(.dark-mode) textarea::-moz-selection,
body:not(.dark-mode) .form-control::-moz-selection {
  background: rgba(201, 169, 97, 0.3);
  color: var(--text-color, #1A202C);
}

/* Source Form Input Selection - Light Mode */
body:not(.dark-mode) .source-item input::selection,
body:not(.dark-mode) .source-item textarea::selection {
  background: rgba(212, 165, 116, 0.4); /* Enhanced gold for source inputs */
  color: var(--text-color, #1A202C);
}

body:not(.dark-mode) .source-item input::-moz-selection,
body:not(.dark-mode) .source-item textarea::-moz-selection {
  background: rgba(212, 165, 116, 0.4);
  color: var(--text-color, #1A202C);
}

/* ===== INPUT FOCUS STATES LIGHT MODE ===== */

/* Source Form Input Focus - Light Mode Enhanced Visibility */
body:not(.dark-mode) .source-item input[type="text"]:focus,
body:not(.dark-mode) .source-item input[type="email"]:focus,
body:not(.dark-mode) .source-item input[type="url"]:focus,
body:not(.dark-mode) .source-item textarea:focus,
body:not(.dark-mode) .source-item select:focus {
  background-color: #ffffff !important;
  color: var(--text-color, #1A202C) !important;
  border-color: var(--manuscript-gold-primary, #D4A574) !important;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2) !important;
}

/* ===== KEYWORDS AND TAG SUGGESTIONS LIGHT MODE FIX ===== */

/* Keywords Input Field - Light Mode Enhanced Visibility */
body:not(.dark-mode) #tags {
  background-color: #ffffff !important;
  color: var(--text-color, #1A202C) !important;
  border-color: var(--border-color, #e2e8f0) !important;
}

body:not(.dark-mode) #tags:focus {
  background-color: #ffffff !important;
  color: var(--text-color, #1A202C) !important;
  border-color: var(--manuscript-gold-primary, #D4A574) !important;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2) !important;
}

body:not(.dark-mode) #tags::placeholder {
  color: var(--text-muted, #6c757d) !important;
}

/* Tag Suggestions Container - Light Mode */
body:not(.dark-mode) .tag-suggestions {
  background: #ffffff;
  border-color: var(--border-color, #e2e8f0);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Tag Suggestion Items - Light Mode Enhanced Visibility */
body:not(.dark-mode) .tag-suggestion {
  background: var(--alt-background, #f8f9fa) !important;
  border-color: var(--border-color, #e2e8f0) !important;
  color: var(--text-color, #1A202C) !important;
}

body:not(.dark-mode) .tag-suggestion:hover {
  background: var(--manuscript-gold-light, #E5CFA2) !important;
  color: var(--text-color, #1A202C) !important;
  border-color: var(--manuscript-gold-primary, #D4A574) !important;
}

body:not(.dark-mode) .tag-suggestion:focus {
  background: var(--manuscript-gold-light, #E5CFA2) !important;
  color: var(--text-color, #1A202C) !important;
  border-color: var(--manuscript-gold-primary, #D4A574) !important;
  outline: 3px solid rgba(212, 165, 116, 0.3) !important;
  outline-offset: 2px !important;
}

body:not(.dark-mode) .tag-suggestion.used,
body:not(.dark-mode) .tag-suggestion.applied {
  background: var(--manuscript-gold-primary, #D4A574) !important;
  color: #ffffff !important;
  border-color: var(--manuscript-gold-dark, #B8925A) !important;
}

/* Suggestions Label - Light Mode */
body:not(.dark-mode) .suggestions-label {
  color: var(--text-muted, #6c757d) !important;
}

/* Keywords Input Text Selection - Light Mode */
body:not(.dark-mode) #tags::selection {
  background: rgba(212, 165, 116, 0.3);
  color: var(--text-color, #1A202C);
}

body:not(.dark-mode) #tags::-moz-selection {
  background: rgba(212, 165, 116, 0.3);
  color: var(--text-color, #1A202C);
}

/* ===== ENHANCED CLASSIFICATION SECTION ===== */
.classification-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.classification-card {
  background: var(--parchment-secondary);
  border: 2px solid var(--manuscript-gold-light);
  border-radius: var(--radius-xl, 0.75rem);
  padding: var(--space-6);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--manuscript-shadow-soft);
}

.classification-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--illumination-primary);
  transform: translateX(-100%);
  transition: transform var(--duration-slow, 500ms) var(--ease-manuscript, ease);
}

.classification-card:hover {
  border-color: var(--manuscript-gold-primary);
  transform: translateY(-3px);
  box-shadow: var(--manuscript-shadow-medium);
}

.classification-card:hover::before {
  transform: translateX(0);
}

.classification-card.selected {
  background: linear-gradient(135deg, 
              rgba(212, 165, 116, 0.1) 0%, 
              rgba(201, 169, 97, 0.15) 100%);
  border-color: var(--manuscript-gold-primary);
  box-shadow: var(--illumination-glow-medium);
}

.classification-card.selected::before {
  transform: translateX(0);
  background: var(--illumination-primary);
}

/* ===== ENHANCED REVIEW SECTION ===== */
.review-section {
  background: var(--parchment-primary);
  border-radius: var(--radius-xl, 0.75rem);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  border: 2px solid var(--manuscript-gold-light);
  position: relative;
  box-shadow: var(--manuscript-shadow-medium);
}

.review-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--illumination-quaternary);
  border-radius: var(--radius-xl, 0.75rem) var(--radius-xl, 0.75rem) 0 0;
}

.review-preview {
  background: var(--card-background, white);
  border: 1px solid var(--manuscript-gold-light);
  border-radius: var(--radius-lg, 0.5rem);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
  line-height: var(--leading-relaxed, 1.625);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
  position: relative;
}

.review-preview::before {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cg fill='%23D4A574' opacity='0.4'%3E%3Cpath d='M15 3L18 12L27 15L18 18L15 27L12 18L3 15L12 12z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.scholarly-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.scholarly-checklist li {
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  background: var(--card-background, white);
  border-radius: var(--radius-lg, 0.5rem);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  border: 2px solid var(--manuscript-gold-light);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
}

.scholarly-checklist li:hover {
  transform: translateX(-3px);
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1));
}

.scholarly-checklist li.completed {
  background: linear-gradient(135deg, 
              rgba(138, 90, 68, 0.1) 0%, 
              rgba(39, 103, 73, 0.15) 100%);
  color: var(--manuscript-green-primary);
  border-color: var(--manuscript-green-primary);
}

.scholarly-checklist li i {
  font-size: var(--text-xl);
  color: var(--manuscript-gold-primary);
  width: 24px;
  text-align: center;
}

.scholarly-checklist li.completed i {
  color: var(--manuscript-green-primary);
}

/* ===== ENHANCED SIDEBAR WIDGETS ===== */
.sidebar-column {
  position: sticky;
  top: 120px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--manuscript-gold-light) transparent;
}

.sidebar-column::-webkit-scrollbar {
  width: 6px;
}

.sidebar-column::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-column::-webkit-scrollbar-thumb {
  background: var(--manuscript-gold-light);
  border-radius: var(--radius-full, 9999px);
}

.sidebar-widget {
  background: var(--card-background, white);
  border: 2px solid var(--manuscript-gold-light);
  box-shadow: var(--manuscript-shadow-medium);
  margin-bottom: var(--space-6);
  border-radius: var(--radius-xl, 0.75rem);
  overflow: hidden;
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  position: relative;
}

.sidebar-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--illumination-primary);
  opacity: 0.8;
}

.sidebar-widget:hover {
  transform: translateY(-2px);
  box-shadow: var(--manuscript-shadow-strong);
  border-color: var(--manuscript-gold-primary);
}

.sidebar-widget h3 {
  background: var(--parchment-secondary);
  padding: var(--space-4) var(--space-5);
  margin: 0;
  border-bottom: 1px solid var(--manuscript-gold-light);
  color: var(--manuscript-blue-primary);
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display, 'Scheherazade New', serif);
  font-weight: var(--font-bold, 700);
}

.sidebar-widget h3 i {
  color: var(--manuscript-gold-primary);
  font-size: 1.2em;
}

.tips-list {
  padding: var(--space-5);
  margin: 0;
  list-style: none;
}

.tips-list li {
  padding-right: var(--space-8);
  margin-bottom: var(--space-4);
  position: relative;
  color: var(--text-color, #1a202c);
  line-height: var(--leading-relaxed, 1.625);
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
  font-weight: var(--font-medium, 500);
  transition: color var(--duration-base, 300ms) ease;
}

.tips-list li::before {
  content: '◈';
  position: absolute;
  right: 0;
  top: 0;
  color: var(--manuscript-gold-primary);
  font-size: var(--text-xl);
  font-family: var(--font-display, 'Scheherazade New', serif);
  animation: gentlePulse 3s ease-in-out infinite;
}

.tips-list li:hover {
  color: var(--manuscript-blue-primary);
  transform: translateX(-2px);
}

/* ===== SOPHISTICATED FORM NAVIGATION ===== */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6);
  background: var(--parchment-primary);
  border-radius: var(--radius-xl, 0.75rem);
  box-shadow: var(--manuscript-shadow-strong);
  position: sticky;
  bottom: var(--space-6);
  z-index: 10;
  margin-top: var(--space-8);
  border: 2px solid var(--manuscript-gold-light);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.form-navigation::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--illumination-primary);
  border-radius: var(--radius-xl, 0.75rem) var(--radius-xl, 0.75rem) 0 0;
}

.nav-spacer {
  flex: 1;
}

.submit-actions {
  display: flex;
  gap: var(--space-4);
}

/* ===== ENHANCED BUTTONS WITH MANUSCRIPT AESTHETICS ===== */
.btn-primary {
  background: var(--illumination-primary);
  border: none;
  color: var(--button-text-light, white);
  font-weight: var(--font-semibold, 600);
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  box-shadow: var(--manuscript-shadow-medium);
  position: relative;
  overflow: hidden;
  font-family: var(--font-heading, 'Cairo', sans-serif);
  border-radius: var(--radius-lg, 0.5rem);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all var(--duration-slow, 500ms) var(--ease-manuscript, ease);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--illumination-glow-strong);
  background: linear-gradient(135deg, 
              var(--manuscript-gold-dark) 0%, 
              var(--sacred-copper) 50%,
              var(--manuscript-gold-primary) 100%);
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--card-background, white);
  border: 2px solid var(--manuscript-gold-primary);
  color: var(--manuscript-blue-primary);
  font-weight: var(--font-semibold, 600);
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
  font-family: var(--font-heading, 'Cairo', sans-serif);
  border-radius: var(--radius-lg, 0.5rem);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
  position: relative;
  overflow: hidden;
}

.btn-secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--illumination-primary);
  opacity: 0;
  transition: opacity var(--duration-base, 300ms) ease;
}

.btn-secondary:hover {
  color: var(--button-text-light, white);
  transform: translateY(-2px);
  box-shadow: var(--manuscript-shadow-medium);
}

.btn-secondary:hover::before {
  opacity: 1;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--manuscript-gold-light);
  color: var(--manuscript-blue-primary);
  font-weight: var(--font-medium, 500);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-family: var(--font-body, 'Tajawal', sans-serif);
  border-radius: var(--radius-lg, 0.5rem);
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease);
}

.btn-outline:hover {
  background: var(--manuscript-gold-light);
  color: var(--manuscript-blue-dark);
  border-color: var(--manuscript-gold-primary);
  transform: translateY(-1px);
}

/* ===== ENHANCED AUTO-SAVE NOTIFICATION ===== */
.auto-save-notification {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  background: var(--illumination-quaternary);
  color: var(--button-text-light, white);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl, 0.75rem);
  box-shadow: var(--manuscript-shadow-strong);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transform: translateX(-400px);
  transition: transform var(--duration-base, 300ms) var(--ease-manuscript, ease);
  z-index: 100;
  border: 2px solid var(--manuscript-green-light);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-heading, 'Cairo', sans-serif);
  font-weight: var(--font-medium, 500);
}

.auto-save-notification.show {
  transform: translateX(0);
}

.auto-save-notification i {
  font-size: var(--text-xl);
  animation: gentlePulse 1.5s infinite;
}

/* ===== SOPHISTICATED ANIMATIONS ===== */
@keyframes gentleGlow {
  0%, 100% {
    text-shadow: 0 2px 8px rgba(27, 74, 114, 0.1);
  }
  50% {
    text-shadow: 0 2px 8px rgba(27, 74, 114, 0.1), 
                 0 0 20px rgba(212, 165, 116, 0.3);
  }
}

@keyframes gracefulReveal {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    filter: blur(3px);
  }
  50% {
    opacity: 0.7;
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes elegantFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ornamentalFloat {
  0%, 100% {
    transform: translateY(-50%) scale(1);
  }
  50% {
    transform: translateY(-50%) scale(1.05);
  }
}

@keyframes gentleRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes gentlePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes subtleFlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ===== ENHANCED RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
  .form-layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar-column {
    position: static;
    margin-top: var(--space-8);
    max-height: none;
  }
}

@media (max-width: 768px) {
  .scholarly-creation-container {
    background-size: 80px 80px;
  }
  
  .creation-title {
    font-size: var(--text-2xl);
  }
  
  .creation-title::before,
  .creation-title::after {
    display: none;
  }
  
  .progress-steps {
    gap: var(--space-4);
    flex-wrap: wrap;
  }
  
  .step-number {
    width: 48px;
    height: 48px;
    font-size: var(--text-lg);
  }
  
  .step-label {
    font-size: var(--text-sm);
  }
  
  .classification-grid {
    grid-template-columns: 1fr;
  }
  
  .main-content-area {
    padding: var(--space-4);
  }
  
  .form-navigation {
    flex-direction: column;
    gap: var(--space-4);
  }
  
  .nav-spacer {
    display: none;
  }
  
  .submit-actions {
    width: 100%;
    justify-content: center;
  }
  
  .verse-text {
    font-size: var(--text-lg);
  }
  
  .quranic-guidance {
    padding: var(--space-4);
  }
}

@media (max-width: 480px) {
  .creation-header {
    padding: var(--space-4) 0;
  }
  
  .creation-title {
    font-size: var(--text-xl);
  }
  
  .step-header h2 {
    font-size: var(--text-xl);
  }
  
  .sources-container,
  .main-content-area,
  .review-section {
    padding: var(--space-4);
  }
  
  .large-input {
    font-size: var(--text-lg);
    padding: var(--space-3);
  }
  
  .btn-primary,
  .btn-secondary {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
  }
  
  .progress-steps {
    justify-content: center;
  }
  
  .step {
    flex: 0 0 auto;
  }
}

/* ===== ENHANCED FORM CONTROL FIXES ===== */
/* Nuclear specificity fix for stuck textarea backgrounds */
body.light-mode textarea#excerpt,
body:not(.dark-mode) textarea#excerpt,
textarea#excerpt.form-control,
.form-group textarea#excerpt {
  background-color: var(--card-background) !important;
  color: var(--text-color) !important;
}

body.light-mode .article-preview,
body:not(.dark-mode) .article-preview,
.article-preview#article-preview,
.review-section .article-preview {
  background-color: var(--card-background) !important;
  color: var(--text-color) !important;
}

body.dark-mode textarea#excerpt,
body.dark-mode textarea#excerpt.form-control {
  background-color: var(--dark-input-background) !important;
  color: var(--dark-text-primary) !important;
}

body.dark-mode .article-preview,
body.dark-mode .article-preview#article-preview {
  background-color: var(--dark-input-background) !important;
  color: var(--dark-text-primary) !important;
}

/* Nuclear specificity fix for ALL textareas in light mode to prevent dark bleeding */
body:not(.dark-mode) textarea,
body.light-mode textarea,
.scholarly-creation-container body:not(.dark-mode) textarea,
.scholarly-creation-container textarea:not([data-dark-mode]),
html:not(.dark-mode) textarea {
  background-color: var(--card-background, white) !important;
  color: var(--text-color, #2D3748) !important;
  border-color: var(--border-color, #E2E8F0) !important;
}

body:not(.dark-mode) textarea:focus,
body.light-mode textarea:focus,
.scholarly-creation-container body:not(.dark-mode) textarea:focus,
html:not(.dark-mode) textarea:focus {
  background-color: var(--card-background, white) !important;
  color: var(--text-color, #2D3748) !important;
  border-color: var(--accent-color, var(--manuscript-gold-primary)) !important;
}


/* ===== ENHANCED ACCESSIBILITY ===== */
.form-group:focus-within label {
  color: var(--manuscript-gold-primary);
}

.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--manuscript-blue-primary);
  color: var(--button-text-light, white);
  padding: var(--space-3) var(--space-5);
  text-decoration: none;
  border-radius: var(--radius-lg, 0.5rem);
  z-index: 100;
  font-family: var(--font-heading, 'Cairo', sans-serif);
  font-weight: var(--font-semibold, 600);
  transition: all var(--duration-base, 300ms) ease;
}

.skip-to-content:focus {
  top: var(--space-3);
}

/* Enhanced focus indicators with manuscript aesthetics */
*:focus-visible {
  outline: 3px solid var(--manuscript-gold-primary);
  outline-offset: 2px;
  border-radius: var(--radius-base, 0.25rem);
}

/* High contrast mode enhancements */
@media (prefers-contrast: high) {
  .creation-title,
  .step-header h2 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  }
  
  .btn-primary,
  .btn-secondary {
    border-width: 3px;
  }
  
  .manuscript-card,
  .source-item {
    border-width: 3px;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .creation-title::before,
  .creation-title::after {
    animation: none;
  }
  
  .auto-save-notification i {
    animation: none;
  }
}

/* ===== SOURCE UX CLARITY ENHANCEMENTS ===== */

/* Required and Optional Field Badges */
.required-badge {
  background: linear-gradient(135deg, var(--manuscript-red-primary), var(--manuscript-red-light));
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 2px 4px rgba(138, 90, 68, 0.15);
  animation: gentlePulse 3s ease-in-out infinite;
}

.optional-badge {
  background: linear-gradient(135deg, var(--manuscript-green-primary), var(--manuscript-green-light));
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 2px 4px rgba(138, 90, 68, 0.15);
}

/* Enhanced Field Visual Distinctions */
.required-field {
  border-left: 4px solid var(--manuscript-red-primary) !important;
  background: linear-gradient(135deg, 
              var(--card-background, #FFFFFF) 0%, 
              var(--background-color, #F8F5F1) 100%) !important;
  box-shadow: var(--manuscript-shadow-soft, 0 4px 20px rgba(138, 90, 68, 0.08)) !important;
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease) !important;
}

.optional-field {
  border-left: 4px solid var(--manuscript-green-primary) !important;
  background: linear-gradient(135deg, 
              var(--background-color, #F8F5F1) 0%, 
              var(--alt-background, #F0EBE3) 100%) !important;
  box-shadow: var(--manuscript-shadow-soft, 0 4px 20px rgba(138, 90, 68, 0.08)) !important;
  transition: all var(--duration-base, 300ms) var(--ease-manuscript, ease) !important;
}

.required-field:focus {
  border-left-color: var(--manuscript-red-primary) !important;
  box-shadow: 0 0 0 3px rgba(138, 90, 68, 0.2), 
              var(--manuscript-shadow-medium, 0 8px 32px rgba(138, 90, 68, 0.12)) !important;
  background: var(--card-background, #FFFFFF) !important;
  transform: translateY(-1px);
}

.optional-field:focus {
  border-left-color: var(--manuscript-green-primary) !important;
  box-shadow: 0 0 0 3px rgba(138, 90, 68, 0.2), 
              var(--manuscript-shadow-medium, 0 8px 32px rgba(138, 90, 68, 0.12)) !important;
  background: var(--card-background, #FFFFFF) !important;
  transform: translateY(-1px);
}

/* Source Guidance Panel Styling */
.source-guidance-panel {
  background: var(--parchment-secondary, linear-gradient(135deg, #FBF8F1 0%, #F4F1E8 50%, #F0EBE3 100%));
  border: 2px solid var(--accent-color, #8A5A44);
  border-radius: var(--radius-xl, 0.75rem);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--manuscript-shadow-medium, 0 8px 32px rgba(138, 90, 68, 0.12));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.source-guidance-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--illumination-primary, linear-gradient(135deg, #D4A574 0%, #C9A961 50%, #B87333 100%));
  border-radius: var(--radius-xl, 0.75rem) var(--radius-xl, 0.75rem) 0 0;
}

.guidance-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  color: var(--manuscript-green-dark);
  font-size: var(--text-lg);
  font-family: var(--font-display, 'Scheherazade New', serif);
  font-weight: var(--font-bold, 700);
}

.guidance-header i {
  font-size: 1.4em;
  color: var(--manuscript-gold-primary);
  filter: drop-shadow(0 2px 4px rgba(212, 165, 116, 0.3));
  animation: gentlePulse 4s ease-in-out infinite;
}

.guidance-content {
  color: var(--text-color, #2D3748);
  line-height: var(--leading-relaxed, 1.625);
}

.guidance-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.required-list li {
  padding: 0.5rem 0;
  position: relative;
  padding-right: 1.5rem;
  font-weight: var(--font-semibold, 600);
  color: var(--manuscript-red-dark);
}

.required-list li:before {
  content: "●";
  color: var(--manuscript-red-primary);
  font-weight: bold;
  position: absolute;
  right: 0;
  animation: gentlePulse 2s ease-in-out infinite;
}

.optional-list li {
  padding: 0.5rem 0;
  position: relative;
  padding-right: 1.5rem;
  color: var(--manuscript-green-dark);
}

.optional-list li:before {
  content: "◆";
  color: var(--manuscript-green-primary);
  font-weight: bold;
  position: absolute;
  right: 0;
}

.guidance-examples {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(138, 90, 68, 0.15);
}

.examples-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--manuscript-blue-primary);
  font-weight: var(--font-semibold, 600);
  font-family: var(--font-heading, 'Cairo', sans-serif);
}

.examples-header i {
  color: var(--manuscript-gold-primary);
  font-size: 1.1em;
}

.example-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
  justify-content: center;
}

.example-tag {
  background: linear-gradient(135deg, 
              var(--manuscript-blue-light) 0%, 
              var(--manuscript-blue-primary) 100%);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.8rem;
  font-weight: var(--font-medium, 500);
  border: 1px solid var(--manuscript-blue-dark);
  box-shadow: 0 2px 6px rgba(27, 74, 114, 0.2);
  transition: all var(--duration-base, 300ms) ease;
  position: relative;
  overflow: hidden;
}

.example-tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
              transparent 0%, 
              rgba(255, 255, 255, 0.2) 50%, 
              transparent 100%);
  transition: left var(--duration-slow, 500ms) ease;
}

.example-tag:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(27, 74, 114, 0.3);
}

.example-tag:hover::before {
  left: 100%;
}

/* Year Format Examples Styling */
.year-format-examples {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(27, 74, 114, 0.2);
}

.year-format-examples .examples-header {
  color: var(--manuscript-blue-primary);
  margin-bottom: var(--space-3);
}

.year-format-examples .examples-header i {
  color: var(--manuscript-gold-primary);
  font-size: 1.1em;
}

.example-tag.year-example {
  background: linear-gradient(135deg, 
              var(--manuscript-gold-light) 0%, 
              var(--manuscript-gold-primary) 100%);
  color: var(--manuscript-blue-dark);
  border: 1px solid var(--manuscript-gold-dark);
  font-weight: var(--font-semibold, 600);
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
  position: relative;
  overflow: hidden;
}

.example-tag.year-example::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
              transparent 0%, 
              rgba(255, 255, 255, 0.3) 50%, 
              transparent 100%);
  transition: left var(--duration-slow, 500ms) ease;
}

.example-tag.year-example:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.4);
  color: var(--manuscript-blue-primary);
}

.example-tag.year-example:hover::before {
  left: 100%;
}

/* Enhanced Form Text for URL Fields */
.form-text.text-success {
  color: var(--manuscript-green-primary) !important;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: var(--font-medium, 500);
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
  background: rgba(138, 90, 68, 0.05);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg, 0.5rem);
  border: 1px solid rgba(138, 90, 68, 0.08);
}

.form-text.text-success i {
  color: var(--manuscript-green-primary);
  font-size: 1.1em;
  animation: gentlePulse 3s ease-in-out infinite;
}

/* Enhanced Form Text for Year Field Guidance */
.form-text.text-info {
  color: var(--manuscript-blue-primary) !important;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: var(--font-medium, 500);
  font-family: var(--font-manuscript, 'Noto Naskh Arabic', serif);
  background: rgba(27, 74, 114, 0.05);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg, 0.5rem);
  border: 1px solid rgba(27, 74, 114, 0.1);
  line-height: 1.4;
}

.form-text.text-info i {
  color: var(--manuscript-blue-primary);
  font-size: 1.1em;
  flex-shrink: 0;
}

/* Tooltip Enhancements for Help Icons */
[data-bs-toggle="tooltip"] {
  cursor: help;
  transition: all var(--duration-base, 300ms) ease;
}

[data-bs-toggle="tooltip"]:hover {
  color: var(--manuscript-gold-primary) !important;
  transform: scale(1.2);
}

/* Enhanced Source Type Select for Islamic Sources */
.optional-field option[value="quran"],
.optional-field option[value="hadith"] {
  background: linear-gradient(135deg, 
              rgba(138, 90, 68, 0.1) 0%, 
              rgba(138, 90, 68, 0.05) 100%);
  color: var(--manuscript-green-dark);
  font-weight: var(--font-semibold, 600);
}

/* URL Field Special Styling */
input[name="source_url[]"] {
  direction: ltr !important;
  text-align: left !important;
}

input[name="source_url[]"]::placeholder {
  color: var(--manuscript-green-primary) !important;
  font-style: italic;
  font-size: 0.9em;
}

/* Light Mode Source Field Explicit Overrides */
body:not(.dark-mode) .required-field,
body.light-mode .required-field {
  background: linear-gradient(135deg, 
              #FFFFFF 0%, 
              #FBF8F1 100%) !important;
  color: var(--text-color, #1A202C) !important;
  border-color: #8B2C2C !important;
}

body:not(.dark-mode) .optional-field,
body.light-mode .optional-field {
  background: linear-gradient(135deg, 
              #F8F5F1 0%, 
              #F0EBE3 100%) !important;
  color: var(--text-color, #1A202C) !important;
  border-color: #2A5530 !important;
}

body:not(.dark-mode) .source-guidance-panel,
body.light-mode .source-guidance-panel {
  background: linear-gradient(135deg, 
              #FBF8F1 0%, 
              #F4F1E8 50%,
              #F0EBE3 100%) !important;
  color: var(--text-color, #1A202C) !important;
  border-color: #8A5A44 !important;
}

/* Dark Mode Field and Panel Overrides */
body.dark-mode .required-field,
body[data-theme="dark"] .required-field {
  background: linear-gradient(135deg, 
              var(--dark-background-secondary, #1A1F2E) 0%, 
              var(--dark-background-tertiary, #252A3A) 100%) !important;
  color: var(--dark-text-primary, #F7F9FA) !important;
  border-color: #E57373 !important; /* Manuscript red light for dark mode */
  box-shadow: 0 4px 20px rgba(212, 165, 116, 0.12) !important;
}

body.dark-mode .optional-field,
body[data-theme="dark"] .optional-field {
  background: linear-gradient(135deg, 
              var(--dark-background-secondary, #1A1F2E) 0%, 
              var(--dark-background-tertiary, #252A3A) 100%) !important;
  color: var(--dark-text-primary, #F7F9FA) !important;
  border-color: #5A9667 !important; /* Islamic green for dark mode */
  box-shadow: 0 4px 20px rgba(212, 165, 116, 0.12) !important;
}

body.dark-mode .source-guidance-panel,
body[data-theme="dark"] .source-guidance-panel {
  background: linear-gradient(135deg, 
              var(--dark-background-primary, #0F1419) 0%, 
              var(--dark-background-secondary, #1A1F2E) 50%,
              var(--dark-background-tertiary, #252A3A) 100%) !important;
  color: var(--dark-text-primary, #F7F9FA) !important;
  border-color: #D4A574 !important; /* Manuscript gold for dark mode */
  box-shadow: 0 8px 32px rgba(212, 165, 116, 0.15) !important;
}

body.dark-mode .required-field:focus,
body[data-theme="dark"] .required-field:focus {
  border-color: #EF9A9A !important; /* Manuscript red light for focus */
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.3), 
              0 8px 32px rgba(212, 165, 116, 0.2) !important;
}

body.dark-mode .optional-field:focus,
body[data-theme="dark"] .optional-field:focus {
  border-color: #6AAA77 !important; /* Islamic green light for focus */
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.3), 
              0 8px 32px rgba(212, 165, 116, 0.2) !important;
}

/* Responsive Design for UX Enhancements */
@media (max-width: 768px) {
  .source-guidance-panel {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }
  
  .guidance-content .row {
    flex-direction: column;
  }
  
  .example-tags {
    justify-content: center;
    gap: var(--space-1);
  }
  
  .example-tag {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }
  
  .required-badge,
  .optional-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .guidance-header {
    flex-direction: column;
    text-align: center;
    gap: var(--space-2);
  }
  
  .guidance-content h6 {
    font-size: var(--text-base);
    text-align: center;
  }
  
  .form-text.text-success {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
}

/* ===== PRINT OPTIMIZATION ===== */
@media print {
  .scholarly-creation-container {
    background: white !important;
    color: black !important;
  }
  
  .creation-header,
  .progress-steps,
  .form-navigation,
  .sidebar-widget,
  .btn,
  .auto-save-notification,
  .source-guidance-panel {
    display: none !important;
  }
  
  .main-content-area {
    background: white !important;
    border: 1pt solid #666 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 20pt !important;
  }
  
  .verse-text {
    color: black !important;
    font-size: 14pt !important;
  }
  
  .creation-title {
    color: black !important;
    font-size: 18pt !important;
    text-shadow: none !important;
  }
  
  .step-header h2 {
    color: black !important;
    font-size: 16pt !important;
  }
  
  .required-badge,
  .optional-badge {
    color: black !important;
    background: transparent !important;
    border: 1pt solid black !important;
  }
}