File size: 20,635 Bytes
7e66729
2a54d13
7e66729
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e66729
 
a95192f
7e66729
a95192f
 
7e66729
a95192f
7e66729
 
a95192f
 
7e66729
 
a95192f
7e66729
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fdb1821
 
 
7e66729
a95192f
 
 
 
 
7e66729
 
 
 
a95192f
7e66729
a95192f
7e66729
 
 
 
 
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e66729
a95192f
 
 
7e66729
a95192f
 
7e66729
a95192f
 
7e66729
 
a95192f
 
 
 
bf652e3
a95192f
 
 
bf652e3
 
a95192f
bf652e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a95192f
 
bf652e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a95192f
 
 
 
 
 
 
 
 
 
 
 
7e66729
a95192f
 
7e66729
 
a95192f
 
 
 
 
7e66729
a95192f
 
7e66729
 
 
 
a95192f
7e66729
a95192f
7e66729
 
a95192f
7e66729
 
 
fdb1821
 
 
 
 
 
 
 
7e66729
 
 
 
bf652e3
a95192f
7e66729
 
f2ee01f
7e66729
a95192f
 
 
 
 
 
 
7e66729
 
a95192f
 
bf652e3
 
 
 
 
 
 
 
 
f2ee01f
bf652e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
bf652e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a95192f
 
 
 
 
 
 
 
7e66729
 
 
a95192f
7e66729
2cb2b62
7e66729
a95192f
 
 
7e66729
 
 
bf652e3
 
7e66729
a95192f
 
7e66729
 
a95192f
 
7e66729
a95192f
7e66729
 
a95192f
7e66729
a95192f
7e66729
a95192f
 
 
 
 
 
7e66729
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e66729
a95192f
 
 
7e66729
 
a95192f
7e66729
a95192f
 
 
 
7e66729
 
a95192f
 
 
 
 
7e66729
 
a95192f
2cb2b62
a95192f
7e66729
a95192f
 
 
 
7e66729
 
a95192f
7e66729
a95192f
 
 
 
 
 
 
7e66729
 
a95192f
 
 
 
 
 
7e66729
 
a95192f
 
 
 
 
 
7e66729
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e66729
 
a95192f
fdb1821
a95192f
 
 
fdb1821
 
 
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e66729
 
a95192f
7e66729
 
 
 
 
 
a95192f
 
 
 
7e66729
 
 
 
a95192f
 
 
 
 
 
 
 
 
 
7e66729
a95192f
 
 
 
7e66729
 
a95192f
 
 
 
 
7e66729
 
a95192f
 
 
 
 
 
 
 
 
 
 
 
 
 
bf652e3
7e66729
 
a95192f
 
 
 
7e66729
 
a95192f
 
bf652e3
 
 
 
 
 
a95192f
bf652e3
a95192f
bf652e3
 
 
a95192f
bf652e3
 
 
 
 
 
 
7e66729
 
bf652e3
 
 
a95192f
bf652e3
 
 
 
a95192f
bf652e3
 
 
 
 
7e66729
 
bf652e3
 
 
 
 
 
 
 
a95192f
bf652e3
 
 
 
 
 
 
 
a95192f
bf652e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a95192f
bf652e3
 
 
 
 
 
 
 
 
 
a95192f
 
 
7e66729
 
bf652e3
a95192f
 
7e66729
 
 
 
a95192f
 
 
7e66729
 
 
2a54d13
 
 
 
 
 
 
 
 
 
 
97fe9d3
 
 
2a54d13
 
 
97fe9d3
2a54d13
 
97fe9d3
 
2a54d13
 
a95192f
bf652e3
a95192f
 
 
 
