/* Character Panel Styles */

#character-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 35vw; /* Desktop width - 35% of screen */
  height: 100vh;
  background: rgba(0, 0, 0, 0.1);  /* More translucent background */
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255,255,255,0.2)!important;
  border-top-right-radius: 15px;
  border-bottom-right-radius: 15px;
  z-index: 1100; /* Increased z-index to appear above chat */
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 20px rgba(0, 0, 0, 0.08);
  transform: translateX(-100%); /* Initially hidden, slides in from left */
  overflow: hidden; /* Prevent content from spilling out */
  /* Force hide scrollbars */
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

/* Force hide scrollbar on main panel */
#character-panel::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* Class for when panel is opened */
#character-panel.panel-visible {
  transform: translateX(0); /* Show panel by sliding in from left */
}

.panel-drag-area {
  width: 100%;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-top-right-radius: 15px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  position: relative;
  z-index: 1001; /* Ensure it's above other content */
  transition: background-color 0.2s ease;
}

.panel-drag-area:hover {
  background: rgba(255, 255, 255, 0.2);
}

.panel-drag-area:active {
  cursor: grabbing;
  background: rgba(255, 255, 255, 0.3);
}

.panel-header {
  padding: 15px;
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  text-align: center;
}

.panel-header span {
  font-size: 1.2rem;
  color: white;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.panel-buttons {
  display: flex;
  justify-content: space-around;
  padding: 15px;
  gap: 10px;
}

.panel-button {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.panel-button:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.panel-button.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.panel-content {
  display: none;
  flex: 1;
  overflow-y: auto; /* Changed back to auto to enable scrolling */
  height: calc(100% - 60px); /* Just adjusting for header */
  max-height: 100vh; /* Take full viewport height */
  /* Hide scrollbar while keeping functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.panel-content::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Edge */
  width: 0 !important;
  height: 0 !important;
}

.panel-content.active {
  display: block;
}

/* Character Selection Styles */
.character-carousel {
  padding: 15px;
  max-height: calc(100vh - 80px); /* Adjust to use available space in panel, accounting for header */
  height: 100%; /* Ensure full height available */
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
  /* Hide scrollbar while keeping functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.character-carousel::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Edge */
  width: 0 !important;
  height: 0 !important;
}

/* Comprehensive scrollbar hiding for all elements within character panel */
#character-panel::-webkit-scrollbar,
#character-panel *::-webkit-scrollbar,
#character-panel div::-webkit-scrollbar,
#character-panel .panel-content::-webkit-scrollbar,
#character-panel .character-carousel::-webkit-scrollbar,
#character-panel .character-grid::-webkit-scrollbar,
#character-panel .category-content::-webkit-scrollbar,
#character-panel .field-section::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

#character-panel,
#character-panel *,
#character-panel div,
#character-panel .panel-content,
#character-panel .character-carousel,
#character-panel .character-grid,
#character-panel .category-content,
#character-panel .field-section {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.field-section {
  margin-bottom: 20px;
}

.field-title {
  color: black; /* var(--gold-light) */
  margin-bottom: 15px;
  font-size: 1.1rem;
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-block;
  /*border-left: 3px solid var(--gold-light, #d2aa36);*/
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Fixed 2 columns as requested */
  gap: 15px;
  justify-content: center;
}

.character-item {
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  height: 180px; /* Fixed height for all character cards */
  min-height: 180px; /* Ensuring minimum height */
  max-height: 180px; /* Ensuring maximum height */
  padding: 10px;
  background: rgba(58,65,73, 1);
  border-radius: 12px;
  border: 2px solid rgba(58,65,73, 0.3) !important;
  box-sizing: border-box; /* Ensure padding is included in width/height */
}

.character-item:hover {
  transform: scale(1.05);
  background: rgba(58,65,73, 1);
}

/* Character media container for video/image */
.character-media {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.character-image {
  width: 100px; /* Consistent size for all images */
  height: 100px; /* Consistent size for all images */
  min-width: 100px; /* Enforce minimum width */
  min-height: 100px; /* Enforce minimum height */
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  margin: 0 auto;
  flex-shrink: 0; /* Prevent image from shrinking */
}

.character-name {
  font-size: 0.85em; /* Reduced from 1.1em to 0.85em */
  color: black; /* white */
  margin: 12px 0 0 0;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); /* Added text shadow for better visibility */
  width: 100%; /* Full width */
  max-width: 100%;
  /* Force text wrapping - never hide text */
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  word-wrap: break-word;
  word-break: break-word;
  height: auto; /* Auto height to accommodate wrapped text */
  line-height: 1.3; /* Better line spacing for wrapped text */
  min-height: auto;
}

.character-tagline {
  font-size: 0.7em; /* Reduced from 0.9em to 0.7em */
  color: white;/* Charcoal gray color */
  margin: 4px 0 0 0;
  opacity: 1; /* Full opacity */
  text-shadow: none; /* No text shadow */
  width: 100%; /* Full width */
  max-width: 100%;
  /* Force text wrapping - never hide text */
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  word-wrap: break-word;
  word-break: break-word;
  height: auto; /* Auto height to accommodate wrapped text */
  line-height: 1.3; /* Better line spacing for wrapped text */
  min-height: auto;
}

/* Category Filter Styles */
.category-filter-container {
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.category-filter-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.category-filter-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.category-filter-btn.active {
  background: rgba(58,65,73, 0.3) !important;
  border-color: rgba(58,65,73, 0.5) !important;
  box-shadow: 0 0 10px rgba(58,65,73, 0.3);
}

/* Responsive adjustments for filter buttons */
@media (max-width: 480px) {
  .category-filter-btn {
    font-size: 0.8rem;
    padding: 5px 10px;
  }
  
  .category-filters {
    gap: 6px;
  }
}

/* Character Panel Toggle Button styles */
#character-panel-toggle {
  cursor: pointer;
  transition: transform 0.3s ease;
   
}

#character-panel-toggle:hover {
  transform: scale(1.15);
}

