* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    position: relative;
    text-align: center;
    padding: 20px 0 30px;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

header h1 {
    color: #e94560;
    font-size: 2.5rem;
}

.settings-container {
    position: absolute;
    top: 20px;
    right: 0;
}

.gear-button {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    color: #888;
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s, transform 0.3s;
}

.gear-button:hover {
    color: #e94560;
    transform: rotate(45deg);
}

.settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #16213e;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    min-width: 160px;
    z-index: 100;
    overflow: hidden;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #eee;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: #e94560;
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sync-button {
    background-color: #e94560;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sync-button:hover:not(:disabled) {
    background-color: #ff6b6b;
}

.sync-button:disabled {
    background-color: #666;
    cursor: not-allowed;
}

.status-text {
    color: #aaa;
    font-size: 0.9rem;
}

.progress-text {
    color: #e94560;
    font-weight: bold;
}

.stats {
    margin-bottom: 20px;
    color: #888;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.movie-card {
    background-color: #16213e;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(233, 69, 96, 0.2);
}

.poster-container {
    position: relative;
    aspect-ratio: 2/3;
    background-color: #0f0f23;
}

.poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-poster {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.9rem;
}

.score {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.85rem;
}

.score-high {
    background-color: #21ba45;
    color: white;
}

.score-medium {
    background-color: #f2c037;
    color: #333;
}

.score-low {
    background-color: #db2828;
    color: white;
}

.heart-button {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 1.8rem;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    color: #ff4757;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
}

.heart-button:hover:not(:disabled) {
    transform: scale(1.2);
    background: rgba(255, 71, 87, 0.2);
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
    animation: heartbeat 0.6s ease-in-out infinite;
}

.heart-button.liked {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.3);
    border-color: #ff4757;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.6);
    cursor: default;
    text-shadow: 0 0 15px rgba(255, 71, 87, 0.8);
}

.heart-button:disabled {
    opacity: 1;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1.2); }
    50% { transform: scale(1.35); }
}

.movie-info {
    padding: 15px;
}

.movie-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.release-date {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
}

.origin-country {
    font-size: 0.8rem;
    color: #aaa;
    margin: 4px 0;
    font-style: italic;
}

.genres {
    font-size: 0.8rem;
    color: #aaa;
    margin: 4px 0;
}

.description {
    font-size: 0.85rem;
    color: #aaa;
    line-height: 1.4;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state p {
    font-size: 1.1rem;
}

@media (max-width: 600px) {
    .movie-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Movie Details Page */
.movie-details {
    max-width: 1000px;
    margin: 0 auto;
}

.back-button {
    background-color: #333;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 30px;
    transition: background-color 0.2s;
}

.back-button:hover {
    background-color: #444;
}

.movie-content {
    display: flex;
    gap: 40px;
}

.poster-section {
    flex-shrink: 0;
}

.detail-poster {
    width: 300px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.no-poster-large {
    width: 300px;
    height: 450px;
    background-color: #16213e;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 1rem;
}

.info-section {
    flex: 1;
}

.movie-name {
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 10px;
}

.info-section .release-date {
    font-size: 1rem;
    color: #888;
    margin-bottom: 20px;
}

.genres-info {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 15px;
}

.score-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.score-label {
    font-size: 1rem;
    color: #aaa;
}

.score-value {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1rem;
}

.trailer-section {
    margin-bottom: 25px;
}

.trailer-section h2 {
    font-size: 1.3rem;
    color: #e94560;
    margin-bottom: 15px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.description-section h2 {
    font-size: 1.3rem;
    color: #e94560;
    margin-bottom: 15px;
}

.full-description {
    font-size: 1.1rem;
    color: #ccc;
    line-height: 1.8;
}

.loading {
    text-align: center;
    padding: 60px;
    font-size: 1.2rem;
    color: #888;
}

@media (max-width: 768px) {
    .movie-content {
        flex-direction: column;
        align-items: center;
    }

    .detail-poster,
    .no-poster-large {
        width: 250px;
        height: auto;
    }

    .movie-name {
        font-size: 1.8rem;
        text-align: center;
    }

    .info-section .release-date {
        text-align: center;
    }

    .score-section {
        justify-content: center;
    }
}

/* Page Transition Overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0);
    z-index: 9999;
    transition: background 0.5s ease;
}

.page-transition-overlay.active {
    background: rgba(10, 10, 20, 0.95);
}

.page-transition-overlay.fade-out {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.page-transition-poster {
    position: fixed;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: top 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Detail page entrance */
.detail-fade-in {
    animation: detailFadeIn 0.4s ease-out 0.1s both;
}

@keyframes detailFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