bf652e3
7e66729
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
<template>
  <v-col cols="12" class="feed-col">
    <v-card class="chat-card" rounded="xl" elevation="0">
      <v-card-text ref="feedEl" class="feed-scroll">

        <!-- Empty state -->
        <div v-if="messages.length === 0 && !loading" class="empty-state">
          <div class="empty-icon-wrap">
            <v-icon size="38" color="primary">mdi-movie-open-star-outline</v-icon>
          </div>
          <h3 class="empty-title">Tu mood, tu pelΓ­cula</h3>
          <p class="empty-subtitle">CuΓ©ntame cΓ³mo te sientes y encontrarΓ© la pelΓ­cula perfecta para ti.</p>
          <div class="example-chips">
            <v-chip
              v-for="ex in examples"
              :key="ex"
              variant="tonal"
              color="primary"
              size="small"
              class="example-chip"
              @click="$emit('quick-fill', ex)"
            >
              {{ ex }}
            </v-chip>
          </div>
        </div>

        <!-- Messages -->
        <template v-for="(msg, i) in messages" :key="i">

          <!-- User bubble -->
          <div v-if="msg.type === 'user'" class="user-row">
            <div class="user-bubble">{{ msg.text }}</div>
          </div>

          <!-- Result card -->
          <div
            v-else-if="msg.type === 'result'"
            class="result-card mb-4"
            :style="{ '--emotion-color': dominantEmotionInfo(msg.emotions).color }"
          >
            <!-- Bot bubble -->
            <div v-if="msg.chatbotText" class="bot-message">
              <div class="bot-avatar">
                <v-icon size="15" color="primary">mdi-robot-outline</v-icon>
              </div>
              <div class="bot-bubble">{{ msg.chatbotText }}</div>
            </div>

            <!-- Emotion analysis -->
            <div class="emotion-section">
              <div class="emotion-header">
                <div class="emotion-badge">
                  <span class="emotion-emoji">{{ dominantEmotionInfo(msg.emotions).emoji }}</span>
                  <div class="emotion-info">
                    <div class="emotion-name">{{ dominantEmotionInfo(msg.emotions).label }}</div>
                    <div class="emotion-score">
                      {{ (dominantEmotionInfo(msg.emotions).score * 100).toFixed(0) }}% Β·
                      valencia {{ msg.dominantValence }}
                    </div>
                  </div>
                </div>
                <v-chip size="x-small" variant="tonal" color="primary" class="strategy-chip">
                  {{ strategyLabel(msg.estrategia) }}
                </v-chip>
              </div>

              <div class="bars">
                <div
                  v-for="e in msg.emotions.filter(em => em.score > 0.02)"
                  :key="e.label"
                  class="bar-row"
                >
                  <span class="bar-label">{{ emotionInfo(e.label).emoji }} {{ emotionInfo(e.label).label }}</span>
                  <v-progress-linear
                    :model-value="e.score * 100"
                    :color="emotionInfo(e.label).color"
                    :bg-color="barBgColor"
                    rounded
                    height="7"
                    class="bar-progress"
                  />
                  <span class="bar-pct">{{ (e.score * 100).toFixed(0) }}%</span>
                </div>
              </div>
            </div>

            <!-- Transition -->
            <div v-if="msg.previousEmotion" class="info-row transition-row">
              <v-icon size="13" color="cyan-darken-1" class="mr-1">mdi-transit-connection-horizontal</v-icon>
              <span>
                TransiciΓ³n detectada:
                <strong>{{ msg.previousEmotion }}</strong> β†’
                <strong>{{ msg.dominantEmotion }}</strong>
                <template v-if="msg.transitionMovie?.title">
                  Β· asociada a: {{ msg.transitionMovie.title }}
                </template>
              </span>
            </div>

            <!-- Recommendations -->
            <div class="reco-section">
              <div class="reco-header">
                <v-icon size="14" color="amber-darken-1" class="mr-1">mdi-filmstrip</v-icon>
                <span class="reco-title">
                  Recomendaciones para <strong>{{ msg.dominantEmotion }}</strong>
                </span>
                <v-chip
                  size="x-small"
                  variant="tonal"
                  :color="msg.recommendationMode === 'diferente' ? 'teal-darken-1' : 'indigo'"
                  class="ml-auto"
                >
                  {{ msg.recommendationMode === 'diferente' ? 'Novedad' : 'Afinidad' }}
                </v-chip>
              </div>

              <v-alert v-if="msg.recommendations.length === 0" type="warning" variant="tonal" density="comfortable" class="mt-2" rounded="lg">
                No hay recomendaciones disponibles.
              </v-alert>

              <div v-else class="poster-grid">
                <div
                  v-for="movie in msg.recommendations.slice(0, 6)"
                  :key="movie.movieId"
                  class="poster-card"
                  :class="{ 'poster-card--viewed': viewedMovieIds.has(String(movie.movieId)) }"
                >
                  <!-- Poster thumbnail -->
                  <div class="poster-thumb" :style="posters[String(movie.imdb_id)] ? {} : posterStyle(movie.title)">
                    <img
                      v-if="posters[String(movie.imdb_id)]"
                      :src="posters[String(movie.imdb_id)]"
                      :alt="movie.title"
                      class="poster-real-img"
                      loading="lazy"
                    />
                    <template v-else>
                      <v-icon size="32" color="white" style="opacity: 0.55;">mdi-filmstrip</v-icon>
                      <div class="poster-initials">{{ movieInitials(movie.title) }}</div>
                    </template>
                    <div v-if="viewedMovieIds.has(String(movie.movieId))" class="poster-seen-badge">
                      <v-icon size="14" color="white">mdi-check</v-icon>
                    </div>
                  </div>
                  <!-- Poster info -->
                  <div class="poster-body">
                    <div class="poster-title" :title="movie.title">{{ movie.title }}</div>
                    <div class="poster-genres">{{ firstGenre(movie.genres) }}</div>
                    <v-btn
                      size="x-small"
                      :variant="viewedMovieIds.has(String(movie.movieId)) ? 'tonal' : 'flat'"
                      :color="viewedMovieIds.has(String(movie.movieId)) ? 'success' : 'amber-darken-1'"
                      :disabled="viewedMovieIds.has(String(movie.movieId))"
                      rounded="lg"
                      class="poster-btn mt-1"
                      block
                      @click="$emit('mark-viewed', movie, msg.dominantEmotion, msg.text, msg.recommendationCycleId)"
                    >
                      <v-icon v-if="viewedMovieIds.has(String(movie.movieId))" size="11" class="mr-1">mdi-check</v-icon>
                      {{ viewedMovieIds.has(String(movie.movieId)) ? 'Vista' : 'Marcar vista' }}
                    </v-btn>
                  </div>
                </div>
              </div>
            </div>

            <!-- Followup -->
            <div
              v-if="msg.recommendationCycleId && followupByCycle[String(msg.recommendationCycleId)]"
              class="info-row followup-row"
            >
              <v-icon size="13" color="success" class="mr-1">mdi-check-circle-outline</v-icon>
              <span>
                Seguimiento:
                <strong>{{ followupByCycle[String(msg.recommendationCycleId)].pre_emotion }}</strong>
                ({{ followupByCycle[String(msg.recommendationCycleId)].pre_valence }})
                β†’
                <strong>{{ followupByCycle[String(msg.recommendationCycleId)].post_emotion }}</strong>
                ({{ followupByCycle[String(msg.recommendationCycleId)].post_valence }})
                Β·
                {{ followupByCycle[String(msg.recommendationCycleId)].cambio_emocional ? 'βœ“ cambio emocional' : 'sin cambio' }}
              </span>
            </div>
          </div>

          <!-- Error -->
          <v-alert v-else-if="msg.type === 'error'" type="error" variant="tonal" class="mb-3" rounded="lg">
            {{ msg.text }}
          </v-alert>
        </template>

        <!-- Loading -->
        <div v-if="loading" class="loading-row">
          <v-progress-circular indeterminate size="16" width="2" color="primary" />
          <span>Analizando emociones...</span>
        </div>

      </v-card-text>
    </v-card>

    <MessageComposer
      :input="input"
      :loading="loading"
      :estrategia="estrategia"
      @update:input="$emit('update:input', $event)"
      @update:estrategia="$emit('update:estrategia', $event)"
      @analyze="$emit('analyze')"
    />
  </v-col>
