/* ==========================================================================
   Social Save Movies — main stylesheet
   Mobile-first. Light premium theme — ivory surfaces, gold/wine accents.
   ========================================================================== */

:root {
    --bg: #faf7f0;
    --bg-elevated: #f3ecdd;
    --bg-card: #ffffff;
    --text: #2b241d;
    --text-muted: #7a6f5f;
    --accent: #b8892e;
    --accent-2: #8a2f3d;
    --gradient: linear-gradient(90deg, var(--accent), var(--accent-2));
    --border: rgba(43,36,29,0.12);
    --radius: 14px;
    --shadow: 0 10px 30px rgba(43,36,29,0.10);
    --shadow-hover: 0 16px 36px rgba(184,137,46,0.28);
    --max-width: 1280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.skip-link {
    position: absolute; left: -999px; top: 0;
    background: var(--accent); color: #fff; padding: 8px 16px; z-index: 1000;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------------- Header ---------------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(250,247,240,0.85);
    border-bottom: 1px solid var(--border);
}
/* backdrop-filter lives on a pseudo-element rather than .site-header itself —
   filter/backdrop-filter on an element makes it a containing block for any
   position:fixed descendant, which was trapping the mobile nav's full-screen
   overlay inside the 64px-tall header instead of the viewport. */
.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.site-header__inner {
    display: flex; align-items: center; gap: 16px;
    height: 64px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand__mark {
    background: var(--gradient); color: #fff; width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 0.85rem;
}
.brand__name em { color: var(--accent); font-style: normal; }

.main-nav { display: none; gap: 20px; margin-left: 12px; }
.main-nav a { text-decoration: none; color: var(--text-muted); font-size: 0.92rem; white-space: nowrap; }
.main-nav a:hover { color: var(--text); }

.header-search { position: relative; display: none; flex: 1; max-width: 340px; margin-left: auto; }
.header-search input {
    width: 100%; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 999px; padding: 8px 40px 8px 14px; color: var(--text); font-size: 0.9rem;
}
.header-search button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; }
.search-suggestions {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); z-index: 50;
}
.search-suggestions a { display: flex; gap: 10px; padding: 8px 12px; text-decoration: none; align-items: center; }
.search-suggestions a:hover { background: var(--bg-card); }
.search-suggestions img { width: 32px; height: 48px; object-fit: cover; border-radius: 4px; }

.hamburger {
    display: flex; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; margin-left: auto;
}
.hamburger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

@media (min-width: 960px) {
    .main-nav { display: flex; }
    .header-search { display: flex; }
    .hamburger { display: none; }
}

.main-nav.open {
    display: flex; flex-direction: column; position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--bg); padding: 24px; gap: 18px; z-index: 99; overflow-y: auto;
}
.main-nav.open a { font-size: 1.1rem; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-block; padding: 11px 22px; border-radius: 999px; text-decoration: none;
    font-weight: 600; font-size: 0.92rem; cursor: pointer; border: none;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 20px rgba(184,137,46,0.25); }
