@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --color-light: #ffffff;
  --color-dark: #171717;
  --primary-color: #2A5C82; /* Added for consistency */
  --secondary-color: #3AB0D5; /* Added for consistency */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', sans-serif;
}

body {
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.6;
  font-family:
    "Inter Variable",
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    "Noto Sans",
    sans-serif,
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Segoe UI Symbol",
    "Noto Color Emoji";
}


.accent-text {
  @apply text-slate-600;
}

/* only use this to update the style of the auth input fields. use a different class for all other input fields */
.auth-input-field {
  @apply w-full px-4 py-3 rounded-container bg-white border border-gray-200 focus:border-primary focus:ring-1 focus:ring-primary outline-none transition-shadow shadow-sm hover:shadow;
}

/* only use this to update the style of the auth buttons. use the button class for all other buttons */
.auth-button {
  @apply w-full px-4 py-3 rounded bg-primary text-white font-semibold hover:bg-primary-hover transition-colors shadow-sm hover:shadow disabled:opacity-50 disabled:cursor-not-allowed;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.lecture-item {
  position: relative;
  background: #fff;
  border: 1px solid #ddd;
  margin-bottom: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.lecture-item:hover {
  background-color: #e6f0f6; /* لون فاتح قريب من الأزرق الثانوي */
  border-color: var(--secondary-color);
  transform: translateX(6px);
}

/* المحاضرة المكتملة */
.lecture-item.completed {
  background-color: #d1e9f8;
  border-left: 6px solid var(--primary-color);
  font-weight: 700;
  color: var(--primary-color);
  box-shadow: 0 4px 20px rgba(42, 92, 130, 0.3);
  padding-right: 1rem;
  position: relative;
  overflow: hidden;
}

/* العنوان داخل المحاضرة */
.lecture-item .lecture-title {
  flex: 1;
  display: inline-block;
  padding-right: 1.5rem;
  word-break: break-word;
}

/* علامة الصح تظهر بشكل منفصل */
.lecture-item.completed::after {
  content: "✔";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--primary-color);
  pointer-events: none;
}


.lecture-item.in-progress {
  background-color: #f0f7fb; /* لون خلفية فاتح جداً */
  border-left: 6px solid var(--secondary-color);
  color: var(--secondary-color);
}

.lecture-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 6px; /* زيادة سمك الشريط شوي */
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 0 0 12px 12px;
  transition: width 0.3s ease, background-color 0.3s ease;
  box-shadow: 0 0 6px var(--secondary-color);
}

/* تجاوب مع الشاشات الصغيرة */
@media (max-width: 600px) {
  .lecture-item {
    padding: 0.75rem 1rem;
    font-size: 14px;
    gap: 0.5rem;
  }

  .lecture-item.completed::after {
    font-size: 1.2rem;
    right: 0.75rem;
  }

  .lecture-item:hover {
    transform: translateX(3px);
  }
}

@media (max-width: 400px) {
  .lecture-item {
    flex-direction: column;
    align-items: flex-start;
  }
}


.year-selection {
  margin: 2rem auto;
  max-width: 400px;
  text-align: center;
}

.year-selection__title {
  font-family: 'Cairo', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
}

.year-selection__buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.year-btn {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem 1rem;
  font-family: 'Cairo', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  background: #ffffff;
  color: #000000;
  border: 2px solid #3AB0D5;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: 
    transform 0.2s ease, 
    box-shadow 0.2s ease, 
    background 0.3s ease, 
    color 0.3s ease;
}

