:root {
  --primary-color: #daa520;
  --primary-dark: #b8860b;
  --secondary-color: #1f2937;
  --background: #ffffff;
  --background-dark: #d1d5db;
  --text-color: #1f2937;
  --light-text: #4b5563;
  --section-bg: #fafafa;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --accent-color: #ffd700;
  --transition: all 0.3s ease;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --background: #1f2937;
  --background-dark: #374151;
  --text-color: #f3f4f6;
  --light-text: #d1d5db;
  --primary-color: #daa520;
  --secondary-color: #000;
  --section-bg: #111827;
  --card-bg: #374151;
  --border-color: #4b5563;
  --accent-color: #ffd700;
}

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

html:not([dir="rtl"]) body {
  text-align: left;
}

html[dir="rtl"] body {
  text-align: right;
}

body {
  font-family: "Montserrat Alternates", "ply", "Roboto", "Arial", sans-serif;
  background: var(--background);
  color: var(--text-color);
  line-height: 1.6;
  transition: var(--transition);
}

body[dir="rtl"] {
  font-family: "Almarai", "Arial", sans-serif;
}

/* loader */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  z-index: 9999;
  top: 50%;
  left: 45%;
  width: 150px;
  height: 150px;
  border-left: 5px solid #38ff8e;
  border-radius: 50%;
  animation: right5231 0.9s linear infinite;
  transform: translate(-50%, -50%);
}

.loader::before,
.loader::after {
  content: "";
  width: 120px;
  height: 120px;
  display: block;
  position: absolute;
  top: calc(50% - 60px);
  left: calc(50% - 60px);
  border-right: 5px solid #ffbe0b;
  border-radius: 50%;
  animation: left036 0.9s linear infinite;
}

.loader::after {
  width: 90px;
  height: 90px;
  top: calc(50% - 45px);
  left: calc(50% - 45px);
  border: 0;
  border-top: 5px solid #ff086e;
  animation: none;
}
@media (max-width: 768px) {
  .loader {
    top: 40%;
    left: 40%;
  }
}
@media (max-width: 480px) {
  .loader {
    top: 40%;
    left: 35%;
  }
}
@media (max-width: 375px) {
  .loader {
    top: 40%;
    left: 30%;
  }
}
@keyframes right5231 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes left036 {
  from {
    transform: rotate(720deg);
  }
  to {
    transform: rotate(0deg);
  }
}
/* **** */

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (max-width: 480px) {
  .container {
    padding: 0;
  }
}
@media (max-width: 375px) {
  .container {
    padding: 0;
  }
}
/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 1rem;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 5vw, 2.5rem);
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}
h3 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}
p {
  margin-bottom: 1rem;
  text-align: justify;
}

.small-h2 {
  font-size: clamp(1.3rem, 4vw, 1.7rem);
}
.small-h3 {
  font-size: clamp(1rem, 3vw, 1.2rem);
}
.small-p {
  font-size: clamp(0.7rem, 3vw, 0.9rem);
  margin-bottom: 1rem;
}

h1[dir="rtl"],
h2[dir="rtl"],
h3[dir="rtl"],
h4[dir="rtl"],
p[dir="rtl"],
span[dir="rtl"],
a[dir="rtl"],
ul[dir="rtl"],
div[dir="rtl"],
tr[dir="rtl"] {
  font-family: "Almarai", "Arial", sans-serif;
}

input[type="text"][dir="rtl"] {
  font-family: "Almarai", "Arial", sans-serif;
  padding: 8px;
  min-height: 44px;
  min-width: 44px;
}

input[type="email"][dir="rtl"] {
  font-family: "Almarai", "Arial", sans-serif;
  padding: 8px;
  min-height: 44px;
  min-width: 44px;
}

