/* Global Styles */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(to bottom right, #332D56, #4E6688);
  color: #E3EEB2;
}

/* Top Bar */
.topbar {
  background: linear-gradient(to right, #71C0BB, #E3EEB2);
  padding: 40px 50px;
  text-align: center;
  font-size: 48px;
  font-weight: 900;
  font-family: 'Segoe UI', sans-serif;
  color: #332D56;
  border-bottom: 4px solid #332D56;
  letter-spacing: 2px;
  text-shadow: 2px 2px #4E6688;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

/* Layout Container */
.container {
  display: grid;
  grid-template-columns: 340px 1fr 280px; /* bump right sidebar to 400px */
  height: calc(100vh - 80px);
}
.leftbar {
  background-color: #4E6688;
  overflow-y: auto;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border-right: 2px solid #71C0BB;
  width: 100%;
  padding: 10px;
}

/* Left Sidebar */
.description {
  background-color: #332D56;
  padding: 20px;
  overflow-y: auto;
  border-right: 2px solid #71C0BB;
  width: 100%;
}

/* Right Sidebar */
.sidebar {
  /* display: grid; */
  /* grid-template-columns: repeat(2, minmax(0, 1fr)); improves item fitting */
  gap: 12px;
  background-color: #4E6688;
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Sidebar Items */
.item {
  background-color: #71C0BB;
  color: #332D56;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s ease, background-color 0.3s ease;
  
}

.item:hover {
  transform: scale(1.05) rotate(-1deg);
  background-color: #E3EEB2;
  color: #332D56;
}

.item.active {
  background-color: #E3EEB2;
  color: #332D56;
  box-shadow: 0 0 12px rgba(227, 238, 178, 0.6);
}

/* Main Canvas Area */
.canvas-area {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #332D56;
  padding: 10px;
  width: 100%;
}

/* Iframe */
iframe {
  width: 100%;
  max-width: 900px;
  height: auto;
  aspect-ratio: 4 / 3;
  border: none;
}

.canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

canvas {
  max-width: 90%;
  max-height: 90%;
}

@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "left"
      "canvas"
      "right";
  }
}

.hover-wrapper {
  justify-content: flex-start; /* Push content to top */
  align-items: center;
  height: 100%; /* Optional if you want full height container */
  top: 50px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 240px;
  z-index: 1;
  /* flex-shrink: 0; */
  /* flex: 0 0 auto; */
}

.hover-group {
  background-color: #71C0BB;
  color: #332D56;
  padding: 40px 12px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s ease, background-color 0.3s ease;
}

.hover-wrapper:hover .hover-group {
  transform: scale(1.07) rotate3d(1, 1, 1, 6deg);
}


/* 🗨️ Speech bubble that floats off to the right */
.media-explanation {
  position: absolute;
  width: 300px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.35);
  border: 1.5px solid #90caf9;
  border-radius: 6px;
  font-size: 1.1rem;
  color: #040131;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  box-shadow: 0 0px 0px rgba(100, 100, 100, 0.8);
  backdrop-filter: blur(15px);
  z-index: 1000;
  transition: transform 0.4s ease, opacity 0.4s ease;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  opacity: 0;
}


.hover-wrapper:hover .media-explanation {
  z-index: 999; /* 👈 This ensures it's above everything else */
  opacity: 1;
  transform: scale(1.07) rotate3d(1, 1, 1, 6deg);
}

.hover-wrapper:not(:hover) .media-explanation {
  pointer-events: none;
}

/* 🎯 Optional: speech bubble tail on left side pointing at image */
.media-explanation::after {
  z-index: 999; /* 👈 This ensures it's above everything else */
  content: '';
  position: absolute;
  top: 20px;
  left: -10px;
  border-width: 10px;
  border-style: solid;
  border-color: transparent rgba(255,255,255,0.15) transparent transparent;
}

.media-explanation.tilt {
  transform: scale(1.07) rotate3d(1, 1, 1, 6deg);
}