#character-panel-toggle i {
  font-size: 1.4rem;
}

/* Top Character Panel Toggle Button with hover ring */
#top-character-panel-toggle {
  cursor: pointer;
  transition: all 0.3s ease;
}

#top-character-panel-toggle:hover {
  transform: scale(1.1);
  background-color: rgba(58,65,73, 0.5) !important;
}

#top-character-panel-toggle .hover-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid rgba(58,65,73, 0.0);
  transition: all 0.3s ease;
  z-index: 0;
}

#top-character-panel-toggle:hover .hover-ring {
  border-color: rgba(58,65,73, 0.8);
  box-shadow: 0 0 15px rgba(58,65,73, 0.5);
  transform: scale(1.1);
}

/* Character Info Section */
.character-info-section-inline {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  transition: max-height 0.5s ease, opacity 0.5s ease, padding 0.5s ease;
}

.character-info-section-inline.show {
  max-height: 400px;
  opacity: 1;
  padding: 20px;
}

.character-info {
  font-size: 0.9rem;
  color: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
}

#character-modal-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 15px;
}

.character-info h4 {
  color: #fff;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.character-info p {
  margin-bottom: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.character-info strong {
  color: var(--gold-light);
  margin-right: 5px;
}

/* Responsive styles */
/* Initial character grid setup for large screens */
.character-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr) !important; /* Force 2 columns on all screens */
  gap: 15px;
  justify-content: center;
  margin: 0 auto;
}

/* All mobile devices - combined media query */
@media (max-width: 767px) {
  #character-panel {
    width: 100vw !important; /* Full viewport width */
    min-width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 0 !important; /* Remove rounded corners for edge-to-edge */
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .panel-drag-area {
    border-radius: 0 !important;
  }
  
  .character-carousel {
    padding: 10px 10px 14px; /* Small inner padding only (10-12px as requested) */
    width: 100%;
  }
  
  .character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* Always 2 columns */
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  /* Hide videos on mobile - show only images */
  .character-video {
    display: none !important;
  }
  
  /* Ensure image is always visible on mobile */
  .character-image {
    display: block !important;
  }
  
  /* Character media container for mobile */
  .character-media {
    width: 80px;
    height: auto;
    min-height: 60px;
  }
  
  .character-image {
    width: 80px;
    height: auto !important;
    min-height: 60px;
    max-height: 80px;
    border-radius: 8px !important; /* Rectangle instead of circle on mobile */
    object-fit: contain !important; /* Fit image without cropping */
    min-width: 80px;
  }
  
  .character-item {
    max-width: 100%; /* Full width within grid */
    margin: 0;
    padding: 8px 6px 10px;
    height: auto; /* Allow flexible height on mobile */
    min-height: 140px;
    max-height: none;
  }
}

/* Very small mobile devices */
@media (max-width: 480px) {
  .character-carousel {
    padding: 8px 8px 12px; /* Even smaller inner padding for tiny screens */
  }
  
  .character-grid {
    gap: 8px;
  }
  
  .character-media {
    width: 70px;
    min-height: 52px;
  }
  
  .character-image {
    width: 70px;
    height: auto !important;
    min-height: 52px;
    max-height: 70px;
    min-width: 70px;
    object-fit: contain !important; /* Fit image without cropping */
  }
}

/* For all non-mobile screens (tablet and desktop) */
@media (min-width: 768px) {
  #character-panel {
    width: 45vw; /* Consistent width across all non-mobile screens */
    min-width: 400px;
    max-width: 600px;
  }
  
  /* Make sure images are larger on desktop */
  .character-image {
    width: 100px;
    height: 100px;
  }
  
  .character-info p {
    font-size: 0.85rem;
    text-align: center;
  }

  .character-info-section-inline.show {
    max-height: 400px; 
  }
}

/* Further adjustments for very large screens */
@media (min-width: 1440px) {
  #character-panel {
    width: 40vw; /* Slightly narrower percentage on large screens */
    min-width: 450px;
    max-width: 650px;
  }
}