.year-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.year-btn.active {
  background: linear-gradient(135deg, #3AB0D5 0%, #2A5C82 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(46, 106, 146, 0.4);
}


.download-btn {
  background: linear-gradient(135deg, #2A5C82, #3AB0D5);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}
.download-btn i {
  font-size: 1.1rem;
}
.download-btn:hover {
  background: linear-gradient(135deg, #3AB0D5, #2A5C82);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}



/* === قسم "أكثر المتفاعِلين" بثلاث بطاقات ثابتة === */
body {
      font-family: 'Cairo', sans-serif;
      margin: 0;
      background-color: #f0f2f5; /* Example background */
      color: #333;
      line-height: 1.6;
    }

    .container {
      max-width: 1100px;
      margin: 0 auto;
      padding: 0 1rem;
    }

    /* === قسم "أكثر المتفاعِلين" === */
    .top-users {
      max-width: 1000px;
      margin: 3rem auto;
      padding: 0 1rem;
      font-family: 'Cairo', sans-serif;
    }

    .top-users .section-title {
      text-align: center;
      font-size: 1.8rem;
      margin-bottom: 2rem;
      color: #333;
      font-weight: 700;
    }

    .top-users-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1.5rem;
    }

    .user-card {
      background: #ffffff;
      border-radius: 0.75rem;
      box-shadow: 0 4px 15px rgba(0,0,0,0.08);
      padding: 1.5rem;
      text-align: center;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .user-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    }

    .user-card img {
      width: 90px;
      height: 90px;
      border-radius: 50%;
      object-fit: cover;
      margin-bottom: 1rem;
      border: 3px solid #3AB0D5; /* Accent border */
    }

    .user-card h3 {
      margin: 0.5rem 0 0.25rem;
      font-size: 1.2rem;
      font-weight: 600;
      color: #2A5C82;
    }

    .user-card p {
      margin: 0.25rem 0;
      font-size: 0.95rem;
      color: #555;
    }

    .user-card p a {
      color: #3AB0D5;
      text-decoration: none;
      font-weight: 600;
    }

    .user-card p a:hover {
      text-decoration: underline;
    }

    /* Responsive adjustments */
    @media (max-width: 992px) { /* Tablets and larger phones */
      .top-users-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      }
    }

    @media (max-width: 768px) { /* Smaller tablets and phones */
      .top-users-grid {
        grid-template-columns: 1fr; /* Single column for user cards */
        gap: 1rem;
      }
      .user-card img {
        width: 80px; /* Adjusted size */
        height: 80px;
      }
    }

    @media (max-width: 480px) { /* Small phones */
      .user-card h3 {
        font-size: 1.1rem;
      }
      .user-card p {
        font-size: 0.9rem;
      }
      .top-users .section-title {
        font-size: 1.5rem; /* Adjust title size for small screens */
      }
      .user-card {
        padding: 1.25rem; /* Adjust padding for smaller cards */
      }
      .user-card img {
        width: 70px;
        height: 70px;
      }
    }

    
.header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border-radius: 0 0 12px 12px;
  position: relative;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-icons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.settings-circle,
.profile-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}

.settings-circle {
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--primary-color);
}

.profile-circle {
  overflow: hidden;
  border: 2px solid #fff;
}

.profile-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teachers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.teacher-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.3s ease, border-color 0.3s ease; /* Added border-color transition */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  text-align: center;
  cursor: pointer;
  position: relative;
}

.teacher-card:hover {
  transform: translateY(-5px);
  border-color: var(--secondary-color);
}

.lecture-list {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.lecture-item {
  background: #fff;
  padding: 1.2rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s; /* Combined transitions */
}

.lecture-item:hover {
  background: #e0e0e0;
  transform: translateX(5px);
}

.lecture-icon {
  font-size: 1.5rem;
  color: var(--secondary-color);
}

.badge {
  background: var(--secondary-color);
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.courses-section {
  margin: 3rem 0;
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.navigation-steps {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap; /* Allow steps to wrap on smaller screens */
}

.step-item {
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  border: 1px solid transparent; /* Added for smoother hover */
}

.step-item.active {
  background: var(--primary-color);
  color: #fff;
}

.step-item.completed {
  background: var(--secondary-color);
  color: #fff;
}

.step-item:hover:not(.active) {
  transform: translateY(-2px);
  border-color: var(--primary-color); /* Added hover border */
}

.subjects-grid,
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem; /* Standardized gap */
  margin: 2rem 0;
}

.classes-grid {
  gap: 1rem; /* Slightly smaller gap for classes if needed */
}


.subject-card,
.class-card {
  background: #fff;
  padding: 1.5rem;
  text-align: center;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 2px solid transparent; /* Added for smoother hover */
}

.subject-card:hover,
.class-card:hover {
  transform: translateY(-5px);
  border-color: var(--secondary-color);
}

.back-button {
  background: #f8f9fa;
  color: #333; /* Added default text color */
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  border: 1px solid #ddd; /* Added subtle border */
}

.back-button:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color); /* Match border with background */
}

.search-box {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  border: 2px solid var(--primary-color);
  margin: 1rem 0;
  transition: all 0.3s ease;
  font-size: 1rem; /* Ensured readable font size */
}

.search-box:focus {
  border-color: var(--secondary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(58, 176, 213, 0.25); /* Added focus ring */
}

.dynamic-content {
  position: relative;
  min-height: 300px; /* Adjusted min-height */
}

.content-section {
  /* position: absolute; */ /* Consider removing absolute positioning if it causes layout issues */
  width: 100%;
  opacity: 0;
  visibility: hidden; /* Use visibility for better accessibility */
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease; /* Smooth transition */
  transform: translateY(10px); /* Slight animation */
}

.content-section.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
}

/* ====== Video Modal Styles ====== */
#videoPage {
  display: none; /* Initially hidden */
  position: fixed;
  inset: 0; /* Covers the whole screen */
  background-color: #f0f2f5;
  z-index: 10000;
  overflow-y: auto;
  box-sizing: border-box;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  padding: 1rem; /* Added padding for smaller screens */
}

/* Video Page Header */
#videoPage .video-header {
  text-align: center;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  padding: 1.5rem 1rem; /* Adjusted padding */
  border-bottom: 1px solid #ddd;
  border-radius: 0 0 12px 12px; /* Match other headers */
  margin-bottom: 1.5rem; /* Space below header */
}

