/* styles.css */
:root {
  --carousel-width: 80%;
  --primary-color: #ffd700;
  --text-color: #e0e0e0;
  --display-font: 'AnimeAce', sans-serif;
  --accent-color: #ff9a8b;
}
@font-face {
  font-family: 'AnimeAce';
  src: url('../fonts/animeace2_reg.ttf') format('truetype');
  src: url('../fonts/animeace2_reg.otf') format('opentype');
}

body {
  font-family: 'AnimeAce', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #b19cd9, #ff9a8b, #fbc2eb, #a1c4fd);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none !important;
  }
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

h1 {
  color: #333;
  text-align: center;
  margin-top: 20px;
  font-size: 4rem; /* Increased font size */
}

/* Carousel Styles */
.carousel {
    width: 80%;
    margin: 0 auto;
    display: block; /* Ensure horizontal layout */
}
.carousel img {
    max-width: 100%; /* Ensure images fit within their container */
    height: auto; /* Maintain aspect ratio */
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    margin: 0 auto;
    border: 5px solid black; /* Changed to solid black */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.19); /* Added drop shadows */
}
.carousel img:hover {
    transform: scale(1.05);
}
.carousel p {
    text-align: center;
    font-size: 15px; /* Reduced to half of the original size */
    color: #555;
    margin-top: 5px;
}

/* Center links */
.center-link {
    display: block;
    text-align: center;
    margin: 10px 0;
    font-size: 1rem;
    color: #007BFF;
    text-decoration: none;
}

.center-link:hover {
    text-decoration: underline;
}

/* Center season titles */
.season-title {
    text-align: center;
    margin: 20px 0;
    font-size: 2.25rem; /* Increased by 1.5 times the original size */
    font-weight: bold;
}

/* Center episode titles */
.episode-title {
    text-align: center;
    margin: 10px 0;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Summary and Lyrics Sections */
.summary, .lyrics, .audio-player {
  width: 80%;
  margin: 0 auto;
}

/* Responsive Design for Mobile */
@media (max-width: 768px) {
    .carousel img {
        max-width: 80%; /* Ensure consistent scaling for mobile */
    }

    .carousel {
        width: 95%; /* Adjust carousel width for smaller screens */
        margin-bottom: 20px; /* Add spacing between carousels */
    }
    
    .carousel .slick-slide > div {
        min-height: 350px; /* Reduce minimum height for mobile */
    }
    
    .carousel .episode-title {
        min-height: 50px; /* Slightly smaller for mobile */
        max-height: 50px;
        font-size: 1.2rem; /* Reduce font size for mobile */
    }
    
    .section {
        padding: 10px; /* Add padding to sections for better spacing */
        border: 1px solid #eee; /* Add a light border around sections */
        border-radius: 5px; /* Round the corners of sections */
        background: rgba(255, 255, 255, 0.8); /* Slightly transparent background */
    }
    h1 {
        font-size: 1.5rem; /* Adjust heading size for smaller screens */
        margin-top: 10px;
    }
    .episode-navigation {
        flex-direction: column;
        gap: 15px;
        padding: 10px;
    }
    
    .episode-navigation .nav-link {
        font-size: 0.9em; /* Slightly smaller font for mobile */
    }
    
    .episode-navigation .nav-image.tiny {
        width: 40px;
        height: 40px;
    }
}

/* Add 2px space between items in the carousel */
.carousel .slick-slide {
    margin: 0 1px; /* Maintain 2px total space between items */
    display: flex;
    flex-direction: column;
    align-items: center; /* Ensure consistent alignment */
    height: auto; /* Allow natural height calculation */
}

.carousel .slick-slide > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: 400px; /* Set consistent minimum height for all slides */
}

.carousel .episode-title {
    min-height: 60px; /* Increase minimum height to accommodate 2-line titles */
    max-height: 60px; /* Set maximum height to prevent excessive growth */
    overflow: hidden; /* Hide overflow if the title is too long */
    text-align: center;
    display: flex;
    align-items: center; /* Vertically center the text */
    justify-content: center; /* Horizontally center the text */
    line-height: 1.2; /* Improve line spacing for multi-line titles */
    padding: 5px; /* Add some padding for better visual spacing */
}

.carousel .episode-title a {
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    line-clamp: 2; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    line-height: 1.2;
}

.carousel img {
    flex-shrink: 0; /* Prevent image from shrinking */
    margin: 10px 0; /* Add consistent margin around images */
}

.carousel p {
    flex-grow: 1; /* Allow description to take remaining space */
    display: flex;
    align-items: flex-start; /* Align description to top of its space */
    margin: 10px 0;
}

