/* Reset and basics */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Gradient Background for Page */
body {
  background: linear-gradient(135deg, #e0f7fa, #bbdefb, #90caf9);
  background-attachment: fixed;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Header and Navbar Styles (Copied from About Page) */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #333;
  padding: 15px 20px;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
}

/* Logo Styles */
.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 40px;
  width: auto;
}

/* Navigation Links */
.navbar {
  display: flex;
  align-items: center;
}

.navbar ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar li {
  margin: 0 15px;
}

.navbar li:last-child {
  margin-right: 25px;
}

.navbar a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  padding: 8px 15px;
  border-radius: 20px;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
}

.navbar a:hover {
  color: #5efce8;
  background-color: rgba(255, 255, 255, 0.1);
}

.navbar a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  background: #5efce8;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.navbar a:hover::after {
  width: 80%;
}

.navbar .active a {
  color: #5efce8;
  background-color: rgba(255, 255, 255, 0.1);
}

.icon {
  margin-right: 8px;
}

/* Hamburger Menu for Mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Admin Logout Button Styles within Navbar */
.admin-only {
  display: none !important;
}

.admin-only:not(.hidden) {
  display: block !important;
}

.admin-logout {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 500;
  transition: background 0.3s, transform 0.2s;
}

.admin-logout:hover {
  background: linear-gradient(135deg, #ff8e53, #ff6b6b);
  transform: scale(1.05);
}

.admin-logout.hidden, .edit-text-btn.hidden {
  display: none !important;
}

/* Edit Buttons Styling */
.edit-text-btn {
  margin-top: 10px;
  background: linear-gradient(135deg, #61a5ff, #5efce8);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s, transform 0.2s;
}

.edit-text-btn:hover {
  background: linear-gradient(135deg, #5efce8, #61a5ff);
  transform: scale(1.05);
}

/* Library Hero Section */
.library-hero {
  min-height: 60vh;
  background: url('hero-placeholder.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
  font-weight: bold;
  position: relative;
  overflow: hidden;
  margin-top: 70px;
}

.library-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.library-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  position: relative;
  z-index: 2;
}

/* Library Content */
.library-content {
  padding: 60px 20px;
  max-width: 1200px;
  margin: auto;
  text-align: center;
}

.media-section {
  margin-bottom: 60px;
  border-radius: 20px;
  padding: 30px;
  background-color: #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.media-section:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.section-header {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.media-section h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 15px;
  color: #333;
  border-bottom: none;
  padding-bottom: 0;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  padding: 10px 0;
}

.video-wrapper {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
  border: 1px solid #e0e0e0;
}

.video-wrapper:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.video-container {
  width: 100%;
  height: 200px;
  border: none;
  background: #000;
  position: relative;
  overflow: hidden;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-title {
  padding: 15px;
  font-weight: 500;
  font-size: clamp(0.9rem, 2vw, 1rem);
  text-align: center;
  color: #333;
  background: #f0f4f8;
  border-top: 1px solid #e0e0e0;
}

.video-title:focus {
  outline: 2px dashed #1e3a8a;
}

.remove-video-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
  z-index: 10;
}

.remove-video-btn:hover {
  background: red;
}

.add-video-btn {
  margin-top: 20px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #61a5ff, #5efce8);
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s, transform 0.2s;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.add-video-btn:hover {
  background: linear-gradient(135deg, #5efce8, #61a5ff);
  transform: scale(1.05);
}

.live-section {
  border-left: 5px solid red;
  background-color: #fff0f0;
  border-top: 5px solid red;
}

.live-section h2 {
  color: #d00000;
  font-weight: bold;
}

/* Navbar scroll effect */
.header.scrolled {
  background-color: rgba(51, 51, 51, 0.95);
}

/* Responsive Adjustments */
@media (min-width: 768px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
    z-index: 1001;
  }

  .navbar ul {
    display: none;
    position: absolute;
    top: 70px;
    right: 0;
    background-color: #333;
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(-100%);
    opacity: 0;
    transition: all 0.3s ease;
  }

  .navbar ul.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
  }

  .navbar li {
    margin: 15px 0;
    width: 100%;
    text-align: center;
  }

  .navbar li:last-child {
    margin-right: 0;
  }

  .navbar a, .admin-logout {
    padding: 10px 20px;
    display: block;
  }

  .library-content {
    padding: 40px 15px;
  }

  .media-section {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .media-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .library-hero {
    margin-top: 60px;
  }
}