/* Enhanced UfuqLMS Design System - Layout Improvements */

/* Modern Animations and Keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

/* Animation Classes */
.animate-fade-in {
  animation: fadeInUp 0.8s ease-out forwards;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Modern Visual Elements */
.glass-effect {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.shimmer-effect {
  background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

.gradient-border {
  position: relative;
  background: white;
  border-radius: 16px;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 2px;
  background: linear-gradient(45deg, #6366f1, #8b5cf6, #06b6d4);
  border-radius: inherit;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: subtract;
}

/* Font Settings */
html {
  font-size: 14px;
  scroll-behavior: smooth;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Arabic Font Support */
body {
  font-family: 'Noto Sans Arabic', 'Segoe UI', 'Arial', sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  color: #1f2937;
  background-color: #fafafa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* English content override */
.english-content {
  font-family: 'Inter', 'Segoe UI', 'Arial', sans-serif;
}

/* Custom Focus States */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #0ea5e9;
}

/* Layout */
html {
  position: relative;
  min-height: 100%;
  overflow-x: hidden; /* Prevent horizontal scroll bars */
}

/* Prevent scroll bars in footer/CTA sections */
body {
  overflow-x: hidden; /* Prevent horizontal scroll bars globally */
}

/* Ensure footer/CTA sections don't overflow */
.footer-section,
.cta-section,
[class*="footer"],
[class*="cta"] {
  overflow: hidden;
  max-width: 100vw;
}

/* Custom Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes bounceGentle {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(14, 165, 233, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.8);
  }
}

/* Utility Classes */
.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

.animate-bounce-gentle {
  animation: bounceGentle 2s infinite;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulse-glow 2s infinite;
}

/* Glass Morphism Effects */
.glass-card {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Custom Gradients */
.gradient-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
}

.gradient-secondary {
  background: linear-gradient(135deg, #d946ef 0%, #8b5cf6 100%);
}

.gradient-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.gradient-text-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced Shadows */
.shadow-elevated {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.shadow-glass {
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.shadow-soft {
  box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 10px 20px -2px rgba(0, 0, 0, 0.04);
}

/* Interactive Elements */
.hover-lift {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

.hover-scale {
  transition: transform 0.2s ease-in-out;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow 0.3s ease-in-out;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.5);
}

/* Custom Buttons */
.btn-primary-custom {
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-primary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
}

.btn-secondary-custom {
  background: linear-gradient(135deg, #d946ef 0%, #8b5cf6 100%);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(217, 70, 239, 0.3);
}

.btn-secondary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(217, 70, 239, 0.4);
}

/* Custom Cards */
.card-enhanced {
  background: white;
  border-radius: 16px;
  border: 1px solid rgba(229, 231, 235, 0.8);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  overflow: hidden;
}

.card-enhanced:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Form Enhancements */
.form-input-enhanced {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  transition: all 0.3s ease;
  background: white;
}

.form-input-enhanced:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  outline: none;
}

/* RTL Support Enhancements */
[dir="rtl"] .space-x-reverse > * + * {
  margin-right: 1rem;
  margin-left: 0;
}

[dir="rtl"] .space-x-4 > * + * {
  margin-left: 0;
  margin-right: 1rem;
}

[dir="rtl"] .text-left {
  text-align: right;
}

[dir="rtl"] .text-right {
  text-align: left;
}

/* Loading States */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f4f6;
  border-radius: 50%;
  border-top-color: #0ea5e9;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Accessibility Enhancements */
.focus-visible:focus {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }

  .print-break {
    page-break-before: always;
  }
}

/* =================================================================
   LAYOUT CONSISTENCY IMPROVEMENTS
   ================================================================= */

/* Consistent container widths and centering */
.content-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .content-container {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .content-container {
    padding: 0 2rem;
  }
}

/* Consistent section spacing */
.section {
  padding: 3rem 0;
}

.section-sm {
  padding: 2rem 0;
}

.section-lg {
  padding: 4rem 0;
}

.section-xl {
  padding: 6rem 0;
}

@media (min-width: 768px) {
  .section {
    padding: 4rem 0;
  }

  .section-sm {
    padding: 3rem 0;
  }

  .section-lg {
    padding: 6rem 0;
  }

  .section-xl {
    padding: 8rem 0;
  }
}

/* Consistent card layouts */
.layout-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}

.layout-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .layout-card {
    padding: 2rem;
    border-radius: 1rem;
  }
}

/* Consistent button spacing and sizing */
.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}

/* Consistent form layouts */
.form-layout {
  display: grid;
  gap: 1rem;
}

.form-layout-2col {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .form-layout-2col {
    grid-template-columns: 1fr 1fr;
  }
}

.form-layout-3col {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .form-layout-3col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .form-layout-3col {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Consistent text alignment for RTL */
.text-start {
  text-align: start;
}

.text-end {
  text-align: end;
}

/* Consistent spacing utilities */
.space-y-1 > * + * {
  margin-top: 0.25rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-3 > * + * {
  margin-top: 0.75rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.space-y-8 > * + * {
  margin-top: 2rem;
}

.space-x-1 > * + * {
  margin-left: 0.25rem;
}

.space-x-2 > * + * {
  margin-left: 0.5rem;
}

.space-x-3 > * + * {
  margin-left: 0.75rem;
}

.space-x-4 > * + * {
  margin-left: 1rem;
}

.space-x-6 > * + * {
  margin-left: 1.5rem;
}

/* RTL spacing adjustments */
[dir="rtl"] .space-x-1 > * + * {
  margin-left: 0;
  margin-right: 0.25rem;
}

[dir="rtl"] .space-x-2 > * + * {
  margin-left: 0;
  margin-right: 0.5rem;
}

[dir="rtl"] .space-x-3 > * + * {
  margin-left: 0;
  margin-right: 0.75rem;
}

[dir="rtl"] .space-x-4 > * + * {
  margin-left: 0;
  margin-right: 1rem;
}

[dir="rtl"] .space-x-6 > * + * {
  margin-left: 0;
  margin-right: 1.5rem;
}

/* Consistent list styling */
.list-styled {
  padding-left: 1.5rem;
}

.list-styled li {
  margin-bottom: 0.5rem;
}

[dir="rtl"] .list-styled {
  padding-left: 0;
  padding-right: 1.5rem;
}

/* Improved main content area */
#main-content {
  flex: 1;
  min-height: 0;
}

/* Consistent navigation improvements */
.nav-improved {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Footer improvements */
.footer-improved {
  margin-top: auto;
  padding: 2rem 0;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

/* Consistent image handling */
.img-responsive {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.img-cover {
  object-fit: cover;
}

.img-contain {
  object-fit: contain;
}

/* Consistent table improvements */
.table-improved {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.table-improved th,
.table-improved td {
  padding: 0.75rem;
  text-align: start;
  border-bottom: 1px solid #e2e8f0;
}

.table-improved th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
}

@media (max-width: 767px) {
  .table-responsive-stack {
    border: 0;
  }

  .table-responsive-stack thead {
    display: none;
  }

  .table-responsive-stack tr {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
  }

  .table-responsive-stack td {
    display: block;
    text-align: end;
    border: none;
    padding: 0.5rem 0;
    position: relative;
    padding-right: 50%;
  }

  .table-responsive-stack td:before {
    content: attr(data-label);
    position: absolute;
    right: 0;
    top: 0.5rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
  }

  [dir="rtl"] .table-responsive-stack td {
    text-align: start;
    padding-left: 50%;
    padding-right: 0;
  }

  [dir="rtl"] .table-responsive-stack td:before {
    left: 0;
    right: auto;
  }
}

/* =================================================================
   ENHANCED NAVIGATION AND UI ELEMENTS
   ================================================================= */

/* Enhanced Navigation Styles */
.nav-link {
  position: relative;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 80%;
}

.nav-link:hover {
  background: rgba(79, 70, 229, 0.05);
  color: #4f46e5;
}

/* Navigation Button Enhancements */
.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.btn-nav:hover::before {
  left: 100%;
}

.btn-nav:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.btn-nav:active {
  transform: translateY(0);
}

/* Mobile Menu Enhancement */
.mobile-menu-item {
  position: relative;
  transition: all 0.2s ease;
}

.mobile-menu-item:hover {
  background: rgba(79, 70, 229, 0.08);
  border-radius: 0.5rem;
  padding-right: 1rem;
}

.mobile-menu-item::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 0;
  height: 20px;
  background: #4f46e5;
  border-radius: 2px 0 0 2px;
  transform: translateY(-50%);
  transition: width 0.2s ease;
}

.mobile-menu-item:hover::before {
  width: 4px;
}

/* RTL adjustments for mobile menu */
[dir="rtl"] .mobile-menu-item:hover {
  padding-left: 1rem;
  padding-right: 0;
}

[dir="rtl"] .mobile-menu-item::before {
  left: 0;
  right: auto;
  border-radius: 0 2px 2px 0;
}

/* Enhanced Landing Page Styles */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0);
}

.card-hover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* Portal Card Enhancements */
.portal-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.portal-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  transform: scale(0);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.portal-card:hover::before {
  transform: scale(1);
}

.portal-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Feature Grid Enhancements */
.feature-grid .group {
  position: relative;
  overflow: hidden;
}

.feature-grid .group::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.7s ease;
}

.feature-grid .group:hover::after {
  left: 100%;
}

/* Technology Grid Enhancement */
.technology-grid > div {
  transition: all 0.3s ease;
  position: relative;
}

.technology-grid > div::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  padding: 2px;
  background: linear-gradient(45deg, #4f46e5, #7c3aed, #06b6d4, #10b981);
  background-size: 300% 300%;
  animation: gradientShift 6s ease infinite;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.technology-grid > div:hover::before {
  opacity: 1;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Interactive Button Enhancements */
.btn-primary-gradient {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-primary-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-primary-gradient:hover::before {
  left: 100%;
}

.btn-primary-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
}

/* Form Enhancement */
.form-input {
  transition: all 0.3s ease;
  position: relative;
}

.form-input:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

/* Error States */
.form-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.error-message::before {
  content: '⚠';
  font-size: 0.75rem;
}

/* Loading States Enhancement */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Skip Links Enhancement */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #4f46e5;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 6px;
}

/* Live Regions for Screen Readers */
.sr-live {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.announcement {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .card-hover {
    border: 2px solid #000;
  }

  .nav-link:hover {
    background: #000;
    color: #fff;
  }

  .btn-nav:hover {
    background: #000;
    color: #fff;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card-hover:hover,
  .portal-card:hover,
  .btn-nav:hover {
    transform: none;
  }
}

/* Dark Mode Preparation */
@media (prefers-color-scheme: dark) {
  .nav-link:hover {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
  }

  .mobile-menu-item:hover {
    background: rgba(79, 70, 229, 0.15);
  }
}

/* Focus-visible polyfill support */
.js-focus-visible :focus:not(.focus-visible) {
  outline: none;
}

.js-focus-visible .focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* =================================================================
   ADDITIONAL LANDING PAGE OPTIMIZATIONS (from landing.css)
   ================================================================= */

/* Performance optimizations */
.will-change-transform {
  will-change: transform;
}

.backface-hidden {
  backface-visibility: hidden;
}

/* Image lazy loading */
.lazy-image {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-image.loaded {
  opacity: 1;
}

/* Success message styling */
.success-message {
  color: #10b981;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.success-message::before {
  content: '✓';
  font-size: 0.75rem;
}

/* Loading state utilities */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* =================================================================
   ENHANCED VISUAL HIERARCHY AND TYPOGRAPHY
   ================================================================= */

/* Typography Scale - Enhanced Hierarchy */
.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-rendering: optimizeLegibility;
}

.hero-subtitle {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0.9;
  margin-top: 0.5rem;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.75rem;
    letter-spacing: -0.05em;
  }

  .hero-subtitle {
    font-size: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: 4.5rem;
  }

  .hero-subtitle {
    font-size: 1.875rem;
  }
}

/* Section Headings Hierarchy */
.section-heading {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: #1f2937;
  position: relative;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  right: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 1.5px;
}

[dir="ltr"] .section-heading::after {
  left: 0;
  right: auto;
}

@media (min-width: 768px) {
  .section-heading {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
  }
}

.section-subheading {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.6;
  color: #6b7280;
  max-width: 48rem;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .section-subheading {
    font-size: 1.25rem;
  }
}

/* Card Headings */
.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: #1f2937;
}

.card-subtitle {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: #6b7280;
  margin-bottom: 1rem;
}

.card-text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #4b5563;
}

/* Portal Card Typography */
.portal-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.portal-description {
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0.9;
}

/* Feature Card Typography */
.feature-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: #1f2937;
}

.feature-description {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #6b7280;
  margin-bottom: 1rem;
}

.feature-list {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #6b7280;
}

.feature-list li {
  position: relative;
  padding-right: 1rem;
  margin-bottom: 0.25rem;
}

[dir="ltr"] .feature-list li {
  padding-left: 1rem;
  padding-right: 0;
}

.feature-list li::before {
  content: '●';
  position: absolute;
  right: 0;
  top: 0;
  color: #4f46e5;
  font-weight: bold;
}

[dir="ltr"] .feature-list li::before {
  left: 0;
  right: auto;
}

/* Enhanced Text Sizes */
.text-hero {
  font-size: 3.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.text-display {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.text-headline {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
}

.text-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.text-subtitle {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
}

.text-body-large {
  font-size: 1.125rem;
  line-height: 1.6;
}

.text-body {
  font-size: 1rem;
  line-height: 1.6;
}

.text-body-small {
  font-size: 0.875rem;
  line-height: 1.5;
}

.text-caption {
  font-size: 0.75rem;
  line-height: 1.4;
}

/* Responsive Typography Scaling */
@media (max-width: 640px) {
  .text-hero { font-size: 2.25rem; }
  .text-display { font-size: 1.875rem; }
  .text-headline { font-size: 1.5rem; }
  .text-title { font-size: 1.25rem; }
  .text-subtitle { font-size: 1.125rem; }
}

/* Text Colors with Better Hierarchy */
.text-primary-900 { color: #1e1b4b; }
.text-primary-800 { color: #312e81; }
.text-primary-700 { color: #4338ca; }
.text-primary-600 { color: #4f46e5; }

.text-gray-900 { color: #111827; }
.text-gray-800 { color: #1f2937; }
.text-gray-700 { color: #374151; }
.text-gray-600 { color: #4b5563; }
.text-gray-500 { color: #6b7280; }
.text-gray-400 { color: #9ca3af; }

/* Enhanced Line Heights */
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }

/* Font Weight Variations */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-black { font-weight: 900; }

/* Letter Spacing */
.tracking-tighter { letter-spacing: -0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }

/* Text Alignment with RTL Support */
.text-start {
  text-align: start;
}

.text-end {
  text-align: end;
}

.text-center {
  text-align: center;
}

.text-justify {
  text-align: justify;
}

/* Enhanced Focus States for Typography */
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Typography Animation Classes */
.text-fade-in {
  animation: textFadeIn 0.8s ease-in-out;
}

.text-slide-up {
  animation: textSlideUp 0.6s ease-out;
}

.text-scale-in {
  animation: textScaleIn 0.5s ease-out;
}

@keyframes textFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes textSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes textScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Enhanced Link Styles */
.link-primary {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.link-primary:hover {
  color: #4338ca;
}

.link-primary::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  transition: width 0.3s ease;
}

.link-primary:hover::after {
  width: 100%;
}

/* Enhanced Text Selection */
::selection {
  background: rgba(79, 70, 229, 0.2);
  color: #1f2937;
}

::-moz-selection {
  background: rgba(79, 70, 229, 0.2);
  color: #1f2937;
}

/* Arabic Typography Enhancements */
[dir="rtl"] {
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
}

[dir="rtl"] .text-justify {
  text-align-last: right;
}

[dir="ltr"] .text-justify {
  text-align-last: left;
}

/* Typography Accessibility */
@media (prefers-reduced-motion: reduce) {
  .text-fade-in,
  .text-slide-up,
  .text-scale-in {
    animation: none;
  }
}

@media (prefers-contrast: high) {
  .text-gray-500,
  .text-gray-400 {
    color: #374151;
  }

  .feature-description,
  .card-subtitle,
  .section-subheading {
    color: #374151;
  }
}

/* Print Typography */
@media print {
  .hero-title,
  .section-heading,
  .text-display {
    color: #000 !important;
    font-weight: 700 !important;
  }

  .text-gray-500,
  .text-gray-600 {
    color: #374151 !important;
  }

  body {
    font-size: 12pt !important;
    line-height: 1.5 !important;
  }
}

/* Fix for text content display - prevent each character on new line */
.course-description,
.lecture-description,
.module-description,
.message-content,
.text-content,
p.lead,
.content-text {
    white-space: pre-line !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Ensure all description and content fields display properly */
[class*="description"],
[class*="content"] p,
.card-text,
.text-muted {
    white-space: pre-line;
    word-wrap: break-word;
}
