/* ═══════════════════════════════════════════════════════════
   AniFinder — index page
   Two states: hero (centered) → chat (bottom input)
   ═══════════════════════════════════════════════════════════ */

/* Override layout.html main so we control the full height */
main {
    padding: 0;
    justify-content: flex-start;
    align-items: stretch;
    position: relative;
    height: calc(100vh - 70px); /* minus header */
    overflow: hidden;
}

/* ── State containers ─────────────────────────────────────── */
.hero-state,
.chat-state {
    position: absolute;
    inset: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* HERO: visible by default, centered */
.hero-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.hero-state.hidden {
    opacity: 0;
    transform: translateY(-30px);
    pointer-events: none;
}

/* CHAT: hidden by default */
.chat-state {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    overflow-y: auto;
    padding: 16px 20px 160px; /* bottom clears input bar */
    display: flex;
    flex-direction: column;
}

.chat-state.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.chat-state::-webkit-scrollbar { width: 4px; }
.chat-state::-webkit-scrollbar-thumb { background: rgba(233,69,96,0.3); border-radius: 4px; }

/* ── Hero content ─────────────────────────────────────────── */
.hero-content {
    max-width: 720px;
    text-align: center;
}

.hero-content h1 {
    font-size: 3.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, #e94560 60%, #0f3460 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.15;
}

.hero-content p {
    font-size: 1.2rem;
    color: #b8b8b8;
    margin-bottom: 32px;
    line-height: 1.6;
}

/* ── Example pills ────────────────────────────────────────── */
.hero-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}

.example-pill {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(233,69,96,0.3);
    color: #e0e0e0;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-pill:hover {
    background: rgba(233,69,96,0.15);
    border-color: #e94560;
    color: #fff;
    transform: translateY(-2px);
}

/* ── Hero tip ─────────────────────────────────────────────── */
.hero-tip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(233,69,96,0.08);
    border: 1px solid rgba(233,69,96,0.2);
    border-radius: 30px;
    font-size: 0.85rem;
    color: #b8b8b8;
    margin-top: 12px;
}

.hero-tip i { color: #e94560; }

/* ── Input bar (shared, floats to bottom in chat mode) ─────── */
.input-bar {
    position: fixed;
    bottom: 60px; /* above footer */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 720px;
    padding: 0 20px;
    z-index: 50;
    transition: max-width 0.4s ease, bottom 0.3s ease;
}

/* In hero mode the input bar sits inside hero visually —
   we achieve this by giving it more bottom space so it
   appears centered with the hero text above. */
.hero-mode .input-bar {
    bottom: calc(50vh - 200px); /* roughly center of page */
    max-width: 680px;
}

.input-wrap {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.07);
    border: 2px solid rgba(15,52,96,0.7);
    border-radius: 50px;
    padding: 8px 8px 8px 22px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(12px);
}

.input-wrap:focus-within {
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233,69,96,0.15);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 1.05rem;
    min-width: 0;
}

