/* Critical CSS - Above the fold */
@import url('../font.fa.css');

html, body {
  scroll-behavior: smooth;
  background-color: #f5f5f5;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  font-family: "Vazirmatn", "IranSans", "Tahoma", sans-serif;
}

/* Font Awesome Icons */
.fas, .far, .fab, .fa {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}

.far {
  font-weight: 400 !important;
}

.fab {
  font-family: "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

/* Container */
.msn-container {
  width: 85%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0;
}

/* Grid Layout */
.msn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 300px);
  gap: 15px;
  margin-bottom: 15px;
  justify-content: center;
}

/* Card Sizes */
.card-small {
  width: 300px;
  height: 304px;
  grid-column: auto;
}

.card-large {
  width: 612px;
  height: 304px;
  grid-column: span 2;
}

/* Card Styles */
.msn-card {
  transition: all 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  display: block;
  height: 100%;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.msn-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: inherit;
}

.card-gradient {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.4) 40%,
    rgba(0, 0, 0, 0.1) 60%,
    rgba(0, 0, 0, 0) 100%
  );
}

/* Header */
.msn-header {
  background: rgba(255, 255, 255, 0.95);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.msn-header.scrolled {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.98);
}

/* Navigation */
.msn-nav {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid #e5e5e5;
  background: none;
  padding: 0;
  justify-content: center;
}

.msn-nav::-webkit-scrollbar {
  display: none;
}

.msn-nav-item {
  padding: 0.5rem 1rem;
  color: #333;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  text-decoration: none;
}

.msn-nav-item:hover {
  color: #0078d4;
  text-decoration: none;
}

.msn-nav-item.active {
  color: #0078d4;
  font-weight: 600;
}

.msn-nav-item.active:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #0078d4;
}

/* Mobile Menu */
.mobile-menu {
  transition: transform 0.3s ease-in-out;
  transform: translateX(100%);
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-overlay {
  transition: opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.mobile-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Image Aspect Ratios */
.img-16-9 { aspect-ratio: 16/9; }
.img-1-1 { aspect-ratio: 1/1; }
.img-4-3 { aspect-ratio: 4/3; }

/* Responsive Design */
@media (max-width: 1280px) {
  .msn-container {
    width: 90%;
  }
}

@media (max-width: 640px) {
  .msn-grid {
    grid-template-columns: 1fr;
  }

  .card-small,
  .card-large {
    width: 100%;
    height: auto;
    min-height: 250px;
    grid-column: auto;
  }
}

/* Utilities */
.top-header {
  background: white;
  padding: 0.5rem 0;
}

.top-header a,
.top-header span {
  color: #333;
}

.header h1,
.header h2 {
  color: #0078d4;
}

/* RTL Input Styles */
input[type="search"], 
input[type="text"], 
input[type="email"] {
  direction: rtl;
  text-align: right;
}

input[type="email"] {
  direction: ltr;
  text-align: left;
}

/* Force RTL for all text elements */
h1, h2, h3, h4, h5, h6, p, span, div, a, li, td, th {
  direction: rtl;
  text-align: right;
}

/* English text should be LTR */
.english, .ltr {
  direction: ltr;
  text-align: left;
}

.section-header {
  margin-bottom: 15px;
  padding: 4px 8px;
  background: none;
  text-align: center;
  color: #333;
}

section { margin-bottom: 15px; }
p { margin: 0; }

.msn-card .mt-auto.flex { justify-content: space-between; }
.justify-between { justify-content: space-between; }

footer {
  background: none !important;
  box-shadow: none;
  border: none;
  border-radius: 0;
  padding: 2rem 0;
}

footer p,
footer a {
  color: #333;
}

footer .fab {
  color: #0078d4 !important;
  font-size: 1.25rem;
}

header {
  border-radius: 0;
  border: none;
}

.mx-5 {
  margin-left: 0;
  margin-right: 0;
}

@media (min-width: 641px) {
  .msn-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 300px));
    grid-auto-flow: dense;
  }
}

/* Line Clamp Utilities */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Image Aspect Ratios */
.img-16-9 { 
  aspect-ratio: 16/9; 
}

.img-1-1 { 
  aspect-ratio: 1/1; 
}

.img-4-3 { 
  aspect-ratio: 4/3; 
}

/* Mobile Menu Styles */
.mobile-menu {
  transition: transform 0.3s ease-in-out;
  transform: translateX(100%);
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-overlay {
  transition: opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.mobile-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Navigation Styles */
.msn-nav {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid #e5e5e5;
  background: none;
  padding: 0;
  justify-content: center;
}

.msn-nav::-webkit-scrollbar {
  display: none;
}

.msn-nav-item {
  padding: 0.5rem 1rem;
  color: #333;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  text-decoration: none;
}

.msn-nav-item:hover {
  color: #0078d4;
  text-decoration: none;
}

.msn-nav-item.active {
  color: #0078d4;
  font-weight: 600;
}

.msn-nav-item.active:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #0078d4;
}

/* Card Content Styles */
.msn-card .absolute.bottom-0 {
  text-align: right;
  direction: rtl;
}

.msn-card .absolute.bottom-0 h3,
.msn-card .absolute.bottom-0 p {
  text-align: right;
  direction: rtl;
  width: 100%;
}

.msn-card .flex.items-center.justify-between {
  direction: rtl;
  width: 100%;
}

/* Image Transitions */
.msn-card .img-4-3 img {
  transition: transform 0.5s ease;
}

.msn-card:hover .img-4-3 img {
  transform: scale(1.05);
}

.msn-card.bg-white {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.msn-card.bg-white:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Section Styles */
.section-header {
  margin-bottom: 15px;
  padding: 4px 8px;
  background: none;
  text-align: center;
  color: #333;
}

section { 
  margin-bottom: 15px; 
}

p { 
  margin: 0; 
}

/* Flex Utilities */
.msn-card .mt-auto.flex { 
  justify-content: space-between; 
}

.justify-between { 
  justify-content: space-between; 
}

/* Footer Styles */
footer {
  background: none !important;
  box-shadow: none;
  border: none;
  border-radius: 0;
  padding: 2rem 0;
}

footer p,
footer a {
  color: #333;
}

footer .fab {
  color: #0078d4 !important;
  font-size: 1.25rem;
}

/* Header Styles */
header {
  border-radius: 0;
  border: none;
}

/* Utilities */
.mx-5 {
  margin-left: 0;
  margin-right: 0;
}

/* Top Header Styles */
.top-header {
  background: white;
  padding: 0.5rem 0;
}

.top-header a,
.top-header span {
  color: #333;
}

.header h1,
.header h2 {
  color: #0078d4;
}

/* RTL Input Styles */
input[type="search"], 
input[type="text"], 
input[type="email"] {
  direction: rtl;
  text-align: right;
}

input[type="email"] {
  direction: ltr;
  text-align: left;
}

/* Force RTL for all text elements */
h1, h2, h3, h4, h5, h6, p, span, div, a, li, td, th {
  direction: rtl;
  text-align: right;
}

/* English text should be LTR */
.english, .ltr {
  direction: ltr;
  text-align: left;
}