/* Mobile-first responsive design */
/* Uses variables.css - ensure it's loaded first */

body {
  font-family: 'Cairo', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
}

.container {
  width: 100%;
  padding: 0 15px;
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  line-height: 1.2;
}

/* Header styles */
.site-header {
  background-color: #fff;
  box-shadow: var(--box-shadow);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  transition: var(--transition);
}

.logo img {
  max-width: 120px;
  transition: var(--transition);
}

.nav-menu {
  display: none;
}

.mobile-menu-toggle {
  display: block;
  font-size: 24px;
  color: var(--primary-color);
  background: none;
  border: none;
  cursor: pointer;
}

/* Mobile navigation */
.mobile-nav {
  position: fixed;
  top: 0;
  left: -100%;
  width: 80%;
  height: 100%;
  background-color: #fff;
  transition: var(--transition);
  z-index: 1000;
  overflow-y: auto;
  box-shadow: var(--box-shadow);
}

.mobile-nav.active {
  left: 0;
}

.mobile-nav ul {
  padding: 20px;
  list-style-type: none;
}

.mobile-nav li {
  margin-bottom: 15px;
}

.mobile-nav a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 18px;
  transition: var(--transition);
}

.mobile-nav a:hover {
  color: var(--primary-color);
}

/* Hero section */
.hero {
  padding: 60px 0 40px;
  text-align: center;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
}

.hero-title {
  font-size: 28px;
  margin-bottom: 15px;
}

.hero-subtitle {
  font-size: 16px;
  margin-bottom: 30px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--accent-color);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-size: 16px;
  text-align: center;
}

.btn:hover {
  /* Use filter instead of invalid darken() function */
  background-color: var(--accent-color);
  filter: brightness(0.85);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
  transition: var(--transition);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Cards */
.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  padding: 20px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-5px);
}

/* Footer */
.footer {
  background-color: var(--secondary-color);
  color: #fff;
  padding: 40px 0;
  text-align: center;
}

.footer-section {
  margin-bottom: 30px;
}

.footer a {
  color: #fff;
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  color: var(--accent-color);
}

/* Utility classes */
.hidden-mobile {
  display: none;
}

.visible-mobile {
  display: block;
}

/* Responsive tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

td, th {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1050;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--box-shadow);
}

.close {
  color: var(--light-text-color);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
}

.pagination a {
  color: var(--primary-color);
  padding: 8px 16px;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  margin: 0 4px;
}

.pagination a.active {
  background-color: var(--primary-color);
  color: #fff;
}

.pagination a:hover:not(.active) {
  background-color: #f1f1f1;
}

/* Alerts */
.alert {
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.alert-success {
  background-color: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.alert-error {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.alert-warning {
  background-color: #fff3cd;
  border-color: #ffeeba;
  color: #856404;
}

/* Exam card specific styles */
.exam-card {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  overflow: hidden;
  transition: var(--transition);
}

.exam-card:hover {
  transform: translateY(-5px);
}

.exam-card__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.exam-card__content {
  padding: 20px;
}

.exam-card__title {
  font-size: 18px;
  margin-bottom: 10px;
}

.exam-card__meta {
  font-size: 14px;
  color: var(--light-text-color);
  margin-bottom: 15px;
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Loading spinner */
.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: var(--primary-color);
  animation: spin 1s ease infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Accordion */
.accordion {
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.accordion-item {
  border-bottom: 1px solid var(--border-color);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  padding: 15px;
  cursor: pointer;
  background-color: #f7f7f7;
  transition: var(--transition);
}

.accordion-content {
  padding: 15px;
  display: none;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
}

.tab-link {
  padding: 10px 15px;
  cursor: pointer;
  background-color: #f7f7f7;
  border: 1px solid var(--border-color);
  border-bottom: none;
  margin-right: 5px;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.tab-link.active {
  background-color: #fff;
  border-bottom-color: #fff;
}

.tab-content {
  display: none;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-top: none;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 20px;
  background-color: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background-color: var(--primary-color);
  transition: width 0.5s ease-out;
}

/* Responsive breakpoints */
@media screen and (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media screen and (min-width: 768px) {
  .container {
    max-width: 720px;
  }

  .nav-menu {
    display: flex;
  }

  .mobile-menu-toggle {
    display: none;
  }

  .hero-title {
    font-size: 36px;
  }

  .hero-subtitle {
    font-size: 18px;
  }

  .hidden-mobile {
    display: block;
  }

  .visible-mobile {
    display: none;
  }

  .exam-card {
    flex-direction: row;
  }

  .exam-card__image {
    width: 200px;
    height: auto;
  }
}

@media screen and (min-width: 992px) {
  .container {
    max-width: 960px;
  }

  .hero-title {
    font-size: 48px;
  }

  .hero-subtitle {
    font-size: 20px;
  }
}

@media screen and (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Optimizations for touch devices */
@media (hover: none) {
  .btn:hover,
  .card:hover,
  .exam-card:hover {
    transform: none;
  }
}

/* Additional components */

/* Search bar */
.search-bar {
  display: flex;
  margin-bottom: 20px;
}

.search-bar input[type="text"] {
  flex-grow: 1;
  margin-right: 10px;
  margin-bottom: 0;
}

.search-bar button {
  flex-shrink: 0;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 5px 10px;
  background-color: var(--primary-color);
  color: #fff;
  border-radius: 20px;
  font-size: 14px;
  margin-right: 5px;
  margin-bottom: 5px;
}

/* Rating stars */
.rating {
  unicode-bidi: bidi-override;
  direction: rtl;
  text-align: left;
}

.rating > span {
  display: inline-block;
  position: relative;
  width: 1.1em;
  font-size: 1.5em;
  color: #FFD700;
}

.rating > span:hover:before,
.rating > span:hover ~ span:before {
  content: "\2605";
  position: absolute;
  color: #FFD700;
}

/* File upload */
.file-upload {
  position: relative;
  overflow: hidden;
  margin: 10px 0;
}

.file-upload input[type="file"] {
  position: absolute;
  font-size: 100px;
  right: 0;
  top: 0;
  opacity: 0;
}

.file-upload-btn {
  display: inline-block;
  padding: 8px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Timeline */
.timeline {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
}

.timeline::after {
  content: '';
  position: absolute;
  width: 6px;
  background-color: var(--primary-color);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -3px;
}

.timeline-item {
  padding: 10px 40px;
  position: relative;
  background-color: inherit;
  width: 50%;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 25px;
  height: 25px;
  right: -17px;
  background-color: white;
  border: 4px solid var(--primary-color);
  top: 15px;
  border-radius: 50%;
  z-index: 1;
}

.timeline-item:nth-child(even) {
  left: 50%;
}

.timeline-item:nth-child(odd) {
  left: 0;
}

/* Nested comments */
.comment {
  margin-bottom: 20px;
}

.comment-content {
  background-color: #f9f9f9;
  padding: 15px;
  border-radius: 4px;
}

.comment-meta {
  font-size: 0.9em;
  color: var(--light-text-color);
  margin-top: 5px;
}

.comment .comment {
  margin-left: 20px;
}

/* Performance optimizations */
@media screen and (max-width: 768px) {
  .container {
    padding: 0 10px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .btn {
    padding: 10px 20px;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}