* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #2C5F7C 0%, #1a3a4a 100%);
    min-height: 100vh;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

#drama-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.drama-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.drama-card:hover {
    transform: translateY(-10px);
}

.drama-card.expanded {
    transform: scale(1.02);
}
.drama-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: transform 0.3s;
}

.drama-card:hover {
    transform: translateY(-10px);
}

.drama-poster {
    width: 100%;
    height: 350px;
    object-fit: contain;
    background: #f5f5f5;
}

.drama-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.drama-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.drama-details {
    color: #666;
    line-height: 1.6;
    flex: 1;
}

.rating {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 1.1em;
}

.genres {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.genre-tag {
    background: #2C5F7C;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
}
.tmdb-credit {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
}

.tmdb-credit a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.tmdb-credit a:hover {
    text-decoration: underline;
}
.controls-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.controls-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#search-box {
    padding: 8px 12px;
    border-radius: 5px;
    border: 2px solid white;
    background: rgba(255, 255, 255, 0.9);
    color: #2C5F7C;
    font-size: 1em;
    width: 300px;
}

#search-box::placeholder {
    color: #999;
}

.drama-count {
    font-size: 1.1em;
    color: white;
    font-weight: 500;
}

.controls-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    color: white;
}

.control-group label {
    font-weight: 500;
}

.control-group select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #2C5F7C;
    background: white;
    color: #2C5F7C;
    font-size: 1em;
    cursor: pointer;
}

.control-group select:hover {
    background: #f0f0f0;
}
.search-container {
    position: relative;
    width: 300px;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2C5F7C;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #2C5F7C;
}

.autocomplete-item:hover {
    background: #f0f0f0;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.kdrama-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    width: 45px;
    height: 60px;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    z-index: 10;
    clip-path: polygon(0 0, 100% 0, 100% 75%, 50% 100%, 0 75%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
}
.plot-summary {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    line-height: 1.5;
    color: #555;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.drama-card.expanded .plot-summary {
    max-height: 500px;
    padding-bottom: 10px;
}
.drama-card.expanded .expand-indicator {
    display: none;
}
.rating-info {
    cursor: pointer;
    font-size: 1.3em;
    transition: transform 0.2s;
    animation: pulse 2s ease-in-out infinite;
    position: relative;
}

.rating-info:hover {
    transform: scale(1.2);
    animation: none;
}

.rating-info::after {
    content: 'Click for rating scale';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.7em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.rating-info:hover::after {
    opacity: 1;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.rating-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

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

.rating-modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.rating-modal-content h3 {
    color: #2C5F7C;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.rating-modal-content p {
    margin: 10px 0;
    color: #333;
    line-height: 1.6;
    text-align: left;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2em;
    color: #999;
    cursor: pointer;
}

.close-modal:hover {
    color: #333;
}

/* Actor modal styles */
.actor-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

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

.actor-modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.actor-modal-content h3 {
    color: #2C5F7C;
    margin-bottom: 20px;
    font-size: 1.8em;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.actor-profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #2C5F7C;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.close-actor-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2em;
    color: #999;
    cursor: pointer;
}

.close-actor-modal:hover {
    color: #333;
}

.actor-stats {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.actor-stats p {
    margin: 5px 0;
    color: #333;
    font-size: 1.1em;
}

.actor-dramas-list {
    margin-top: 20px;
}

.actor-drama-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.actor-drama-item:hover {
    background-color: #f9f9f9;
}

.actor-drama-item:last-child {
    border-bottom: none;
}

.actor-drama-title {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.actor-drama-rating {
    color: #ff6b6b;
    font-weight: bold;
    margin-left: 15px;
}

/* Clickable actor names */
.actor-name {
    color: #2C5F7C;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.actor-name:hover {
    color: #1a3a4a;
    font-weight: bold;
}