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

:root {
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --accent: #e94560;
    --text: #eaeaea;
    --text-muted: #888;
    --border: #0f3460;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.8rem;
}

nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: var(--accent);
}

.nav-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

button, input, select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
}

button {
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="search"] {
    flex: 1;
    max-width: 400px;
}

/* Graph */
#graph-container {
    background: var(--bg-card);
    border-radius: 12px;
    height: 600px;
    overflow: hidden;
}

#graph-svg {
    width: 100%;
    height: 100%;
}

.node-movie { fill: var(--accent); }
.node-person { fill: #4CAF50; }
.node-genre { fill: #2196F3; }

.link {
    stroke: var(--border);
    stroke-opacity: 0.6;
}

.node-label {
    font-size: 10px;
    fill: var(--text);
    pointer-events: none;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.movie-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.movie-card:hover {
    transform: scale(1.05);
}

.movie-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
}

.movie-card .no-poster {
    width: 100%;
    aspect-ratio: 2/3;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.movie-card h4 {
    padding: 10px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* List */
.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.person-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.person-card:hover {
    background: var(--border);
}

.person-card img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.person-card .no-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.person-card .info {
    flex: 1;
}

.person-card .count {
    color: var(--accent);
    font-weight: bold;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent);
}

.top-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.top-list {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

.top-list h3 {
    margin-bottom: 15px;
}

.top-list ul {
    list-style: none;
}

.top-list li {
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.top-list li:last-child {
    border-bottom: none;
}

.top-list .count {
    color: var(--accent);
}

.sync-status {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

.sync-status h3 {
    margin-bottom: 15px;
}

#sync-info {
    margin-bottom: 15px;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--accent);
    background: none;
}

.movie-detail {
    display: flex;
    gap: 20px;
}

.movie-detail img {
    width: 150px;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.movie-detail .info h2 {
    margin-bottom: 10px;
}

.movie-detail .overview {
    color: var(--text-muted);
    margin: 15px 0;
    line-height: 1.6;
}

.movie-detail .credits {
    margin-top: 20px;
}

.movie-detail .credits h4 {
    margin-bottom: 5px;
    color: var(--text-muted);
}

.movie-detail .credits ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.movie-detail .credits li {
    background: var(--border);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

#graph-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}
