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

* {
  -webkit-user-select: none;  /* Safari */
  -ms-user-select: none;      /* IE 10 and IE 11 */
  user-select: none;          /* Standard syntax */
}

body {
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  background-color: #f0f4f8;
  padding-bottom: 60px;
}

header {
  background-color: #2c5282;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  color: white;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.header-subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.back-button {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  display: none;
  margin-bottom: 1rem;
}

#pageTitle {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.search-bar {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  backdrop-filter: blur(5px);
}

.search-bar i {
  color: rgba(255, 255, 255, 0.8);
  margin-right: 0.5rem;
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  width: 100%;
  font-size: 1rem;
  padding: 0.5rem;
  color: white;
}

.search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

main {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.platform-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.platform-selector button,
.platform-card {
  padding: 2.5rem;
  border: none;
  border-radius: 16px;
  background: white;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.4rem;
  font-weight: 600;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.platform-selector button i,
.platform-card i {
  font-size: 2.5rem;
  color: #2c5282;
}

.platform-selector button .platform-name,
.platform-card .platform-name {
  font-size: 1.2rem;
  font-weight: 600;
}

.platform-selector button .platform-description,
.platform-card .platform-description {
  font-size: 0.9rem;
  color: #718096;
  font-weight: normal;
}

.platform-selector button:hover,
.platform-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  background: #2c5282;
  color: white;
}

.platform-selector button:hover i,
.platform-selector button:hover .platform-description,
.platform-card:hover i,
.platform-card:hover .platform-description {
  color: white;
}

.subject-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.subject-card {
  background: white;
  border-radius: 12px;
  padding: 1.8rem;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem; /* Adjust the value as needed */
  margin-right: 1rem; /* Adjust the value as needed */
  gap: 0.5rem;
}

.subject-card i {
  font-size: 2rem;
  color: #2c5282;
  margin-bottom: 0.5rem;
}

.subject-card .subject-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
}

.subject-card .teacher-name {
  font-size: 0.85rem;
  color: #718096;
  font-weight: 400;
}

.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  background: #2c5282;
  color: white;
}

.subject-card:hover i,
.subject-card:hover .subject-name,
.subject-card:hover .teacher-name {
  color: white;
}

.lecture-list {
  display: grid;
  gap: 1rem;
}

.lecture-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  min-width: 0; /* Prevent flex children from growing beyond container */
  word-break: break-word; /* Break long words if needed */
}

.lecture-card:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.lecture-card h3 {
  margin: 0;
  color: #2d3748;
  font-size: 1.1rem;
  flex: 1 1 0;      /* allow shrinking and growing */
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  text-overflow: unset;
}

.button-container {
  display: flex;
  gap: 1rem;
}

.stream-button, .download-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stream-button {
  background: #2c5282;
  color: white;
}

.download-button {
  background: #4a5568;
  color: white;
}

.stream-button:hover, .download-button:hover {
  transform: scale(1.05);
}

.stream-button:hover {
  background: #1a365d;
}

.download-button:hover {
  background: #2d3748;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: grid;
  z-index: 900;
  grid-template-columns: repeat(4, 1fr);
  padding: 0.75rem 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #718096;
  font-size: 0.8rem;
  gap: 0.3rem;
  transition: all 0.3s;
}

.bottom-nav a i {
  font-size: 1.2rem;
}

.bottom-nav a.active {
  color: #2c5282;
}

/* Video Popup Styles */
.video-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease-out;
}

.video-popup-content {
  background: #fff;              /* Make background black for better video contrast */
  border-radius: 8px;            /* Smaller corners */
  width: 80%;                    /* Wider container */
  max-width: 900px;              /* Allow more width */
  position: relative;
  padding: 0.5rem;               /* Less internal spacing */
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);  /* Keep soft shadow */
  animation: slideUp 0.4s ease-out;
}

.close-popup {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e53e3e;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.close-popup:hover {
  background: #c53030;
  transform: scale(1.1);
}

.video-title {
  color: #2d3748;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.iframe-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: none; /* Remove extra shadow */
}

.iframe-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@media (max-width: 768px) {
  .platform-selector {
    grid-template-columns: 1fr;
  }
  
  .subject-list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .lecture-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .button-container {
    width: 100%;
    justify-content: space-between;
  }
  
  .stream-button, .download-button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .video-popup-content {
    width: 95%;
    padding: 0.5rem;
    border-radius: 2px;
  }

  .video-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
  }

  .close-popup {
    top: -12px;
    right: -12px;
    width: 35px;
    height: 35px;
    font-size: 1rem;
    }
}
