/* Modern Events Popup with Enhanced Visual Appeal */
:root {
  --popup-primary: #0056b3;
  --popup-accent: #00a8ff;
  --popup-light: #4a90e2;
  --popup-gradient: linear-gradient(135deg, var(--popup-accent), var(--popup-primary));
  --popup-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  --popup-radius: 20px;
  --popup-transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Popup Overlay with Glass Morphism Effect */
.enhanced-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 10, 30, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1500px;
  overflow: hidden;
  padding: 20px;
}

.enhanced-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modern Card-Style Popup Container */
.enhanced-event-popup {
  width: 95%; /* Slightly wider for better spacing */
  max-width: 1000px;
  min-height: 600px;
  max-height: 90vh; /* Slightly taller to use more screen space on mobile */
  background: #fff;
  border-radius: var(--popup-radius);
  box-shadow: var(--popup-shadow), 
              0 0 0 1px rgba(255, 255, 255, 0.1), 
              0 0 30px rgba(0, 86, 179, 0.2),
              inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  overflow: hidden;
  transform-style: preserve-3d;
  transform: rotateX(20deg) scale(0.8) translateY(50px);
  opacity: 0;
  transition: var(--popup-transition);
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  position: relative;
  backdrop-filter: blur(10px);
}

.enhanced-popup-overlay.active .enhanced-event-popup {
  transform: rotateX(0) scale(1) translateY(0);
  opacity: 1;
}

/* Elegant Close Button */
.enhanced-popup-close {
  position: absolute;
  top: 25px;
  right: 25px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15),
              inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  border: none;
  font-size: 20px;
  color: var(--popup-primary);
  transform: translateZ(40px);
}

.enhanced-popup-close:hover {
  background: white;
  transform: translateZ(50px) rotate(90deg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2),
              inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

/* Enhanced Event Popup Styles */
.events-popup-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  perspective: 1200px;
}

.events-popup-container.active {
  opacity: 1;
  visibility: visible;
}

.events-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: pointer;
  opacity: 0;
  transition: all 0.5s ease;
}

.events-popup-container.active .events-popup-overlay {
  opacity: 1;
}

.events-popup-content {
  position: relative;
  background-color: #fff;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  border-radius: 15px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  transform: scale(0.8) rotateX(20deg);
  opacity: 0;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
}

.events-popup-content.active {
  transform: scale(1) rotateX(0);
  opacity: 1;
}

.popup-header {
  position: relative;
  padding: 25px 30px;
  color: #fff;
  display: flex;
  align-items: center;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.2), transparent);
}

.popup-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  opacity: 0.3;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

.popup-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  font-size: 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  animation: pulseIcon 2s infinite alternate;
}

.popup-header h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  flex: 1;
}

.events-popup-close {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: #fff;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.events-popup-close:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg);
}

.popup-body {
  padding: 20px 30px;
  max-height: calc(85vh - 100px);
  overflow-y: auto;
}

.events-list {
  padding: 10px 0;
}

.popup-event-item {
  background: #f8f9fa;
  padding: 20px;
  margin-bottom: 15px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #ddd;
  transform: translateY(30px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.popup-event-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.popup-event-item:hover::before {
  opacity: 1;
}

.popup-event-item.active {
  transform: translateY(0);
  opacity: 1;
}

.popup-event-item h3 {
  margin: 0 0 10px 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: #333;
}

.popup-event-item .event-date {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.05);
  padding: 5px 12px;
  border-radius: 20px;
}

.popup-event-item .event-date i {
  margin-right: 8px;
  color: var(--event-primary, #0056b3);
}

.popup-event-item p {
  margin: 10px 0 0 0;
  font-size: 1rem;
  color: #555;
  line-height: 1.6;
}

.popup-footer {
  text-align: center;
  padding: 15px 0 5px;
  border-top: 1px solid #eee;
  margin-top: 15px;
}

.view-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 25px;
  background: var(--event-primary, #0056b3);
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 600;
  box-shadow: 0 5px 15px rgba(0, 86, 179, 0.3);
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.view-all-btn i {
  margin-left: 8px;
  transition: transform 0.3s ease;
}

.view-all-btn:hover {
  transform: translateY(-3px);
}

.view-all-btn:hover i {
  transform: translateX(5px);
}

/* Color Variations for Headers */
.color-green {
  background: linear-gradient(135deg, #8bc34a 0%, #689f38 100%);
}

.color-blue {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
}

.color-purple {
  background: linear-gradient(135deg, #673ab7 0%, #4527a0 100%);
}

.color-orange {
  background: linear-gradient(135deg, #ff5722 0%, #e64a19 100%);
}

/* Custom Scrollbar */
.popup-body::-webkit-scrollbar {
  width: 8px;
}

.popup-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.popup-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

.popup-body::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animations */
@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Responsive styles */
@media (max-width: 768px) {
  .events-popup-content {
    width: 95%;
    max-height: 80vh;
  }
  
  .popup-header {
    padding: 20px;
  }
  
  .popup-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .popup-header h2 {
    font-size: 1.5rem;
  }
  
  .popup-body {
    padding: 15px 20px;
  }
  
  .popup-event-item {
    padding: 15px;
  }
  
  .popup-event-item h3 {
    font-size: 1.1rem;
  }
}
