/* =============================================================================
   style.css — Dark mode theme with Discord blurple (#5865F2) accent.
   Responsive via Flexbox. Mobile-first.
============================================================================= */

/* ---------- Design tokens ---------- */
:root {
    --bg:            #1e1f22;   /* app background            */
    --bg-elevated:   #2b2d31;   /* cards / navbar            */
    --bg-input:      #1e1f22;   /* form inputs               */
    --bg-input-focus:#232428;
    --border:        #3f4147;   /* subtle borders            */
    --text:          #f2f3f5;   /* primary text              */
    --text-muted:    #b5bac1;   /* secondary text            */
    --text-dim:      #949ba4;   /* hints / footnotes         */

    --accent:        #5865f2;   /* Discord blurple           */
    --accent-hover:  #4752c4;
    --accent-soft:   rgba(88, 101, 242, 0.15);

    --success:       #248046;
    --success-bg:    rgba(36, 128, 70, 0.15);
    --error:         #da373c;
    --error-bg:      rgba(218, 55, 60, 0.12);

    --radius:        10px;
    --radius-sm:     7px;
    --shadow:        0 8px 24px rgba(0, 0, 0, 0.35);
}

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

html, body { height: 100%; }

body {
    font-family: "gg sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =============================================================================
   Buttons
============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    padding: 11px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color .15s ease, transform .05s ease, border-color .15s ease;
    text-decoration: none;
    line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-discord { background: var(--accent); color: #fff; width: 100%; padding: 13px 20px; font-size: 16px; }
.btn-discord:hover { background: var(--accent-hover); }

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-input-focus); border-color: var(--accent); }

.btn-sm { padding: 8px 14px; font-size: 14px; }

/* =============================================================================
   Login page
============================================================================= */
.login-body {
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(88,101,242,0.18), transparent 60%),
        var(--bg);
}

.login-card {
    background: var(--bg-elevated);
    padding: 40px 34px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    text-align: center;
    margin: 20px;
    border: 1px solid var(--border);
}
.login-logo { margin-bottom: 14px; }
.login-card h1 { font-size: 26px; margin-bottom: 8px; }
.login-subtitle { color: var(--text-muted); font-size: 15px; margin-bottom: 26px; }
.login-footnote { color: var(--text-dim); font-size: 13px; margin-top: 18px; }

/* =============================================================================
   Navbar / header
============================================================================= */
.navbar {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.navbar-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
}
.user-area { display: flex; align-items: center; gap: 14px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    object-fit: cover;
}
.username { font-weight: 600; font-size: 15px; }

/* =============================================================================
   Layout / cards
============================================================================= */
.container {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 20px;
}
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.card-title { font-size: 22px; margin-bottom: 6px; }
.card-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }

/* =============================================================================
   Forms
============================================================================= */
.report-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }

label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--text-muted);
}
.req { color: var(--error); }
.optional { color: var(--text-dim); text-transform: none; font-weight: 500; }

input[type="text"],
input[type="url"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
input[readonly] { color: var(--text-muted); cursor: not-allowed; }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 120px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b5bac1' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 38px;
}

.hint { color: var(--text-dim); font-size: 12.5px; }
.form-actions { margin-top: 6px; }

/* =============================================================================
   Alerts
============================================================================= */
.alert {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: #7fe0a0; }
.alert-error   { background: var(--error-bg);   border-color: var(--error);   color: #ff9ea1; }

/* =============================================================================
   Footer
============================================================================= */
.site-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* =============================================================================
   Responsive
============================================================================= */
@media (max-width: 540px) {
    .navbar-inner { flex-direction: row; }
    .username { display: none; }        /* keep header compact on small screens */
    .card { padding: 20px; }
    .login-card { padding: 30px 22px; }
    .container { padding: 20px 14px; }
}

/* =============================================================================
   Dashboard: tool header, main menu, three-form flow, IMDB search, messages
   (ported layout from the legacy single-file tool, restyled to the dark theme)
============================================================================= */

/* ---- Tool header inside the card ---- */
.tool-header { margin-bottom: 24px; }
.tool-header .card-title { margin-bottom: 6px; }
.tool-header .card-desc { color: var(--text-muted); font-size: 15px; }

/* ---- Utility: hide/show elements toggled by JS ---- */
.hidden { display: none !important; }

/* ---- Main menu of report types ---- */
.menu-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.menu-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .05s ease;
}
.menu-btn:hover {
    border-color: var(--accent);
    background: var(--bg-input-focus);
}
/* Highlight the selector whose panel is currently expanded (accordion open). */
.menu-btn.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent-soft) inset;
}
.menu-btn:active { transform: translateY(1px); }
.menu-btn .icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