</template>

<script setup>
import { computed, nextTick, reactive, ref, watch } from "vue";
import { useTheme } from "vuetify";
import { dominantEmotionInfo, emotionInfo } from "../constants/emotions";
import MessageComposer from "./MessageComposer.vue";
import API_BASE_URL from "../config.js";

const props = defineProps({
  messages:        { type: Array,   default: () => [] },
  loading:         { type: Boolean, default: false },
  input:           { type: String,  default: "" },
  estrategia:      { type: String,  default: "v1" },
  viewedMovieIds:  { type: Object,  required: true },
  followupByCycle: { type: Object,  required: true },
});

defineEmits(["mark-viewed", "update:input", "update:estrategia", "analyze", "quick-fill"]);

const theme    = useTheme();
const feedEl   = ref(null);
const posters  = reactive({}); // { [tmdb_id]: url | null }

async function loadPoster(imdbId) {
  const key = String(imdbId);
  if (!imdbId || key in posters) return;
  posters[key] = null;
  try {
    const res  = await fetch(`${API_BASE_URL}/poster/${key}`);
    const data = await res.json();
    posters[key] = data.poster_url || null;
  } catch { /* keep null */ }
}

watch(
  () => props.messages,
  (msgs) => {
    for (const msg of msgs) {
      if (msg.type === "result") {
        for (const movie of msg.recommendations ?? []) {
          if (movie.imdb_id) loadPoster(movie.imdb_id);
        }
      }
    }
  },
  { immediate: true, deep: true },
);

