/* Movie Night — Stylesheet */

:root {
    --bg:         #0d0d0d;
    --bg-card:    #1a1a2e;
    --bg-input:   #16213e;
    --accent:     #e94560;
    --accent-2:   #f5c518;
    --text:       #eee;
    --text-dim:   #999;
    --border:     #2a2a4a;
    --radius:     12px;
    --shadow:     0 4px 24px rgba(0, 0, 0, 0.5);
    --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

a, button, .btn, select {
    touch-action: manipulation;
}

/* ─── Layout ──────────────────────────────── */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ─── Header ──────────────────────────────── */

header {
    text-align: center;
    padding: 2.5rem 0 1.5rem;
    border-bottom: 2px solid var(--accent);
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header .subtitle {
    color: var(--text-dim);
    font-size: 1rem;
    margin-top: 0.25rem;
}

/* ─── Navigation ──────────────────────────── */

nav {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

nav a:hover,
nav a.active {
    color: var(--text);
    background: var(--bg-card);
    border-color: var(--border);
}

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

/* ─── Cards ────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--accent-2);
}

/* ─── Forms ────────────────────────────────── */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    text-decoration: none;
}

.btn:hover {
    background: #ff5a7a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #1e2a4a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-danger {
    background: #c0392b;
}

.btn-danger:hover {
    background: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* ─── Film Grid ────────────────────────────── */

.film-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.film-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
}

.film-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(233, 69, 96, 0.15);
}

.film-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    background: var(--bg-input);
}

.film-card .no-cover {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

.film-card .film-info {
    padding: 0.75rem;
}

.film-card .film-info h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.film-card .film-info .year {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.film-card .film-info .nominator {
    font-size: 0.75rem;
    color: var(--accent-2);
    margin-top: 0.25rem;
}

/* Vote badge */
.film-card .vote-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.film-card .points-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--accent-2);
    color: #000;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ─── Vote Controls ────────────────────────── */

.vote-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.vote-controls select {
    width: 100%;
    padding: 0.5rem 0.35rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font);
    cursor: pointer;
    min-height: 40px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
}

/* ─── Messages ─────────────────────────────── */

.message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.message-success {
    background: #0d2818;
    color: #4ade80;
    border: 1px solid #166534;
}

.message-error {
    background: #2d0f0f;
    color: #f87171;
    border: 1px solid #7f1d1d;
}

.message-info {
    background: #0c1929;
    color: #60a5fa;
    border: 1px solid #1e3a5f;
}

/* ─── State Banner ─────────────────────────── */

.state-banner {
    text-align: center;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.state-nominating {
    background: #0d2818;
    color: #4ade80;
    border: 1px solid #166534;
}

.state-voting {
    background: #1a1a00;
    color: var(--accent-2);
    border: 1px solid #4a4a00;
}

.state-results {
    background: #1a0a1a;
    color: #c084fc;
    border: 1px solid #4a1a4a;
}

/* ─── Results Leaderboard ──────────────────── */

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.leaderboard-item .rank {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-2);
    min-width: 2.5rem;
    text-align: center;
}

.leaderboard-item img {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-input);
}

.leaderboard-item .no-cover-small {
    width: 60px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 4px;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-align: center;
}

.leaderboard-item .info {
    flex: 1;
}

.leaderboard-item .info h3 {
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
}

.leaderboard-item .info .meta {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.leaderboard-item .points {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
    min-width: 3rem;
}

.leaderboard-item .points small {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 400;
}

/* ─── Admin ────────────────────────────────── */

.admin-section {
    border: 1px dashed var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.admin-section h3 {
    color: var(--accent-2);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.admin-section p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ─── Homepage ─────────────────────────────── */

.hero-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.hero-link {
    display: block;
    padding: 2rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.hero-link:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(233, 69, 96, 0.15);
}

.hero-link .emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.hero-link .label {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.hero-link .desc {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ─── Footer ───────────────────────────────── */

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ─── Responsive ──────────────────────────── */

/* Tablet / small desktop */
@media (max-width: 768px) {
    .container {
        padding: 1.25rem 1rem;
    }

    header {
        padding: 1.5rem 0 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .film-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .leaderboard-item {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .leaderboard-item img,
    .leaderboard-item .no-cover-small {
        width: 50px;
        height: 75px;
    }

    .leaderboard-item .rank {
        font-size: 1.25rem;
        min-width: 2rem;
    }

    .leaderboard-item .points {
        font-size: 1.25rem;
        min-width: 2.5rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    header {
        padding: 1.25rem 0 0.75rem;
        margin-bottom: 1.25rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    header .subtitle {
        font-size: 0.85rem;
    }

    /* Navigation — horizontal scrollable pills */
    nav {
        gap: 0.35rem;
        margin-bottom: 1.25rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
        justify-content: flex-start;
    }

    nav a {
        padding: 0.45rem 0.85rem;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Full-width buttons */
    .btn {
        display: block;
        width: 100%;
        text-align: center;
        padding: 0.85rem 1rem;
        font-size: 1rem;
    }

    .btn-small {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Forms */
    input[type="text"],
    input[type="password"] {
        font-size: 16px; /* prevents iOS zoom on focus */
        padding: 0.85rem 0.75rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    /* Film grid — 2 columns max */
    .film-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .film-card .film-info {
        padding: 0.5rem;
    }

    .film-card .film-info h3 {
        font-size: 0.8rem;
    }

    .film-card .film-info .year {
        font-size: 0.7rem;
    }

    .film-card .vote-badge {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
        top: 0.35rem;
        right: 0.35rem;
    }

    .film-card .points-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.45rem;
        top: 0.35rem;
        right: 0.35rem;
    }

    /* Vote selects — bigger touch target */
    .vote-controls {
        padding: 0.35rem;
    }

    .vote-controls select {
        padding: 0.5rem;
        font-size: 0.85rem;
        min-height: 36px;
    }

    /* Hero links — full-width stacked */
    .hero-links {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-top: 1.25rem;
    }

    .hero-link {
        padding: 1.5rem 1rem;
    }

    .hero-link .emoji {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .hero-link .label {
        font-size: 1rem;
    }

    /* Leaderboard — full stack */
    .leaderboard {
        gap: 0.6rem;
    }

    .leaderboard-item {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .leaderboard-item .rank {
        font-size: 1.1rem;
        min-width: 1.75rem;
    }

    .leaderboard-item img,
    .leaderboard-item .no-cover-small {
        width: 44px;
        height: 66px;
    }

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

    .leaderboard-item .info h3 {
        font-size: 0.9rem;
    }

    .leaderboard-item .info .meta {
        font-size: 0.7rem;
    }

    .leaderboard-item .points {
        font-size: 1.1rem;
        min-width: auto;
        padding-left: 0.5rem;
    }

    .leaderboard-item .points small {
        font-size: 0.65rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    /* Admin sections */
    .admin-section {
        padding: 1rem;
    }

    .admin-section h3 {
        font-size: 0.9rem;
    }

    /* Footer */
    footer {
        padding: 1.25rem 0;
        margin-top: 1.5rem;
        font-size: 0.7rem;
    }

    /* State banner */
    .state-banner {
        font-size: 0.8rem;
        padding: 0.6rem;
        margin-bottom: 1rem;
    }

    /* Messages */
    .message {
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }
}