.carousel .youtube-link {
    margin-top: auto; /* Push YouTube link to bottom */
    text-decoration: none; /* Remove underline from YouTube links */
}

/* Episode page YouTube link styling */
.watch-video-link {
    text-decoration: none; /* Remove underline from YouTube links */
}

/* Episode Navigation Styling - Matching Hero/Lore Style */
.episode-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 20px;
}

.episode-navigation .nav-link {
    text-decoration: none;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: color 0.3s ease;
}

.episode-navigation .nav-link:hover {
    color: #007bff;
}

.episode-navigation .nav-link.prev {
    justify-self: flex-start;
    text-align: left;
}

.episode-navigation .nav-link.next {
    justify-self: flex-end;
    text-align: right;
}

.episode-navigation .nav-image.tiny {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 10px;
    padding: 5px 5px 0 5px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    border: 2px solid #ddd;
}

.episode-navigation .nav-image.tiny:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
    border-color: #007bff;
}

/* Style for navigation text below images */
.episode-navigation .nav-text {
    display: block;
    text-align: center;
    font-size: 14px;
    margin-top: 5px;
    color: #333;
}

.episode-navigation .nav-link:hover .nav-text {
    color: #007bff;
}

/* Legacy episode navigation image styles - keeping for backwards compatibility */
.episode-navigation img:not(.nav-image) {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid #ddd;
    border-radius: 4px;
    width: 50px;
    height: 50px; /* Fixed height for navigation thumbnails */
    object-fit: cover; /* Crop to fit while maintaining aspect ratio */
    object-position: center; /* Center the image content */
    margin-top: 8px; /* Add top margin */
    display: block;
    margin-left: auto;
    margin-right: auto; /* Center the image */
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.episode-navigation img:not(.nav-image):hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    border-color: #007bff;
}

/* Episode Page Carousel - Uniform Image Heights */
#episode-carousel img {
    width: 100% !important;
    height: 250px !important; /* Fixed height for all carousel images */
    object-fit: cover !important; /* Crop images to fit while maintaining aspect ratio */
    object-position: center !important; /* Center the image content */
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    margin: 0 auto;
    border: 5px solid black;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.19);
}

#episode-carousel img:hover {
    transform: scale(1.05);
}

/* Mobile responsive for episode carousel */
@media (max-width: 768px) {
    #episode-carousel img {
        height: 200px !important; /* Slightly smaller height for mobile */
    }
}

/* About Page Carousel - Matching Episode Carousel Style */
#character-carousel img {
    width: 100% !important;
    height: 250px !important; /* Fixed height for all carousel images */
    object-fit: cover !important; /* Crop images to fit while maintaining aspect ratio */
    object-position: center !important; /* Center the image content */
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    margin: 0 auto;
    border: 5px solid black;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.19);
}

#character-carousel img:hover {
    transform: scale(1.05);
}

/* Mobile responsive for about page carousel */
@media (max-width: 768px) {
    #character-carousel img {
        height: 200px !important; /* Slightly smaller height for mobile */
    }
}

/* Episode carousel container styling */
#episode-carousel {
    margin: 20px 0;
}

#episode-carousel .slick-slide {
    padding: 0 5px; /* Add some spacing between slides */
}

#episode-carousel .slick-slide > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

/* Ensure slick carousel dots and arrows are properly spaced */
#episode-carousel .slick-dots {
    margin-top: 20px;
}

#episode-carousel .slick-prev,
#episode-carousel .slick-next {
    z-index: 1;
}

#episode-carousel .slick-prev {
    left: -30px;
}

#episode-carousel .slick-next {
    right: -30px;
}

