/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ffffff;
    min-height: 100vh;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mood-btn, .add-btn {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 14px;
}

.mood-btn:hover, .add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-bar input, .search-bar select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 12px 20px;
    color: white;
    font-size: 16px;
    flex: 1;
    min-width: 200px;
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-bar select option {
    background: #2d2d2d;
    color: white;
}

/* Movies Grid - List Style */
.movies-container {
    position: relative;
}

.movies-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

/* Alphabetical Section Headers */
.section-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 15px;
    font-size: 1.3rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.movie-card {
    background: transparent;
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 80px;
}

.movie-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.movie-poster {
    width: 69px;
    min-width: 69px;
    height: 104px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.movie-info {
    flex: 1;
    min-width: 0;
}

.movie-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.movie-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.85rem;
    opacity: 0.7;
    flex-wrap: wrap;
}

.movie-meta span {
    white-space: nowrap;
}

.movie-genre {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    display: inline-block;
    font-weight: 500;
}

/* Alphabet Index */
.alphabet-index {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 6px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.alphabet-index a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    text-align: center;
    transition: color 0.2s, transform 0.2s;
    cursor: pointer;
}

.alphabet-index a:hover {
    color: #ff6b6b;
    transform: scale(1.2);
}

.alphabet-index a.active {
    color: #4ecdc4;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
}

.close:hover {
    color: white;
}

/* Mood Selector */
.mood-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.mood-option {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.mood-option:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.mood-option span {
    display: block;
    font-size: 14px;
    font-weight: normal;
    opacity: 0.8;
    margin-top: 8px;
}

/* Add Movie Form */
.add-movie-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.add-movie-form input, .add-movie-form select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px 15px;
    color: white;
    font-size: 16px;
}

.add-movie-form input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-actions button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    flex: 1;
    min-width: 120px;
}

/* Movie Detail */
.movie-detail {
    max-width: 800px;
}

.movie-detail-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.movie-detail-poster {
    flex: 0 0 300px;
    height: 450px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
}

.movie-detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

.movie-detail-info {
    flex: 1;
    min-width: 300px;
}

.movie-detail-info h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.movie-detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.movie-detail-meta span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 14px;
}

.movie-overview {
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        text-align: center;
    }

    .header h1 {
        font-size: 2rem;
    }

    .search-bar {
        flex-direction: column;
    }

    .movie-card {
        padding: 10px 12px;
        gap: 12px;
    }

    .movie-poster {
        width: 58px;
        min-width: 58px;
        height: 86px;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }

    .mood-grid {
        grid-template-columns: 1fr;
    }

    .movie-detail-content {
        flex-direction: column;
    }

    .movie-detail-poster {
        flex: none;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .mood-btn, .add-btn {
        flex: 1;
        min-width: 120px;
        padding: 10px 15px;
        font-size: 12px;
    }

    .movie-card {
        padding: 8px 10px;
        gap: 10px;
    }

    .movie-poster {
        width: 52px;
        min-width: 52px;
        height: 78px;
    }

    .movie-info h3 {
        font-size: 0.95rem;
    }

    .movie-meta {
        font-size: 0.75rem;
    }

    .movie-genre {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.movie-card {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}