:root {
    --plex-orange: #e5a00d;
    --plex-black: #0f1011;
    --plex-dark-grey: #1f2326;
    --plex-light-grey: #32373c;
    --text-white: #f9f9f9;
    --text-muted: #a5a7a8;
    --danger-red: #e53935;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--plex-black);
    color: var(--text-white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

main {
    flex-grow: 1;
}

header {
    background-color: rgba(15, 16, 17, 0.95);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--plex-light-grey);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
}

.plex-text { color: var(--plex-orange); }
.request-text { color: var(--text-white); margin-left: 5px; font-weight: 400; }

.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
}

#movie-search {
    width: 100%;
    padding: 12px 20px;
    background-color: var(--plex-dark-grey);
    border: 1px solid var(--plex-light-grey);
    border-radius: 4px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: var(--transition);
}

#movie-search:focus {
    border-color: var(--plex-orange);
    background-color: var(--plex-light-grey);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--plex-dark-grey);
    border: 1px solid var(--plex-light-grey);
    border-radius: 0 0 4px 4px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 1000;
}

.search-item {
    display: flex;
    padding: 10px;
    gap: 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--plex-light-grey);
}

.search-item:hover {
    background-color: var(--plex-light-grey);
}

.search-item img {
    width: 50px;
    height: 75px;
    object-fit: cover;
    border-radius: 2px;
}

.search-item-info h4 { font-size: 14px; margin-bottom: 4px; }
.search-item-info p { font-size: 12px; color: var(--text-muted); }

.request-section { padding: 40px 0; }
.request-section h2 { margin-bottom: 30px; font-weight: 600; }

.requests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
}

@media (max-width: 480px) {
    .requests-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
}

.movie-card {
    background-color: var(--plex-dark-grey);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.movie-card:hover { transform: translateY(-5px); }

.poster-container {
    position: relative;
    aspect-ratio: 2/3;
}

.poster-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upvote-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(229, 160, 13, 0.9);
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.movie-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.movie-info h3 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-upvote, .btn-delete {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid;
    font-size: 13px;
}

.btn-upvote {
    background-color: transparent;
    border-color: var(--plex-orange);
    color: var(--plex-orange);
}

.btn-upvote:hover:not(:disabled) {
    background-color: var(--plex-orange);
    color: white;
}

.btn-upvote:disabled {
    border-color: var(--plex-light-grey);
    color: var(--text-muted);
    cursor: default;
}

.btn-delete {
    background-color: transparent;
    border-color: var(--danger-red);
    color: var(--danger-red);
    margin-top: 5px;
}

.btn-delete:hover {
    background-color: var(--danger-red);
    color: white;
}

.btn-primary {
    background-color: var(--plex-orange);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary {
    background-color: var(--plex-light-grey);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

/* Newsletter Signup */
.newsletter-signup {
    background-color: var(--plex-dark-grey);
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--plex-light-grey);
}

.newsletter-signup h3 {
    margin-bottom: 20px;
}

#subscribe-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

#sub-email {
    padding: 12px;
    background: var(--plex-black);
    border: 1px solid var(--plex-light-grey);
    border-radius: 4px;
    color: white;
    flex-grow: 1;
}

#sub-message {
    margin-top: 15px;
    font-size: 14px;
    color: var(--text-muted);
}

footer {
    padding: 40px 0;
    border-top: 1px solid var(--plex-light-grey);
}

.footer-content {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.admin-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 10px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
}

.btn-link:hover {
    color: var(--plex-orange);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal {
    background: var(--plex-dark-grey);
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    border: 1px solid var(--plex-light-grey);
}

.newsletter-modal textarea {
    width: 100%;
    height: 150px;
    background: var(--plex-black);
    color: #a5a7a8;
    font-family: monospace;
    padding: 10px;
    border: 1px solid var(--plex-light-grey);
    margin: 15px 0;
    font-size: 10px;
    resize: none;
}

#news-status {
    margin: 10px 0;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.hidden { display: none !important; }
.loader { text-align: center; grid-column: 1 / -1; padding: 50px; color: var(--text-muted); }