/* ---- Individual report forms ---- */
.form-section { display: block; }
.form-section > h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text);
}
.form-section .form-group { margin-bottom: 16px; }

/* ---- IMDB search row ---- */
.search-group { margin-bottom: 16px; }
.search-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.search-row input { flex: 1; }
.search-btn { white-space: nowrap; flex-shrink: 0; }

/* ---- IMDB search results ---- */
.search-results { margin: 4px 0 16px; }
.search-results > h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}
/* CHANGED: .result-item is now a flex row (text on the left, "View on IMDb"
   link on the right) and acts as the positioning context for the hover
   preview popup. */
.result-item {
    position: relative;                 /* anchor for the .result-preview popup */
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;                    /* requirement #3: pointer cursor */
    transition: border-color .15s ease, background .15s ease,
                box-shadow .15s ease, transform .05s ease;
}
/* CHANGED: stronger, clearer hover feedback (requirement #3) — accent border,
   subtle glow, and a slight lift so it's obvious the row is clickable. */
.result-item:hover,
.result-item:focus-visible {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 2px var(--accent-soft);
    outline: none;
}
.result-item h4 { font-size: 15px; color: var(--text); margin-bottom: 2px; }
.result-item p  { font-size: 13px; color: var(--text-dim); }
/* Underline the title on hover as an extra "this is interactive" cue. */
.result-item:hover h4,
.result-item:focus-visible h4 { text-decoration: underline; }

/* NEW: the text block grows to fill the row so the IMDb link sits at the right. */
.result-info { flex: 1 1 auto; min-width: 0; }

/* NEW: "View on IMDb ↗" link — a distinct, clickable pill on the right. */
.result-imdb-link {
    flex-shrink: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 5px 11px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.result-imdb-link:hover,
.result-imdb-link:focus-visible {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    text-decoration: none;
    outline: none;
}

/* =============================================================================
   NEW (requirement #1): Hover poster preview popup
   - Hidden by default; appears when the row is hovered/focused.
   - Positioned to the LEFT of the row so it doesn't cover other results.
   - pointer-events:none so it never blocks clicks on the row/link.
============================================================================= */
.result-preview {
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);           /* float to the left of the row */
    transform: translateY(-50%) scale(0.96);
    width: 130px;
    height: auto;
    max-height: 190px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--accent);
    box-shadow: var(--shadow);
    background: var(--bg-elevated);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;               /* never obstruct clicks/hover */
    z-index: 20;
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.result-item:hover .result-preview,
.result-item:focus-within .result-preview {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

/* On narrow screens there's no room to the left, so show the preview ABOVE
   the row instead (still without pushing other results around). */
@media (max-width: 640px) {
    .result-preview {
        top: auto;
        bottom: calc(100% + 8px);
        right: auto;
        left: 14px;
        transform: translateY(6px) scale(0.96);
        width: 110px;
        max-height: 160px;
    }
    .result-item:hover .result-preview,
    .result-item:focus-within .result-preview {
        transform: translateY(0) scale(1);
    }
}
.result-selected {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
}

/* ---- Checkbox group ("This is a Series") ---- */
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text);
}
.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---- Button row (submit + back) ---- */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}
.button-group .submit-btn { flex: 1; }

/* ---- Success / error result panels ---- */
.message {
    text-align: center;
    padding: 32px 24px;
    border-radius: var(--radius);
    border: 1px solid transparent;
}
.message h3 { font-size: 22px; margin-bottom: 10px; }
.message p  { color: var(--text-muted); margin-bottom: 22px; }
.message.success {
    background: var(--success-bg);
    border-color: var(--success);
}
.message.success h3 { color: #7fe0a0; }
.message.error {
    background: var(--error-bg);
    border-color: var(--error);
}
.message.error h3 { color: #ff9ea1; }

/* ---- Inline status text (search states) ---- */
.muted { color: var(--text-muted); font-size: 14px; }
.err   { color: #ff9ea1; font-size: 14px; }

/* ---- Small-screen tweaks for the new UI ---- */
@media (max-width: 540px) {
    .search-row   { flex-direction: column; }
    .button-group { flex-direction: column; }
    .menu-btn     { font-size: 15px; padding: 16px; }
}