const barBgColor = computed(() =>
  theme.global.current.value.dark ? "rgba(255,255,255,0.07)" : "rgba(0,0,0,0.06)"
);

const examples = [
  "Hoy me siento ansioso y con ganas de desconectar",
  "Estoy muy feliz y quiero descubrir algo nuevo",
  "Me siento triste y necesito algo reconfortante",
];

const strategyMap = { v1: "BΓ‘sica", v2: "Avanzada", v3: "Experimental" };
function strategyLabel(key) { return strategyMap[key] || key; }

function firstGenre(genres) {
  if (!genres) return "";
  return genres.split("|")[0];
}

function movieInitials(title) {
  if (!title) return "?";
  return title
    .replace(/\s*\(\d{4}\)\s*$/, "")
    .split(/\s+/)
    .filter(w => w.length > 2)
    .slice(0, 2)
    .map(w => w[0].toUpperCase())
    .join("") || title[0].toUpperCase();
}

const POSTER_GRADIENTS = [
  ["#667eea", "#764ba2"],
  ["#f59e0b", "#ef4444"],
  ["#10b981", "#0d9488"],
  ["#6366f1", "#8b5cf6"],
  ["#ec4899", "#a855f7"],
  ["#14b8a6", "#3b82f6"],
  ["#f97316", "#dc2626"],
  ["#3b82f6", "#6366f1"],
  ["#84cc16", "#059669"],
  ["#e11d48", "#9333ea"],
];

function posterStyle(title) {
  let hash = 0;
  for (let i = 0; i < (title?.length ?? 0); i++) {
    hash = (hash * 31 + title.charCodeAt(i)) | 0;
  }
  const [c1, c2] = POSTER_GRADIENTS[Math.abs(hash) % POSTER_GRADIENTS.length];
  return {
    background: `linear-gradient(145deg, ${c1}, ${c2})`,
  };
}

async function scrollToBottom() {
  await nextTick();
  const el = feedEl.value?.$el;
  if (el) el.scrollTop = el.scrollHeight;
}

watch(() => props.messages.length, scrollToBottom);
watch(() => props.loading, val => { if (val) scrollToBottom(); });
</script>

<style scoped>
/* ── Card ─────────────────────────────────────── */
.chat-card {
  border: 1.5px solid var(--vs-border);
  background: var(--vs-panel);
  backdrop-filter: blur(var(--vs-glass-blur)) saturate(120%);
  -webkit-backdrop-filter: blur(var(--vs-glass-blur)) saturate(120%);
  box-shadow: var(--vs-card-shadow);
}