#videoPage .video-header .video-title {
  margin: 0;
  font-size: 1.8rem; /* Adjusted font size */
  font-weight: 700;
  color: #ffffff; /* Changed to white for better contrast on gradient */
  cursor: pointer;
  transition: color .2s;
}

#videoPage .video-header .video-title:hover {
  color: #f0f0f0; /* Lighter white on hover */
}

/* Video Wrapper */
.video-wrapper {
  max-width: 960px;
  margin: 1.5rem auto; /* Adjusted margin */
  background-color: #ffffff;
  border-radius: 18px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* Player Container */
.video-player-container {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

/* Plyr Video */
#player { /* Ensure this ID is used by your video player if it's Plyr */
  width: 100%;
  height: 100%;
  display: block;
}

/* Video Meta */
.video-meta {
  padding: 1.5rem; /* Adjusted padding */
  color: #222;
}

.video-meta h2 {
  font-size: 1.5rem; /* Adjusted font size */
  margin-bottom: 0.8rem;
}

.video-meta p {
  font-size: 1rem; /* Adjusted font size */
  color: #555;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

/* Video Page Back Button */
#videoPage .back-button { /* Specific to video page */
  padding: 0.8rem 1.5rem; /* Adjusted padding */
  background-color: var(--primary-color); /* Consistent button color */
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: block; /* Make it block to center with margin auto */
  margin: 1.5rem auto 0; /* Center button */
  width: fit-content; /* Adjust width to content */
}

#videoPage .back-button:hover {
  background-color: #0056b3; /* Darker shade on hover */
}

/* Floating Telegram Button */
.floating-telegram-btn {
  position: fixed;
  bottom: 20px;
  left: 20px; /* Keep on left for LTR, adjust if RTL needs it on right */
  background: #0088cc;
  color: #fff;
  padding: 10px 15px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 1000;
  display: flex;
  align-items: center;
  font-size: 0.9rem; /* Adjusted font size */
}

.floating-telegram-btn i {
  margin-right: 8px; /* For LTR, adjust if icon is on other side for RTL */
}

.floating-telegram-btn:hover {
  background: #006b9e;
}


/* ====== Responsive Adjustments ====== */

/* Medium screens (tablets) */
@media (max-width: 992px) {
  .container {
    padding: 1.5rem;
  }
  .video-meta h2 {
    font-size: 1.3rem;
  }
  .video-meta p {
    font-size: 0.95rem;
  }
  #videoPage .video-header .video-title {
    font-size: 1.6rem;
  }
}


/* Small screens (tablets and large mobiles) */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  .header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .header-icons {
    width: 100%;
    justify-content: space-between; /* Spread icons on mobile header */
  }
  .teachers-grid {
    grid-template-columns: 1fr; /* Single column for teachers */
  }
  .subjects-grid,
  .classes-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Smaller cards */
    gap: 1rem;
  }
  .step-item {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }
  .profile-circle,
  .settings-circle {
    width: 40px;
    height: 40px;
  }
  .search-box {
    padding: 0.8rem;
    font-size: 0.9rem;
  }
  .lecture-item {
    flex-direction: column; /* Stack lecture item content */
    align-items: flex-start;
    gap: 0.5rem;
  }
  .badge {
    align-self: flex-start; /* Align badge properly in stacked layout */
  }

  /* Video Page on Small Screens */
  #videoPage {
    padding: 0.5rem;
  }
  .video-wrapper {
    margin: 1rem auto;
    border-radius: 12px; /* Slightly smaller radius */
  }
  #videoPage .video-header {
    padding: 1rem 0.5rem;
    margin-bottom: 1rem;
  }
  #videoPage .video-header .video-title {
    font-size: 1.4rem;
  }
  .video-meta {
    padding: 1rem;
  }
  .video-meta h2 {
    font-size: 1.2rem;
  }
  .video-meta p {
    font-size: 0.9rem;
  }
  #videoPage .back-button {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
  }
  .floating-telegram-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    bottom: 15px;
    left: 15px;
  }
}

/* Extra small screens (mobiles) */
@media (max-width: 576px) {
  .container {
    padding: 0.8rem;
  }
  .header {
    padding: 1rem;
  }
  .step-item {
    width: 100%; /* Full width steps on very small screens */
    justify-content: center;
  }
  .subjects-grid,
  .classes-grid {
    grid-template-columns: 1fr; /* Single column for subjects/classes */
  }
  .subject-card, .class-card {
    padding: 1rem;
  }
  .teacher-card {
    padding: 1rem;
  }
  #videoPage .video-header .video-title {
    font-size: 1.2rem;
  }
  .video-meta h2 {
    font-size: 1.1rem;
  }
  .video-meta p {
    font-size: 0.85rem;
  }
  .floating-telegram-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    bottom: 10px;
    left: 10px;
  }
  .floating-telegram-btn i {
    margin-right: 5px;
  }
}