/* Episode banner image styling */
.banner-image {
    width: 100%;
    height: 300px !important; /* Ensure consistent banner height */
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Responsive banner for mobile */
@media (max-width: 768px) {
    .banner-image {
        height: 200px !important; /* Smaller banner height for mobile */
    }
}

.about-description {
    max-width: 70%;
    margin: 0 auto;
    text-align: center;
}

/* Hero Link Styles */
.character-link {
    color: #4a47a3;
    text-decoration: none;
    font-weight: bold;
    padding: 2px 4px 2px 0px; /* Remove left padding since we're using inline icon */
    border-radius: 3px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.character-link:before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    background-image: url('/icons/hero-icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
    flex-shrink: 0;
}

.character-link:hover {
    color: #2e2b6b;
    background: rgba(255, 255, 255, 0.2);
    text-decoration: underline;
    transform: translateY(-1px);
}

/* Disambiguation links that point to characters should also show hero icon */
.disambiguation-link[data-conflicts*='"type":"character"'] {
    color: #4a47a3;
    font-weight: bold;
    padding: 4px 6px 4px 20px;
    margin: 3px 2px;
    border-radius: 3px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    line-height: 1.6;
}

.disambiguation-link[data-conflicts*='"type":"character"']:before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url('/icons/hero-icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
}

.disambiguation-link[data-conflicts*='"type":"character"']:hover {
    color: #2e2b6b;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Disambiguation links that point to episodes should also show episode icon */
.disambiguation-link[data-conflicts*='"type":"episode"'] {
    color: #e74c3c;
    font-weight: bold;
    padding: 4px 6px 4px 20px;
    margin: 3px 2px;
    border-radius: 3px;
    transition: all 0.3s ease;
    background: rgba(231, 76, 60, 0.1);
    position: relative;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    line-height: 1.6;
}

.disambiguation-link[data-conflicts*='"type":"episode"']:before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url('/icons/episode-icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
}

.disambiguation-link[data-conflicts*='"type":"episode"']:hover {
    color: #c0392b;
    background: rgba(231, 76, 60, 0.2);
    transform: translateY(-1px);
}

/* Disambiguation links that point to lore should also show lore icon */
.disambiguation-link[data-conflicts*='"type":"lore"'] {
    color: #6a4c93;
    font-weight: bold;
    padding: 4px 6px 4px 20px;
    margin: 3px 2px;
    border-radius: 3px;
    transition: all 0.3s ease;
    background: rgba(106, 76, 147, 0.1);
    position: relative;
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px dotted #6a4c93;
    display: inline-block;
    line-height: 1.6;
}

.disambiguation-link[data-conflicts*='"type":"lore"']:before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url('/icons/lore-icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
}

.disambiguation-link[data-conflicts*='"type":"lore"']:hover {
    color: #4a3269;
    background: rgba(106, 76, 147, 0.2);
}

/* Lore Link Styles */
.lore-link {
    color: #6a4c93;
    text-decoration: none;
    font-weight: bold;
    padding: 2px 4px 2px 18px; /* Add left padding for icon */
    border-radius: 3px;
    transition: all 0.3s ease;
    background: rgba(106, 76, 147, 0.1);
    border-bottom: 1px dotted #6a4c93;
    position: relative;
}

.lore-link:before {
    content: "";
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url('/icons/lore-icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
}

.lore-link:hover {
    color: #4a3269;
    background: rgba(106, 76, 147, 0.2);
    text-decoration: none;
    border-bottom: 1px solid #6a4c93;
    transform: translateY(-1px);
}

/* Episode link styling */
.episode-link {
    color: #e74c3c;
    padding: 2px 4px 2px 18px; /* Add left padding for icon */
    border-radius: 3px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    background: rgba(231, 76, 60, 0.1);
    border-bottom: 1px dotted #e74c3c;
    position: relative;
}

.episode-link:before {
    content: "";
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url('/icons/episode-icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
}

.episode-link:hover {
    color: #c0392b;
    background: rgba(231, 76, 60, 0.2);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Hero Connections Section */
.character-connections {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
}

.character-connections h3 {
    color: #333;
    margin-bottom: 10px;
}

.character-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.character-connection-link {
    display: inline-block;
    padding: 8px 15px;
    background: rgba(74, 71, 163, 0.8);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.character-connection-link:hover {
    background: rgba(46, 43, 107, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Enhanced line-height for content areas with dynamic links */
.episode-summary p,
.lore-description p,
.episode-lyrics em {
    line-height: 1.8 !important;
    margin-bottom: 1em;
}

/* Ensure disambiguation links don't cause overlap */
.disambiguation-link {
    line-height: 1.8;
    display: inline-block;
    margin: 2px 1px;
    vertical-align: baseline;
}

/* Specific spacing for content areas that use simpleSmartLinking */
p:has(.disambiguation-link),
em:has(.disambiguation-link),
div:has(.disambiguation-link) {
    line-height: 1.8 !important;
    padding: 3px 0;
}

/* Fallback for browsers that don't support :has() */
.content-with-links p,
.content-with-links em,
.content-with-links div {
    line-height: 1.8 !important;
    padding: 3px 0;
}

/* Forum Authentication UI Styles */
#forum-auth-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #dee2e6;
    backdrop-filter: blur(10px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    object-fit: cover;
}

.user-name {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.auth-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Related Characters Section */
.related-characters {
    width: 80%;
    margin: 30px auto;
    text-align: center;
}

.related-characters h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2rem;
}

.character-badges-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.character-badge-card {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #007BFF, #0056b3);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.character-badge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    color: white;
    text-decoration: none;
}

@media (max-width: 768px) {
    .character-badges-grid {
        gap: 8px;
    }
    
    .related-characters {
        width: 90%;
    }
    
    .related-characters h2 {
        font-size: 1.5rem;
    }
}