/* ============================================
   Library Page - Modern Redesign
   Shared styles are in All.css
   ============================================ */

/* Navigation z-index adjustment for Library page */
body:not(.programs-page) .navigation {
  z-index: 2;
}

body:not(.programs-page) .nav ul li .dropdown-menu {
  z-index: 10;
}

/* ============================================
   HERO SECTION
   ============================================ */

.library-hero {
  position: relative;
  width: 100%;
  min-height: 60vh;
  background: linear-gradient(135deg, var(--primary-color, #004aad) 0%, var(--secondary-color, #007BFF) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 100px;
  top: -43px;
  margin-bottom: 0;
}

.library-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('../Resources/Images/annie-spratt-hWJsOnaWTqs-unsplash.jpg') center/cover;
  opacity: 0.15;
  z-index: 0;
}

.library-hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 74, 173, 0.9) 0%, rgba(0, 123, 255, 0.8) 100%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  padding: 3rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 2s ease-in-out;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-badge i {
  font-size: 1.2rem;
}

.hero-content h1 {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-content > p {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  opacity: 0.95;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
  margin-top: 2.5rem;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  display: block;
  font-size: 0.95rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.library-hero .hero-content,
.library-hero .hero-content h1,
.library-hero .hero-content p,
.library-hero .hero-badge,
.library-hero .hero-stats,
.library-hero .stat-number,
.library-hero .stat-label {
  color: #ffffff !important;
}

/* Overlay open: lock page scroll; scroll only inside overlay panels */
body.no-scroll {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
}
.overlay,
#videoOverlay.video-overlay {
  overscroll-behavior: contain;
}

/* ============================================
   QUICK CATEGORIES
   ============================================ */

/* Anchor targets clear fixed header when using in-page / hash links */
#art-lib,
#photo-gallery,
#video-gallery {
  scroll-margin-top: 6rem;
}