.feed-scroll {
  height: calc(100vh - 360px);
  min-height: 320px;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

.feed-scroll::-webkit-scrollbar       { width: 6px; }
.feed-scroll::-webkit-scrollbar-track { background: transparent; }
.feed-scroll::-webkit-scrollbar-thumb {
  background: var(--vs-scrollbar);
  border-radius: 999px;
}
.feed-scroll::-webkit-scrollbar-thumb:hover { background: var(--vs-scrollbar-hover); }

/* ── Empty state ─────────────────────────────── */
.empty-state {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
}

.empty-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--vs-empty-icon-bg);
  border: 1px solid var(--vs-empty-icon-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.empty-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  color: var(--vs-text);
  font-weight: 600;
}

.empty-subtitle {
  margin: 0;
  color: var(--vs-muted);
  font-size: 0.88rem;
  max-width: 38ch;
  line-height: 1.5;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

.example-chip { cursor: pointer; font-size: 0.78rem !important; }

/* ── User bubble ─────────────────────────────── */
.user-row   { display: flex; justify-content: flex-end; margin-bottom: 12px; }

.user-bubble {
  max-width: 78%;
  padding: 11px 16px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #1a0a00;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.5;
  border-radius: 18px 4px 18px 18px;
  box-shadow: 0 4px 14px rgba(245,158,11,0.3);
}

/* ── Result card ─────────────────────────────── */
.result-card {
  border: 1px solid var(--vs-result-border);
  border-left: 3px solid var(--emotion-color, #667eea);
  background: var(--vs-result-bg);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
}

/* ── Bot bubble ──────────────────────────────── */
.bot-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.bot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--vs-bot-bg);
  border: 1px solid var(--vs-bot-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.bot-bubble {
  background: var(--vs-bot-bg);
  border: 1px solid var(--vs-bot-border);
  border-radius: 4px 16px 16px 16px;
  padding: 11px 15px;
  color: var(--vs-text);
  line-height: 1.6;
  font-size: 0.92rem;
  max-width: 90%;
}

/* ── Emotion section ─────────────────────────── */
.emotion-section {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--vs-border);
}

.emotion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.emotion-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.emotion-emoji  { font-size: 1.8rem; line-height: 1; }

.emotion-name  {
  font-weight: 700;
  font-size: 1rem;
  color: var(--vs-text);
}

.emotion-score {
  font-size: 0.78rem;
  color: var(--vs-muted);
  margin-top: 1px;
}

/* ── Bars ────────────────────────────────────── */
.bars { display: flex; flex-direction: column; gap: 8px; }

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 38px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  color: var(--vs-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-pct {
  text-align: right;
  color: var(--vs-muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

/* ── Info rows (transition / followup) ────────── */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--vs-muted);
  padding: 7px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.info-row strong { color: var(--vs-text); }

.transition-row {
  background: var(--vs-transition-bg);
  border: 1px solid var(--vs-transition-border);
}

.followup-row {
  background: var(--vs-followup-bg);
  border: 1px solid var(--vs-followup-border);
  margin-bottom: 0;
  margin-top: 12px;
}

/* ── Recommendations ─────────────────────────── */
.reco-section { margin-top: 4px; }

.reco-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.reco-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--vs-muted);
}

.reco-title strong { color: var(--vs-text); }

/* ── Poster grid ─────────────────────────────── */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.poster-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--vs-border);
  background: var(--vs-movie-bg);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.poster-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.poster-card--viewed {
  opacity: 0.65;
}

.poster-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}

.poster-real-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.poster-initials {
  color: rgba(255,255,255,0.9);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  font-family: "Fraunces", serif;
}

.poster-seen-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(34,197,94,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-body {
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.poster-title {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--vs-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-genres {
  font-size: 0.68rem;
  color: var(--vs-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-btn { font-size: 0.68rem !important; }

/* ── Loading ─────────────────────────────────── */
.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  color: var(--vs-muted);
  font-size: 0.86rem;
}

@media (max-width: 960px) {
  .feed-col {
    height: 100%;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
  }

  .chat-card {
    flex: 1;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
  }

  .feed-scroll {
    flex: 1 !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .bar-row     { grid-template-columns: 90px 1fr 36px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (max-width: 600px) {
  .bar-row     { grid-template-columns: 80px 1fr 32px; }
  .poster-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
</style>