/* Buttons */
.btn {
  display: inline-flex; /* Use flexbox for better alignment */
  align-items: center; /* Center vertically */
  justify-content: center; /* Center horizontally */
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  font-size: 1rem;
  font-family: "Montserrat Alternates", sans-serif;
  text-align: center; /* Ensure text alignment inside */
  height: 100%; /* Ensure full height */
  min-height: 44px;
  min-width: 44px;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--secondary-color);
  font-weight: 600;
  font-family: "Montserrat Alternates", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary[dir="rtl"] {
  background: var(--primary-color);
  color: var(--secondary-color);
  font-weight: 600;
  font-family: "Almarai", "Arial", sans-serif;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-secondary[dir="rtl"] {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-family: "Almarai", "Arial", sans-serif;
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: var(--secondary-color);
  transform: translateY(-2px);
}

/*  Controls  */
.controls {
  padding: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

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

.dateSlider {
  /* Date Slider */
  flex: 1;
  max-width: 700px;
  margin-left: 10px;
  margin-right: 10px;
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 5px;
  background: var(--background-dark);
  outline: none;
  opacity: 0.7;
  -webkit-transition: 0.2s;
  transition: opacity 0.2s;
}
.dateSlider:hover {
  opacity: 1;
}
.dateSlider::-webkit-slider-thumb {
  /* Adjust the thumb for Chrome, Safari */
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
}
.dateSlider::-moz-range-thumb {
  /* Adjust the thumb for Firefox */
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
}
.date-range-label {
  font-size: 14px;
  width: 30%;
}

@media (max-width: 480px) {
  .controls {
    padding: 10px 0;
  }
}

/*  Legend  */
.legend-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Default: Two columns */
  gap: 10px 20px;
  padding: 10px;
  align-items: start;
}

/* Legend items */
.legend-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  break-inside: avoid;
  width: 100%;
}

.legend-item input[type="checkbox"] {
  cursor: pointer;
}

/* Legend color box */
.legend-color-box {
  width: 15px;
  height: 15px;
  margin-left: 5px;
  margin-right: 5px;
  flex-shrink: 0;
  border-radius: 2px;
}

/* Text styles */
.legend-item span {
  font-size: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: calc(100% - 40px);
}

@media (max-width: 1024px) {
  .legend-container {
    grid-template-columns: repeat(2, 1fr);
  }
  .legend-item span {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .legend-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
  }
  .legend-item {
    flex-direction: row;
  }
  .legend-color-box {
    width: 12px;
    height: 12px;
  }
  .legend-item span {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .legend-container {
    grid-template-columns: repeat(1, 1fr); /* One column */
    gap: 5px;
    justify-items: start;
  }
  .legend-item {
    flex-direction: row;
  }
  .legend-color-box {
    width: 10px;
    height: 10px;
    margin-right: 4px;
  }
  .legend-item span {
    font-size: 11px;
  }
}

.SelectSearch {
  padding: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.selectContainer,
.searchContainer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

@media (max-width: 480px) {
  .SelectSearch {
    flex-direction: column;
    gap: 5px;
    justify-content: start;
    align-items: start;
    padding: 0;
  }
  .selectContainer,
  .searchContainer {
    flex-direction: row;
    align-items: stretch;
    flex-wrap: nowrap;
  }
}
/* ***** */
.highlight {
  font-weight: bold;
}
/* ******** */
.note {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #555;
  background: #f1f5f9;
  border-left: 4px solid #007bff;
  padding: 0.75rem 1rem;
  border-radius: 5px;
  text-align: start;
}

.note_Ar {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #555;
  background: #f1f5f9;
  border-right: 4px solid #007bff;
  padding: 0.75rem 1rem;
  border-radius: 5px;
  text-align: start;
}

@media (max-width: 768px) {
  .note {
    font-size: 0.7rem;
  }
}
@media (max-width: 480px) {
  .note {
    font-size: 0.6rem;
  }
}
@media (max-width: 768px) {
  .note_Ar {
    font-size: 0.7rem;
  }
}
@media (max-width: 480px) {
  .note_Ar {
    font-size: 0.6rem;
  }
}
/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes floatAnimation {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes drawPath {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes appear {
  from {
    opacity: 0;
    clip-path: inset(100% 100% 0 0);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}