.btn--primary:hover { box-shadow: var(--shadow-hover); }
.btn--ghost { background: rgba(43,36,29,0.06); color: var(--text); backdrop-filter: blur(6px); }
.btn--ghost:hover { background: rgba(184,137,46,0.14); }
.btn--outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--full { width: 100%; text-align: center; margin-top: 10px; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.badge--accent { background: var(--gradient); color: #fff; }

/* ---------------- Hero ---------------- */
.hero, .movie-hero {
    position: relative;
    background-image: var(--hero-bg);
    background-size: cover; background-position: center top;
    padding: 90px 0 60px;
}
.hero__overlay {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(250,247,240,0.35) 0%, rgba(250,247,240,0.88) 70%, var(--bg) 100%);
}
.hero__content, .movie-hero__content { position: relative; z-index: 2; }
.hero__title { font-size: clamp(1.8rem, 5vw, 3rem); margin: 10px 0; }
.hero__meta { display: flex; gap: 14px; color: var(--text-muted); margin-bottom: 12px; }
.hero__overview { max-width: 640px; color: var(--text-muted); margin-bottom: 22px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.rating { color: var(--accent-2); font-weight: 700; }

/* ---------------- Movie rows / carousels ---------------- */
.movie-row { margin: 34px 0; }
.movie-row__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.movie-row__header h2 { font-size: 1.3rem; margin: 0; }
.see-all { color: var(--accent-2); text-decoration: none; font-size: 0.85rem; font-weight: 600; }

.movie-carousel {
    display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.movie-carousel::-webkit-scrollbar { height: 6px; }
.movie-carousel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.movie-carousel .movie-card { flex: 0 0 150px; scroll-snap-align: start; }

.movie-card { text-decoration: none; color: var(--text); display: block; }
.movie-card__poster {
    position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg-card);
    aspect-ratio: 2/3; box-shadow: var(--shadow); transition: transform .25s ease, box-shadow .25s ease;
    border: 1px solid var(--border);
}
.movie-card:hover .movie-card__poster { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.movie-card__poster img { width: 100%; height: 100%; object-fit: cover; }
.movie-card__rating {
    position: absolute; bottom: 8px; left: 8px; background: rgba(250,247,240,0.9); backdrop-filter: blur(4px);
    padding: 3px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; color: var(--accent-2);
    border: 1px solid var(--border);
}
.movie-card__title { transition: color .2s ease; }
.movie-card:hover .movie-card__title { color: var(--accent-2); }
.movie-card__title { font-size: 0.88rem; margin: 8px 0 2px; line-height: 1.3; }
.movie-card__year { color: var(--text-muted); font-size: 0.78rem; }

/* ---------------- Grid layouts ---------------- */
.movie-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 20px 0 32px;
}
@media (min-width: 600px) { .movie-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .movie-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1140px) { .movie-grid { grid-template-columns: repeat(5, 1fr); } }

/* ---------------- Genre grid/pills ---------------- */
.genre-grid-section { padding: 40px 0; background: var(--bg-elevated); margin-top: 20px; }
.genre-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.genre-pill, .tag {
    background: var(--bg-card); border: 1px solid var(--border); padding: 8px 16px; border-radius: 999px;
    text-decoration: none; font-size: 0.85rem; color: var(--text);
    transition: border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.genre-pill:hover, .tag:hover { border-color: var(--accent); color: var(--accent-2); box-shadow: 0 6px 16px rgba(184,137,46,0.18); transform: translateY(-1px); }
.tag.active { background: var(--gradient); color: #fff; border-color: transparent; }
.tag-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 32px; }

.search-cta { text-align: center; padding: 50px 16px; }
.search-cta p { color: var(--text-muted); margin-bottom: 18px; }

/* ---------------- Listing layout ---------------- */
.page-header { padding: 28px 0 10px; }
.page-header h1 { margin: 6px 0 0; font-size: 1.8rem; }
.breadcrumbs { font-size: 0.82rem; color: var(--text-muted); }
.breadcrumbs a { text-decoration: none; color: var(--text-muted); }
.breadcrumbs span { color: var(--text); }

.listing-layout { display: block; gap: 30px; padding-bottom: 40px; }
@media (min-width: 900px) { .listing-layout { display: grid; grid-template-columns: 220px 1fr; } }
.listing-sidebar h3 { font-size: 1rem; margin-bottom: 10px; }
.genre-list { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 900px) { .genre-list { display: block; } .genre-list li { margin-bottom: 6px; } }
.genre-list a { text-decoration: none; color: var(--text-muted); font-size: 0.88rem; padding: 6px 12px; border-radius: 8px; display: inline-block; }
.genre-list a.active, .genre-list a:hover { background: var(--bg-card); color: var(--accent-2); }

.empty-state { color: var(--text-muted); padding: 40px 0; text-align: center; }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 40px; }
.pagination a {
    text-decoration: none; padding: 8px 14px; border-radius: 8px; background: var(--bg-card);
    color: var(--text-muted); font-size: 0.85rem; border: 1px solid var(--border);
    transition: border-color .2s ease, color .2s ease, transform .2s ease;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent-2); transform: translateY(-1px); }
.pagination a.active { background: var(--gradient); color: #fff; border-color: transparent; }

/* ---------------- Search page ---------------- */
.big-search-form { display: flex; gap: 10px; margin: 16px 0 8px; max-width: 500px; }
.big-search-form input {
    flex: 1; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text); font-size: 0.95rem;
}
.results-count { color: var(--text-muted); margin: 16px 0; }

/* ---------------- Movie detail ---------------- */
.movie-hero__content { display: flex; flex-direction: column; gap: 20px; }
.movie-hero__poster { border-radius: var(--radius); box-shadow: var(--shadow); width: 180px; }
@media (min-width: 720px) {
    .movie-hero__content { flex-direction: row; align-items: flex-end; }
    .movie-hero__poster { width: 240px; }
}
.movie-hero__info h1 { margin: 8px 0 4px; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.muted { color: var(--text-muted); font-weight: 400; }
.tagline { color: var(--text-muted); font-style: italic; margin: 4px 0; }
.movie-meta { display: flex; gap: 16px; margin: 10px 0; color: var(--text-muted); flex-wrap: wrap; }
.genre-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.overview { color: var(--text-muted); max-width: 700px; margin: 14px 0; }
.movie-hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

.movie-details-grid { display: block; gap: 34px; padding: 30px 0 50px; }
@media (min-width: 960px) { .movie-details-grid { display: grid; grid-template-columns: 1fr 300px; } }
.crew-line { margin-bottom: 8px; color: var(--text-muted); }
.crew-line strong { color: var(--text); }

.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; margin: 16px 0 30px; }
.cast-card { text-align: center; font-size: 0.82rem; }
.cast-card img { border-radius: var(--radius); aspect-ratio: 2/3; object-fit: cover; margin-bottom: 6px; background: var(--bg-card); }
.cast-card span { color: var(--text-muted); display: block; font-size: 0.76rem; }

.info-box { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.info-box h3 { margin-top: 0; }
.info-box dl { margin: 0; }
.info-box dt { color: var(--text-muted); font-size: 0.78rem; margin-top: 10px; }
.info-box dd { margin: 2px 0 0; font-size: 0.92rem; }
.provider-label { font-weight: 600; margin: 12px 0 6px; }
.provider-logos { display: flex; gap: 8px; flex-wrap: wrap; }
.provider-logos img { border-radius: 8px; }

/* ---------------- Watch page ---------------- */
.watch-movie-summary { display: flex; gap: 18px; margin: 20px 0 30px; align-items: flex-start; }
.watch-movie-summary img { border-radius: var(--radius); width: 120px; flex-shrink: 0; }
.provider-grid { display: flex; flex-wrap: wrap; gap: 16px; margin: 14px 0 24px; }
.provider-card { text-align: center; font-size: 0.8rem; color: var(--text-muted); }
.provider-card img { border-radius: 10px; margin-bottom: 6px; }
.disclaimer-note { color: var(--text-muted); font-size: 0.82rem; margin: 20px 0; }

/* ---------------- Person page ---------------- */
.person-header { display: flex; gap: 20px; padding: 30px 0; flex-direction: column; }
@media (min-width: 640px) { .person-header { flex-direction: row; } }
.person-header img { border-radius: var(--radius); width: 160px; }

/* ---------------- Static pages ---------------- */
.static-page { max-width: 760px; padding: 30px 16px 60px; }
.static-page h1 { margin-bottom: 20px; }
.static-page h2 { margin-top: 28px; font-size: 1.15rem; }
.static-page p { color: var(--text-muted); }

/* ---------------- Error pages ---------------- */
.error-page { text-align: center; padding: 100px 16px; }
.error-page__code {
    font-size: 5rem; font-weight: 800; background: var(--gradient); -webkit-background-clip: text;
    background-clip: text; color: transparent; display: block;
}

/* ---------------- Modal (trailer) ---------------- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(43,36,29,0.82); }
.modal__content { position: relative; width: 100%; max-width: 900px; z-index: 2; }
.modal__close { position: absolute; top: -40px; right: 0; background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; transition: color .2s ease; }
.modal__close:hover { color: var(--accent); }
.video-embed { position: relative; width: 100%; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--bg-elevated); border-top: 1px solid var(--border); margin-top: 60px; padding: 40px 0 20px; }
.footer__inner { display: grid; grid-template-columns: 1fr; gap: 30px; }
@media (min-width: 760px) { .footer__inner { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer__brand p { color: var(--text-muted); font-size: 0.85rem; margin-top: 10px; max-width: 320px; }
.footer__col h4 { margin-bottom: 12px; font-size: 0.9rem; }
.footer__col a { display: block; color: var(--text-muted); text-decoration: none; font-size: 0.85rem; margin-bottom: 8px; }
.footer__col a:hover { color: var(--accent-2); }
.footer__bottom { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 20px; font-size: 0.78rem; color: var(--text-muted); }

/* ---------------- Ad slots ---------------- */
.ad-slot { display: flex; align-items: center; justify-content: center; margin: 20px auto; overflow: hidden; }

/* ---------------- Admin ---------------- */
.admin-body { background: var(--bg-elevated); }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: var(--bg-elevated); border-right: 1px solid var(--border); padding: 20px 14px; flex-shrink: 0; display: none; }
.admin-sidebar a { display: block; color: var(--text-muted); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 4px; transition: background .2s ease, color .2s ease; }
.admin-sidebar a.active, .admin-sidebar a:hover { background: var(--bg-card); color: var(--accent-2); }
@media (min-width: 800px) { .admin-sidebar { display: block; } }
.admin-main { flex: 1; padding: 24px 16px 60px; max-width: 1100px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 30px; }
.admin-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: box-shadow .2s ease, transform .2s ease; }
.admin-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.admin-card .value { font-size: 1.8rem; font-weight: 700; margin: 6px 0 0; }
.admin-card .label { color: var(--text-muted); font-size: 0.82rem; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 0.88rem; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.admin-form { max-width: 520px; }
.admin-form label { display: block; margin: 14px 0 6px; font-size: 0.88rem; color: var(--text-muted); }
.admin-form input, .admin-form textarea, .admin-form select {
    width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text); font-size: 0.9rem;
}
.admin-form textarea { min-height: 100px; font-family: monospace; }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; width: 100%; max-width: 380px; }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 16px; }
.alert--error { background: rgba(138,47,61,0.10); color: var(--accent-2); border: 1px solid rgba(138,47,61,0.3); }
.alert--success { background: rgba(77,255,150,0.12); color: #7dffb0; border: 1px solid rgba(77,255,150,0.3); }