:root {
    --bg: #121016;
    --surface: #1d1922;
    --surface-raised: #28212f;
    --border: #3c3347;
    --text: #f4edf7;
    --muted: #b9afc0;
    --accent: #e66a73;
    --accent-hover: #f47c84;
    --gold: #f3c969;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, #2c2036 0, var(--bg) 42rem);
    color: var(--text);
}

header {
    padding: 1.25rem 1.5rem 1rem;
    background: rgba(18, 16, 22, 0.88);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.22);
}

header h1 {
    margin: 0 0 0.75rem;
    color: var(--gold);
    font-size: clamp(1.15rem, 2.5vw, 1.5rem);
    letter-spacing: -0.02em;
}

nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
nav a:hover { color: var(--gold); }

main { padding: 1.75rem 1.5rem; max-width: 900px; margin: 0 auto; }
a { color: var(--gold); }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; margin-bottom: 1.5rem; }
.filter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-form input, .filter-form select,
.item-form input, .item-form select, .item-form textarea {
    padding: 0.55rem 0.65rem; color: var(--text); background: var(--surface-raised);
    border: 1px solid var(--border); border-radius: 7px; font: inherit;
}
.filter-form input:focus, .filter-form select:focus,
.item-form input:focus, .item-form select:focus, .item-form textarea:focus {
    outline: 2px solid var(--gold); outline-offset: 1px;
}

.add-btn {
    align-self: flex-start; padding: 0.6rem 1rem; color: #211820; background: var(--gold);
    border-radius: 7px; font-weight: 700; text-decoration: none;
}
.add-btn:hover { background: #ffe19a; }

.item-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
    display: flex; flex-direction: column; overflow: hidden; color: inherit; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    text-decoration: none; transition: transform 160ms ease, border-color 160ms ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--gold); }
.card-poster { width: 100%; height: 220px; object-fit: cover; }
.card-body { padding: 1rem; }
.card h3 { margin: 0 0 0.35rem; }
.card .status { color: var(--accent-hover); font-size: 0.85rem; font-weight: 700; margin: 0.2rem 0; }
.card .meta, .card .address, .card .rating { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0; }

.tmdb-search {
    max-width: 500px; margin-bottom: 1.5rem; padding: 1rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px;
}
.tmdb-search input[type="text"] {
    width: 60%; padding: 0.55rem; color: var(--text); background: var(--surface-raised);
    border: 1px solid var(--border); border-radius: 7px;
}
.tmdb-search button, .item-form button, .actions button {
    padding: 0.6rem 1rem; color: white; background: var(--accent); border: none; border-radius: 7px;
    cursor: pointer; font: inherit; font-weight: 700;
}
.tmdb-search button { margin-left: 0.5rem; }
.tmdb-search button:hover, .item-form button:hover, .actions button:hover { background: var(--accent-hover); }

#tmdb-results, #places-results { margin-top: 0.75rem; }
.tmdb-result { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem; cursor: pointer; border-radius: 7px; }
.tmdb-result:hover { background: var(--surface-raised); }
.tmdb-result img { width: 30px; border-radius: 3px; }

.item-form { display: flex; flex-direction: column; gap: 0.45rem; max-width: 500px; }
.item-form label { margin-top: 0.5rem; font-size: 0.9rem; font-weight: 600; }
.item-form button { margin-top: 1rem; padding: 0.75rem; }

.detail-layout { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.detail-poster { width: 220px; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28); }
.actions { display: flex; gap: 1rem; margin-top: 1.5rem; align-items: center; }

@media (max-width: 600px) {
    header { padding: 1rem; }
    main { padding: 1rem; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .filter-form { flex-direction: column; }
    .filter-form input, .filter-form select, .filter-form button { width: 100%; font-size: 1rem; padding: 0.65rem; }
    .add-btn { text-align: center; }
    .item-grid { grid-template-columns: 1fr; }
    .card-poster { height: 180px; }
    .detail-layout { flex-direction: column; }
    .detail-poster { width: 100%; max-width: 280px; }
    .item-form { max-width: 100%; }
    .item-form input, .item-form select, .item-form textarea { font-size: 16px; }
    .actions { flex-wrap: wrap; }
}