.quick-categories {
  background: var(--bg-light, #f9f9f9);
  padding: 4rem 0;
  margin-top: 0;
}

.section-title {
  font-size: 2rem;
  color: var(--primary-color, #004aad);
  text-align: center;
  margin-bottom: 2.5rem;
  font-weight: 600;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.category-card {
  background: white;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-color, #333);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.category-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 74, 173, 0.2);
  border-color: var(--primary-color, #004aad);
  color: var(--primary-color, #004aad);
}

.category-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary-color, #004aad), var(--secondary-color, #007BFF));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  transition: transform 0.3s ease;
}

.category-card:hover .category-icon {
  transform: scale(1.1) rotate(5deg);
}

.category-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.category-card p {
  font-size: 0.85rem;
  color: #888;
  margin: 0;
}

/* ============================================
   LIBRARY SECTION
   ============================================ */

.library-section {
  padding: 4rem 0;
  background: white;
}

.section-header-modern {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.section-header-modern h2 {
  font-size: 2.2rem;
  color: var(--primary-color, #004aad);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.section-header-modern h2 i {
  font-size: 2rem;
}

.section-description {
  font-size: 1.05rem;
  color: #666;
  margin: 0;
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
  background: #f5f5f5;
  padding: 0.25rem;
  border-radius: 8px;
}

.view-btn {
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #666;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}

.view-btn.active {
  background: var(--primary-color, #004aad);
  color: white;
}

.view-btn:hover:not(.active) {
  background: #e0e0e0;
}

/* ============================================
   FILTER SECTION
   ============================================ */

.filter-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-light, #f9f9f9);
  border-radius: 12px;
}

.filter-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: #555;
  transition: all 0.3s ease;
}

.filter-tab i {
  font-size: 1.1rem;
}

.filter-tab:hover {
  border-color: var(--primary-color, #004aad);
  color: var(--primary-color, #004aad);
  transform: translateY(-2px);
}

.filter-tab.active {
  background: var(--primary-color, #004aad);
  color: white;
  border-color: var(--primary-color, #004aad);
}

.sort-select {
  padding: 0.75rem 1.25rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  font-size: 0.95rem;
  color: #555;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary-color, #004aad);
}

/* ============================================
   RESOURCE CARDS
   ============================================ */

.library-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.library-container.list-view {
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.library-container.list-view .resource-card {
  display: flex;
  flex-direction: row;
  max-width: 100%;
  padding: 1.5rem;
  align-items: flex-start;
  gap: 1.25rem;
}

.library-container.list-view .card-header {
  position: static;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.35rem;
}

.library-container.list-view .card-meta {
  width: 100%;
  justify-content: flex-start;
}

.library-container.list-view .card-icon {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  margin: 0;
}

.library-container.list-view .card-content {
  flex: 1;
  padding: 0;
}

.library-container.list-view .card-footer {
  position: static;
  margin-top: 0;
  padding: 0;
  border-top: none;
  background: transparent;
  flex-shrink: 0;
  width: auto;
}

/* List view: keep actions compact and readable */
.library-container.list-view .resource-card h3 {
  margin-bottom: 0.5rem;
}

.library-container.list-view .resource-card p {
  margin-bottom: 0;
}

.library-container.list-view .resource-info {
  justify-content: flex-start;
}

.resource-card {
  background: white;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.resource-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 74, 173, 0.15);
  border-color: var(--primary-color, #004aad);
}

.resource-card.featured-card {
  border: 2px solid var(--primary-color, #004aad);
  box-shadow: 0 4px 16px rgba(0, 74, 173, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.5rem 0;
  margin-bottom: 1rem;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  background: var(--primary-color, #004aad);
  color: white;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.card-badge.featured {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.card-badge i {
  font-size: 0.7rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resource-date {
  font-size: 0.85rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.resource-date i {
  font-size: 0.9rem;
}

.card-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color, #004aad), var(--secondary-color, #007BFF));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 2.5rem;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 74, 173, 0.3);
}

.card-content {
  padding: 0 1.5rem;
  flex-grow: 1;
}

.resource-tag {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: rgba(0, 74, 173, 0.1);
  color: var(--primary-color, #004aad);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.resource-card h3 {
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}

.resource-card p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.card-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-light, #f9f9f9);
}

.resource-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: #888;
}

.file-size {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.file-type {
  padding: 0.25rem 0.6rem;
  background: white;
  border-radius: 4px;
  font-weight: 600;
  color: var(--primary-color, #004aad);
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: white;
  color: var(--primary-color, #004aad);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
  background: var(--primary-color, #004aad);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 74, 173, 0.3);
}

.action-btn.preview {
  color: var(--secondary-color, #007BFF);
}

.action-btn.preview:hover {
  background: var(--secondary-color, #007BFF);
  color: white;
}

.action-btn.download {
  color: var(--success-color, #28a745);
}

.action-btn.download:hover {
  background: var(--success-color, #28a745);
  color: white;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination-modern {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #555;
  transition: all 0.3s ease;
}

.page-nav:hover:not(:disabled) {
  border-color: var(--primary-color, #004aad);
  color: var(--primary-color, #004aad);
  transform: translateY(-2px);
}

.page-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-numbers {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.page-number {
  width: 42px;
  height: 42px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #555;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-number:hover {
  border-color: var(--primary-color, #004aad);
  color: var(--primary-color, #004aad);
}

.page-number.active {
  background: var(--primary-color, #004aad);
  color: white;
  border-color: var(--primary-color, #004aad);
}

.page-ellipsis {
  padding: 0 0.5rem;
  color: #888;
}

/* ============================================
   PHOTO GALLERY MODERN
   ============================================ */

.gallery-section {
  background: var(--bg-light, #f9f9f9);
}

.photo-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.photo-card-modern {
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 4/3;
  cursor: pointer;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.photo-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.photo-card-modern:hover .photo-wrapper img {
  transform: scale(1.1);
}

.photo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.photo-card-modern:hover .photo-overlay,
.photo-card-modern:focus-within .photo-overlay {
  opacity: 1;
  pointer-events: auto;
}

.photo-info{
  color: white;
}

.photo-info h4 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: white;
}

.photo-info p {
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0;
  color: white;
}

.photo-view-btn {
  align-self: flex-end;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-view-btn:hover {
  background: var(--primary-color, #004aad);
  transform: scale(1.1);
}

.view-all-container {
  text-align: center;
  margin-top: 2rem;
}

.view-all-btn-modern {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: var(--primary-color, #004aad);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 74, 173, 0.3);
}

.view-all-btn-modern:hover {
  background: var(--primary-dark, #00327a);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 74, 173, 0.4);
}

.view-all-btn-modern i {
  font-size: 1.2rem;
}

.library-filter-empty-msg {
  text-align: center;
  color: #555;
  padding: 1rem 0 2rem;
  font-size: 1rem;
}

/* ============================================
   VIDEO GALLERY MODERN
   ============================================ */

.video-section {
  background: white;
}

.video-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.video-card-modern {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
  cursor: pointer;
  opacity: 1;
  transform: scale(1);
}

.video-card-modern:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 74, 173, 0.15);
  border-color: var(--primary-color, #004aad);
}

.video-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #000;
  border-radius: 8px;
}

.video-poster-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay-modern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-card-modern:hover .video-overlay-modern,
.video-card-modern:focus-within .video-overlay-modern {
  opacity: 1;
  pointer-events: auto;
}

.play-button {
  width: 70px;
  height: 70px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: var(--primary-color, #004aad);
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.play-button:hover {
  transform: scale(1.1);
  background: white;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.video-duration {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.video-content {
  padding: 1.5rem;
}

.video-content h3 {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.video-content > p {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.video-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: #888;
}

.video-meta span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.video-meta i {
  font-size: 0.9rem;
}

/* ============================================
   OVERLAY STYLES (Updated)
   ============================================ */

.overlay {
  display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  overflow-y: auto;
  padding: 2rem;
}

.overlay.active {
  display: block !important;
}

.overlay-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.overlay-filter {
  padding: 0.6rem 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 25px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.overlay-filter:hover,
.overlay-filter.active {
  background: var(--primary-color, #004aad);
  border-color: var(--primary-color, #004aad);
}

.close-btn {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 3rem;
  color: white;
  cursor: pointer;
  z-index: 1001;
  transition: transform 0.3s ease;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.close-btn:hover {
  transform: rotate(90deg);
  background: rgba(255, 0, 0, 0.7);
}

.overlay-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.overlay-photo {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  background: #222;
  min-height: 200px;
  z-index: 1;
}

.overlay-photo:hover {
  transform: scale(1.05);
}

.overlay-photo img {
  width: 100%;
  height: auto;
  min-height: 380px;
  display: block;
  opacity: 1 !important;
  visibility: visible !important;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.photo-overlay-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 1;
}

.photo-overlay-info p {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  margin-top: 0;
  margin-bottom: var(--space-paragraph);
  color: var(--text-light);
}

.overlay-photo:hover .photo-overlay-info {
  transform: translateY(0);
}

/* Video Overlay */
.video-overlay {
  display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  overflow-y: auto;
  padding: 2rem;
}

.video-overlay.active {
  display: block !important;
}

.video-grid-overlay {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}

.video-grid-overlay .video-container {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: block;
  opacity: 1;
}

.video-grid-overlay .video-container:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.2);
}

.video-grid-overlay .video-container video {
  width: 100%;
  height: 260px;
  display: block;
  border-radius: 12px 12px 0 0;
}

.video-grid-overlay .video-container .video-info {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
}

.video-grid-overlay .video-container .video-info h3 {
  color: white;
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.video-grid-overlay .video-container .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  color: white;
  opacity: 0.9;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.video-grid-overlay .video-container:hover .play-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* ============================================
   VIDEO PLAYER SYSTEM - Mini Player (16:9, no stretch)
   Scoped so global img/video rules do not flatten the player.
   ============================================ */

.video-player-container {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  pointer-events: none;
  overflow: hidden;
}

.video-player-container.active {
  display: block;
  pointer-events: auto;
}

/* Inner box: fixed corner, 16:9 aspect, no layout blowout */
.video-player-wrapper {
  background: #0a0a0a;
  border-radius: 16px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  cursor: move;
  user-select: none;
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s ease;
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
  left: auto;
  top: auto;
  width: min(400px, calc(100vw - 2.5rem));
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.video-player-wrapper.dragging {
  cursor: grabbing;
  transition: none;
}

.video-player-wrapper.mini {
  width: min(400px, calc(100vw - 2.5rem));
}

.video-player-wrapper.mini .video-player-header {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.video-player-wrapper.mini .video-player-title {
  font-size: 0.85rem;
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-player-wrapper.enlarged {
  width: min(720px, calc(100vw - 2rem));
  max-height: 90vh;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.video-player-wrapper.enlarged .video-player-header {
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.video-player-wrapper.enlarged .video-player-title {
  font-size: 1rem;
  max-width: 100%;
  white-space: normal;
}

/* Video Player Header */
.video-player-header {
  background: rgba(0, 0, 0, 0.8);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: padding 0.3s ease;
}

.video-player-title {
  color: white;
  font-weight: 600;
  margin: 0;
  flex: 1;
  transition: all 0.3s ease;
}

.video-player-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
  margin-left: 0.5rem;
  pointer-events: auto;
}

.video-player-close:hover {
  background: rgba(255, 0, 0, 0.7);
  transform: scale(1.1);
}

/* Video fills 16:9 frame — sizing from aspect-ratio + wrapper max-height (no fixed pixel height) */
.video-player-wrapper .video-player-element {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: none;
  display: block;
  background: #000;
  object-fit: contain;
  object-position: center center;
  pointer-events: auto;
  cursor: default;
}

.video-player-element::-webkit-media-controls-panel {
  background: rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .video-player-wrapper,
  .video-player-wrapper.mini,
  .video-player-wrapper.enlarged {
    width: min(100%, calc(100vw - 1.5rem));
    right: 0.75rem;
    bottom: 0.75rem;
    max-height: 65vh;
  }

  .video-player-wrapper .video-player-element {
    max-height: none;
  }
}

@media (max-width: 480px) {
  .video-player-wrapper {
    border-radius: 12px;
    right: 0.5rem;
    bottom: 0.5rem;
    width: calc(100vw - 1rem);
  }
}

/* Hide old video player modal */
.video-player-modal,
#videoPlayerModal {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  overflow: hidden !important;
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  z-index: -1 !important;
  pointer-events: none !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }
  
  .hero-stats {
    gap: 2rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
  }
  
  .library-container {
    grid-template-columns: 1fr;
  }
  
  .filter-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-tabs {
    justify-content: center;
  }
  
  .section-header-modern {
    flex-direction: column;
  }
  
  .photo-grid-modern,
  .video-grid-modern {
    grid-template-columns: 1fr;
  }
  
  .overlay-content,
  .video-grid-overlay {
    grid-template-columns: 1fr;
  }
  
  .card-footer {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .card-actions {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero-content {
    padding: 2rem 1rem;
  }
  
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .hero-stats {
    gap: 1.5rem;
  }
  
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .filter-tab span {
    display: none;
  }
  
  .filter-tab {
    padding: 0.75rem;
  }
}

/* ============================================
   PREVIEW MODAL
   ============================================ */

.preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.preview-container {
  background: white;
  border-radius: 12px;
  max-width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  background: var(--bg-light, #f9f9f9);
}

.preview-header h3 {
  margin: 0;
  color: var(--primary-color, #004aad);
  font-size: 1.3rem;
}

.close-preview {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-preview:hover {
  background: #f0f0f0;
  color: var(--error-color, #dc3545);
}

.preview-content {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.preview-content iframe {
  width: 100%;
  height: 70vh;
  border: none;
}

.preview-content img {
  width: 100%;
  height: auto;
  display: block;
}

.preview-message {
  padding: 2rem;
  text-align: center;
  color: #666;
}