.chat-input::placeholder { color: #666; }

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e94560;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.send-btn:hover  { background: #ff6b81; transform: scale(1.08); }
.send-btn:disabled { background: rgba(233,69,96,0.3); cursor: not-allowed; transform: none; }

.input-hint {
    text-align: center;
    color: rgba(255,255,255,0.2);
    font-size: 0.75rem;
    margin-top: 8px;
    transition: opacity 0.3s ease;
}

/* hint fades in chat mode */
.chat-mode .input-hint { opacity: 0; pointer-events: none; }

/* ── Preferences bar ──────────────────────────────────────── */
/* Sticky inside chat-state — sits at top of scroll container
   and pushes messages down instead of overlapping them */
.prefs-bar {
    position: sticky;
    top: 0;
    z-index: 49;
    max-width: 720px;
    width: 100%;
    margin: 0 auto 16px;
    display: none;
}

.prefs-bar.visible {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(15,52,96,0.55);
    border: 1px solid rgba(233,69,96,0.2);
    border-radius: 12px;
    padding: 8px 14px;
    backdrop-filter: blur(10px);
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity:0; transform: translateY(-6px); }
    to   { opacity:1; transform: translateY(0); }
}

.prefs-label {
    font-size: 0.78rem;
    color: #e94560;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.prefs-chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }

.pref-chip {
    background: rgba(233,69,96,0.12);
    border: 1px solid rgba(233,69,96,0.25);
    color: #e94560;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.prefs-reset {
    background: transparent;
    border: 1px solid rgba(233,69,96,0.25);
    color: #e94560;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.prefs-reset:hover { background: rgba(233,69,96,0.12); }

/* ── Chat messages ────────────────────────────────────────── */
.chat-window {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.msg-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    animation: msgIn 0.25s ease;
}

@keyframes msgIn {
    from { opacity:0; transform:translateY(8px); }
    to   { opacity:1; transform:translateY(0); }
}

.msg-row.user-row { flex-direction: row-reverse; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ai-avatar   { background: linear-gradient(135deg, #e94560, #0f3460); color:#fff; }
.user-avatar { background: rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.12); color:#b8b8b8; }

.bubble {
    max-width: 75%;
    padding: 13px 17px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.65;
    position: relative;
}

.ai-bubble {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    border-bottom-left-radius: 4px;
    color: #e0e0e0;
    max-width: 90%; /* wider — matches visual weight of user bubble */
}

.user-bubble {
    background: linear-gradient(135deg, rgba(233,69,96,0.22), rgba(15,52,96,0.28));
    border: 1px solid rgba(233,69,96,0.28);
    border-bottom-right-radius: 4px;
    color: #fff;
}

.bubble-time {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.25);
    margin-top: 5px;
    text-align: right;
}

.ai-bubble .bubble-time { text-align: left; }

/* ── Typing indicator ─────────────────────────────────────── */
.typing-row .bubble {
    padding: 14px 20px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.dot {
    width: 7px; height: 7px;
    background: #e94560;
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay:.2s; }
.dot:nth-child(3) { animation-delay:.4s; }

@keyframes bounce {
    0%,60%,100% { transform:translateY(0); opacity:.35; }
    30%          { transform:translateY(-6px); opacity:1; }
}

/* ── Anime recommendation cards ───────────────────────────── */
.rec-section { margin-top: 12px; }

.rec-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #e94560;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
}

.rec-cards-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(233,69,96,0.25) transparent;
}
.rec-cards-row::-webkit-scrollbar { height: 3px; }
.rec-cards-row::-webkit-scrollbar-thumb { background: rgba(233,69,96,0.25); border-radius:3px; }

.rec-card {
    flex-shrink: 0;
    width: 185px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 13px;
    padding: 13px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: all .22s ease;
    overflow: hidden;
    position: relative;
}

/* shimmer sweep — the signature */
.rec-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg,
        transparent 35%,
        rgba(233,69,96,0.07) 50%,
        transparent 65%);
    transform: translateX(-100%);
    transition: transform .5s ease;
    pointer-events: none;
}
.rec-card:hover::after  { transform: translateX(100%); }
.rec-card:hover {
    border-color: rgba(233,69,96,.32);
    background: rgba(255,255,255,.065);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(233,69,96,.12);
}

.rec-rank  { font-size:.68rem; font-weight:700; color:#e94560; text-transform:uppercase; letter-spacing:.05em; }
.rec-title { font-size:.9rem; font-weight:700; color:#fff; line-height:1.3;
             display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.rec-genres { display:flex; flex-wrap:wrap; gap:3px; }
.rec-reason { font-size:.76rem; color:#a0a0a0; line-height:1.5;
              display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; flex:1; }
.rec-link {
    display:inline-flex; align-items:center; justify-content:center; gap:5px;
    background:rgba(233,69,96,.12); color:#e94560;
    border:1px solid rgba(233,69,96,.28); border-radius:20px;
    padding:5px 11px; font-size:.73rem; font-weight:600;
    text-decoration:none; transition:all .18s ease; margin-top:auto;
}
.rec-link:hover { background:#e94560; color:#fff; }

/* ── Follow-up callout ────────────────────────────────────── */
.follow-up {
    margin-top: 10px;
    padding: 9px 13px;
    background: rgba(15,52,96,.28);
    border: 1px solid rgba(74,144,217,.25);
    border-radius: 10px;
    font-size: .86rem;
    color: #c0d8f0;
    font-style: italic;
}
.follow-up i { color:#4a90d9; margin-right:5px; }

/* ── System / validation message ──────────────────────────── */
.system-msg {
    align-self: center;
    background: rgba(255,200,0,.06);
    border: 1px solid rgba(255,200,0,.18);
    color: #f0d060;
    font-size: .85rem;
    padding: 8px 16px;
    border-radius: 10px;
    animation: msgIn .2s ease;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
    .hero-content h1 { font-size: 2.2rem; }
    .bubble { max-width: 88%; }
    .rec-card { width: 165px; }
    .input-bar { padding: 0 12px; }
    .hero-mode .input-bar { bottom: calc(50vh - 160px); }
}