/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #aaa;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: #764ba2;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    padding: 3rem;
}

/* Modal Left - Image Slider */
.modal-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: sticky;
    top: 3rem;
    align-self: flex-start;
}

.image-slider {
    width: 100%;
    position: relative;
}

.image-slider-viewport {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.image-slider-container {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.image-slider-container img {
    width: 100%;
    object-fit: contain;
    flex-shrink: 0;
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ccc;
    cursor: pointer;
    transition: background-color 0.3s;
}

.dot.active {
    background-color: #764ba2;
}

/* Modal Right - Details */
.modal-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.villain-name {
    font-size: 2rem;
    color: #764ba2;
    font-weight: bold;
}

.villain-work {
    font-size: 1.2rem;
    color: #666;
    margin-top: -1rem;
}

.detail-section {
    border-top: 2px solid #f0f0f0;
    padding-top: 1rem;
}

.detail-section h3 {
    font-size: 1.3rem;
    color: #764ba2;
    margin-bottom: 0.75rem;
}

.description {
    line-height: 1.8;
    color: #333;
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.source {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.keyword.noun {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

.show-more-btn {
    background-color: #f0f0f0;
    border: none;
    border-radius: 20px;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    transition: background-color 0.3s;
}

.show-more-btn:hover {
    background-color: #e0e0e0;
}

#sentimentChart {
    max-width: 400px;
    margin: 1rem auto;
}

.sentiment-result {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 1rem;
    border-radius: 10px;
}

.sentiment-result.positive {
    background: #d4edda;
    color: #155724;
}

.sentiment-result.negative {
    background: #f8d7da;
    color: #721c24;
}

.sentiment-result.neutral {
    background: #d1ecf1;
    color: #0c5460;
}

/* Similar Villains */
.similar-villains {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.similar-card {
    background: #f9f9f9;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.similar-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.similar-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.similar-card .card-info {
    padding: 0.75rem;
    text-align: center;
}

.similar-card .card-name {
    font-weight: bold;
    color: #764ba2;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.similar-card .card-work {
    font-size: 0.8rem;
    color: #666;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-body {
        grid-template-columns: 1fr;
        padding: 2rem 1rem;
    }

    .villain-name {
        font-size: 1.5rem;
    }

    .similar-villains {
        grid-template-columns: 1fr;
    }

    .close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
}

#scrollToTopBtn {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    bottom: 10px;
    left: calc(100% - 90px);
    z-index: 1002;
    border: none;
    outline: none;
    background-color: #ebd6ff;
    color: rgb(20, 9, 25);
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease-in-out, opacity 0.3s ease-in-out, bottom 0.3s ease-in-out, visibility 0.3s;
}

#scrollToTopBtn.visible {
    opacity: 1;
    visibility: visible;
    bottom: 40px;
}

#scrollToTopBtn:hover {
    background-color: #b8c5ff;
}

#scrollToTopBtn svg {
    width: 100%;
    height: 100%;
}
