dont know ?

This commit is contained in:
Lars Behrends
2025-11-03 23:34:36 +01:00
parent 7a7977d8b0
commit 1ec6016b10
27 changed files with 6854 additions and 3361 deletions

View File

@@ -1,184 +1,294 @@
{% extends "layouts/app.twig" %}
{% block content %}
<div class="container-fluid">
<div class="row">
<!-- Sidebar with filters -->
<div class="col-lg-3 col-xl-2">
<div class="card">
<div class="card-header">
<h5 class="mb-0">Filters</h5>
</div>
<div class="card-body">
<!-- Filter form -->
<form method="GET" id="filterForm">
<input type="hidden" name="view" value="{{ view_mode }}">
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
<input type="hidden" name="search" value="{{ search }}">
{% block nav_controls %}
<!-- Search form -->
<form method="GET" class="flex gap-2">
<input type="hidden" name="view" value="{{ view_mode }}">
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
{% for genre in filters.genres %}
<input type="hidden" name="genres[]" value="{{ genre }}">
{% endfor %}
{% for director in filters.directors %}
<input type="hidden" name="directors[]" value="{{ director }}">
{% endfor %}
<div class="relative">
<input
type="text"
name="search"
value="{{ search }}"
placeholder="Search movies..."
class="pl-10 pr-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500 w-64 bg-gray-800 text-white placeholder-gray-400"
>
<svg class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
</div>
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
Search
</button>
</form>
<!-- Genre filter -->
{% if available_filters.genres %}
<div class="mb-4">
<h6 class="fw-bold text-dark mb-2">Genres</h6>
<select class="form-select select2" name="genres[]" multiple data-placeholder="Select genres...">
{% for genre in available_filters.genres %}
<option value="{{ genre }}" {{ genre in filters.genres ? 'selected' : '' }}>
{{ genre }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<!-- View mode switcher -->
<div class="flex gap-1" role="group">
{% for mode in view_modes %}
<a
href="?view={{ mode }}&sort={{ sort }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="inline-flex items-center px-3 py-2 border border-gray-300 bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 {{ view_mode == mode ? 'bg-blue-600 border-blue-500 text-white' : '' }}"
title="{{ mode|title }} View"
>
{% if mode == 'grid' %}
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/>
</svg>
{% endif %}
{% if mode == 'list' %}
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/>
</svg>
{% endif %}
{% if mode == 'covers' %}
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
{% endif %}
<span class="hidden sm:inline ml-1">{{ mode|title }}</span>
</a>
{% endfor %}
</div>
<!-- Director filter -->
{% if available_filters.directors %}
<div class="mb-4">
<h6 class="fw-bold text-dark mb-2">Directors</h6>
<select class="form-select select2" name="directors[]" multiple data-placeholder="Select directors...">
{% for director in available_filters.directors %}
<option value="{{ director }}" {{ director in filters.directors ? 'selected' : '' }}>
{{ director }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<!-- Filter actions -->
<div class="d-grid gap-2">
<button type="submit" class="btn btn-primary btn-sm">
Apply Filters
</button>
<a href="{{ path_for('movies.index') }}" class="btn btn-outline-secondary btn-sm">
Clear All
</a>
</div>
</form>
</div>
</div>
<!-- Sort dropdown -->
<div class="relative" x-data="{ open: false }">
<button @click="open = !open" class="inline-flex items-center px-3 py-2 border border-gray-300 rounded-md bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
<svg class="mr-1 h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4h14M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"/>
</svg>
<span class="hidden sm:inline">Sort</span>
</button>
<div x-show="open" @click.away="open = false" class="absolute right-0 z-50 mt-2 w-56 bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5">
<div class="py-1">
{% for key, label in sort_options %}
<a class="flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 {{ sort == key ? 'bg-gray-50' : '' }}"
href="?sort={{ key }}&view={{ view_mode }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}">
{{ label }}
{% if sort == key %}
<svg class="h-4 w-4 text-blue-600" fill="currentColor" viewBox="0 0 16 16">
<path d="M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5zM10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5z"/>
</svg>
{% endif %}
</a>
{% endfor %}
</div>
</div>
</div>
{% endblock %}
<!-- Main content area -->
<div class="col-lg-9 col-xl-10">
<div class="px-4 py-3">
<!-- Header with search and view controls -->
<div class="d-flex flex-column flex-sm-row justify-content-between align-items-start align-items-sm-center mb-4 gap-3">
<div>
<h1 class="display-4 fw-bold text-dark">Movies</h1>
{% if pagination.total_items > 0 %}
<div class="text-muted small mt-1">
{{ pagination.total_items }} movies
{% if search %}
matching "{{ search }}"
{% endif %}
{% if filters.genres or filters.directors %}
{% if filters.genres %}
<span class="badge bg-primary ms-1">{{ filters.genres|join(', ') }}</span>
{% endif %}
{% if filters.directors %}
<span class="badge bg-secondary ms-1">{{ filters.directors|join(', ') }}</span>
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
{% block item_list %}
{% if view_mode == 'list' and movies %}
<div class="space-y-4">
<!-- Group movies by first letter -->
{% set grouped_movies = {} %}
{% for movie in movies %}
{% set first_letter = movie.title|first|upper %}
{% if grouped_movies[first_letter] is not defined %}
{% set grouped_movies = grouped_movies|merge({(first_letter): []}) %}
{% endif %}
{% set grouped_movies = grouped_movies|merge({(first_letter): grouped_movies[first_letter]|merge([movie])}) %}
{% endfor %}
<div class="d-flex flex-column flex-sm-row gap-3 w-100 w-sm-auto">
<!-- Search form -->
<form method="GET" class="d-flex gap-2">
<input type="hidden" name="view" value="{{ view_mode }}">
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
{% for genre in filters.genres %}
<input type="hidden" name="genres[]" value="{{ genre }}">
{% endfor %}
{% for director in filters.directors %}
<input type="hidden" name="directors[]" value="{{ director }}">
{% endfor %}
<div class="position-relative">
<input
type="text"
name="search"
value="{{ search }}"
placeholder="Search movies..."
class="form-control ps-5"
>
<svg class="position-absolute top-50 start-0 translate-middle-y ms-3 text-muted" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
</div>
<button type="submit" class="btn btn-primary">
Search
</button>
</form>
<!-- View mode switcher -->
<div class="btn-group me-2" role="group">
{% for mode in view_modes %}
<a
href="?view={{ mode }}&sort={{ sort }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="btn btn-outline-secondary {{ view_mode == mode ? 'active' : '' }}"
title="{{ mode|title }} View"
>
{% if mode == 'grid' %}
<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/>
</svg>
{% endif %}
{% if mode == 'list' %}
<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/>
</svg>
{% endif %}
{% if mode == 'covers' %}
<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
{% endif %}
<span class="d-none d-sm-inline ms-1">{{ mode|title }}</span>
</a>
{% endfor %}
</div>
<!-- Sort dropdown -->
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="sortDropdown" data-bs-toggle="dropdown" aria-expanded="false">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"/>
</svg>
<span class="d-none d-sm-inline">Sort</span>
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="sortDropdown">
{% for key, label in sort_options %}
<li>
<a class="dropdown-item {% if sort == key %}active{% endif %}"
href="?sort={{ key }}&view={{ view_mode }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}">
{{ label }}
{% if sort == key %}
<svg class="float-end mt-1" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5zM10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5z"/>
</svg>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% if movies is empty %}
<div class="text-center py-5">
<svg class="mx-auto text-muted mb-3" width="48" height="48" fill="none" viewBox="0 0 24 24" stroke="currentColor">
{% for letter, letter_movies in grouped_movies|sort %}
<div class="space-y-2">
<h4 class="text-sm font-semibold text-gray-900 border-b border-gray-200 pb-1">{{ letter }}</h4>
<div class="space-y-1">
{% for movie in letter_movies %}
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="flex items-center p-2 rounded-md hover:bg-gray-100 transition-colors">
{% if movie.poster_url %}
<img class="w-8 h-12 object-cover rounded mr-3 flex-shrink-0" src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}">
{% else %}
<div class="w-8 h-12 bg-gray-200 rounded mr-3 flex-shrink-0 flex items-center justify-center">
<svg class="w-4 h-4 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
<h3 class="h5 fw-medium text-dark">
</div>
{% endif %}
<div class="flex-1 min-w-0">
<div class="text-sm font-medium text-gray-900 truncate">{{ movie.title }}</div>
{% if movie.release_date %}
<div class="text-xs text-gray-500">{{ movie.release_date|date('Y') }}</div>
{% endif %}
</div>
{% if movie.watched %}
<div class="flex-shrink-0 ml-2">
<svg class="w-4 h-4 text-green-600" fill="currentColor" viewBox="0 0 16 16">
<path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"/>
</svg>
</div>
{% endif %}
</a>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="space-y-4">
<div class="text-sm text-gray-500 text-center py-8">
No items to display
</div>
</div>
{% endif %}
{% endblock %}
{% block sidebar %}
<div class="space-y-4">
<!-- Filters -->
<div class="bg-gray-50 rounded-lg p-4">
<h3 class="text-sm font-medium text-gray-900 mb-4">Filters</h3>
<!-- Filter form -->
<form method="GET" id="filterForm">
<input type="hidden" name="view" value="{{ view_mode }}">
<input type="hidden" name="per_page" value="{{ pagination.per_page }}">
<input type="hidden" name="search" value="{{ search }}">
<!-- Genre filter -->
{% if available_filters.genres %}
<div class="mb-4">
<label class="block text-xs font-medium text-gray-700 mb-1">Genres</label>
<select class="select2 w-full text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500" name="genres[]" multiple data-placeholder="Select genres...">
{% for genre in available_filters.genres %}
<option value="{{ genre }}" {{ genre in filters.genres ? 'selected' : '' }}>
{{ genre }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<!-- Director filter -->
{% if available_filters.directors %}
<div class="mb-4">
<label class="block text-xs font-medium text-gray-700 mb-1">Directors</label>
<select class="select2 w-full text-sm border border-gray-300 rounded focus:ring-blue-500 focus:border-blue-500" name="directors[]" multiple data-placeholder="Select directors...">
{% for director in available_filters.directors %}
<option value="{{ director }}" {{ director in filters.directors ? 'selected' : '' }}>
{{ director }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<!-- Filter actions -->
<div class="space-y-2">
<button type="submit" class="w-full bg-blue-600 text-white px-3 py-2 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 text-sm">
Apply Filters
</button>
<a href="{{ path_for('movies.index') }}" class="w-full bg-gray-100 text-gray-700 px-3 py-2 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 block text-center text-sm">
Clear All
</a>
</div>
</form>
</div>
<!-- Active Filters Summary -->
{% if filters.genres or filters.directors or search %}
<div class="bg-blue-50 rounded-lg p-4">
<h3 class="text-sm font-medium text-gray-900 mb-3">Active Filters</h3>
<div class="space-y-2">
{% if search %}
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Search: "{{ search }}"</span>
<a href="?{% for key, value in filters %}{% if key != 'search' %}{{ key }}={{ value }}&{% endif %}{% endfor %}" class="text-blue-600 hover:text-blue-800">
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</a>
</div>
{% endif %}
{% for genre in filters.genres %}
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Genre: {{ genre }}</span>
<a href="?{% for key, value in filters %}{% if key != 'genres' or (key == 'genres' and value != genre) %}{{ key }}={{ value }}&{% endif %}{% endfor %}" class="text-blue-600 hover:text-blue-800">
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</a>
</div>
{% endfor %}
{% for director in filters.directors %}
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Director: {{ director }}</span>
<a href="?{% for key, value in filters %}{% if key != 'directors' or (key == 'directors' and value != director) %}{{ key }}={{ value }}&{% endif %}{% endfor %}" class="text-blue-600 hover:text-blue-800">
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</a>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Quick Stats -->
<div class="bg-gray-50 rounded-lg p-4">
<h3 class="text-sm font-medium text-gray-900 mb-3">Quick Stats</h3>
<div class="space-y-2">
<div class="flex justify-between text-sm">
<span class="text-gray-600">Total Movies</span>
<span class="font-medium text-gray-900">{{ pagination.total_items }}</span>
</div>
<div class="flex justify-between text-sm">
<span class="text-gray-600">This Page</span>
<span class="font-medium text-gray-900">{{ movies|length }}</span>
</div>
{% if pagination.total_pages > 1 %}
<div class="flex justify-between text-sm">
<span class="text-gray-600">Page</span>
<span class="font-medium text-gray-900">{{ pagination.current_page }} of {{ pagination.total_pages }}</span>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% block content %}
<!-- Main content area -->
<div class="p-6">
<!-- Header -->
<div class="mb-6">
<h1 class="text-3xl font-bold text-gray-900">Movies</h1>
{% if pagination.total_items > 0 %}
<div class="text-gray-500 text-sm mt-1">
{{ pagination.total_items }} movies
{% if search %}
matching "{{ search }}"
{% endif %}
{% if filters.genres or filters.directors %}
{% if filters.genres %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 ml-2">{{ filters.genres|join(', ') }}</span>
{% endif %}
{% if filters.directors %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 ml-2">{{ filters.directors|join(', ') }}</span>
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
{% if movies is empty %}
<div class="text-center py-12">
<svg class="mx-auto text-gray-400 mb-4 h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
<h3 class="text-lg font-medium text-gray-900 mb-2">
{% if search or filters.genres or filters.directors %}
No movies found matching your criteria
{% else %}
No movies found
{% endif %}
</h3>
<p class="text-muted">
<p class="text-gray-500 mb-4">
{% if search or filters.genres or filters.directors %}
Try adjusting your search terms or filters.
{% else %}
@@ -186,7 +296,7 @@
{% endif %}
</p>
{% if search or filters.genres or filters.directors %}
<a href="{{ path_for('movies.index') }}" class="btn btn-primary mt-3">
<a href="{{ path_for('movies.index') }}" class="inline-flex items-center px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
Clear filters
</a>
{% endif %}
@@ -195,28 +305,28 @@
<!-- Movies content based on view mode -->
{% if view_mode == 'list' %}
<!-- List view -->
<div class="card">
<ul class="list-group list-group-flush">
<div class="bg-white rounded-lg shadow-md border border-gray-200">
<ul class="divide-y divide-gray-200">
{% for movie in movies %}
<li class="list-group-item">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<li class="px-4 py-3">
<div class="flex justify-between items-center">
<div class="flex items-center">
{% if movie.poster_url %}
<img class="rounded me-3" style="width: 64px; height: 96px; object-fit: cover;" src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}">
<img class="rounded mr-3" style="width: 64px; height: 96px; object-fit: cover;" src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}">
{% else %}
<div class="bg-light rounded me-3 d-flex align-items-center justify-content-center" style="width: 64px; height: 96px;">
<svg class="text-muted" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<div class="bg-gray-100 rounded mr-3 flex items-center justify-center" style="width: 64px; height: 96px;">
<svg class="text-gray-600" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
</div>
{% endif %}
<div class="flex-grow-1">
<h3 class="h6 mb-1">
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="text-decoration-none">
<div class="flex-1">
<h3 class="text-sm font-semibold mb-1">
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="no-underline text-gray-900 hover:text-blue-600">
{{ movie.title }}
</a>
</h3>
<div class="d-flex align-items-center gap-3 small text-muted">
<div class="flex items-center gap-3 text-sm text-gray-600">
{% if movie.release_date %}
<span>{{ movie.release_date|date('Y') }}</span>
{% endif %}
@@ -230,14 +340,14 @@
</div>
</div>
</div>
<div class="d-flex gap-2">
<div class="flex gap-2">
{% if movie.watched %}
<span class="badge bg-success">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
Watched
</span>
{% endif %}
{% if movie.is_favorite %}
<span class="badge bg-danger">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
Favorite
</span>
{% endif %}
@@ -249,114 +359,124 @@
</div>
{% elseif view_mode == 'covers' %}
<!-- Cover grid view -->
<div class="items">
<div class="row g-3">
<!-- Enhanced Cover grid view -->
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-4">
{% for movie in movies %}
<figure class="item" style="padding:0px">
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="text-decoration-none">
<img src="/images/{{ movie.poster_url }}" />
<figcaption>{{ movie.title }}</figcaption>
</a>
</figure>
<!--
<div class="col-6 col-sm-4 col-md-3 col-lg-2">
<div class="card h-100">
{% if movie.poster_url %}
<div class="position-relative" style="aspect-ratio: 2/3; overflow: hidden;">
<img src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}" class="card-img-top" style="width: 100%; height: 100%; object-fit: cover;">
</div>
{% else %}
<div class="d-flex align-items-center justify-content-center bg-light" style="aspect-ratio: 2/3; min-height: 200px;">
<svg class="text-muted" width="48" height="48" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
</div>
{% endif %}
<div class="card-body">
<h6 class="card-title text-truncate" title="{{ movie.title }}">
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="text-decoration-none">
{{ movie.title }}
</a>
</h6>
{% if movie.release_date %}
<p class="card-text small text-muted">{{ movie.release_date|date('Y') }}</p>
{% endif %}
<div class="group relative bg-white rounded-xl shadow-lg border border-gray-200 overflow-hidden hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-1">
{% if movie.poster_url %}
<div class="relative aspect-[2/3] overflow-hidden">
<img src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300">
<!-- Overlay with movie info -->
<div class="absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300">
<div class="absolute bottom-0 left-0 right-0 p-3">
{% if movie.rating %}
<div class="flex items-center mb-2">
<svg class="w-4 h-4 text-yellow-400 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
<span class="text-white text-sm font-medium">{{ movie.rating }}</span>
</div>
{% endif %}
{% if movie.watched %}
<div class="flex items-center mb-1">
<svg class="w-3 h-3 text-green-400 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
</svg>
<span class="text-green-400 text-xs">Watched</span>
</div>
{% endif %}
</div>
</div>
</div>
</div>-->
{% else %}
<div class="flex items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 aspect-[2/3] min-h-[200px]">
<svg class="text-gray-400 w-12 h-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
</div>
{% endif %}
<div class="p-4">
<h6 class="text-sm font-bold truncate mb-1" title="{{ movie.title }}">
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="no-underline text-gray-900 hover:text-blue-600 transition-colors">
{{ movie.title }}
</a>
</h6>
{% if movie.release_date %}
<p class="text-xs text-gray-600 font-medium">{{ movie.release_date|date('Y') }}</p>
{% endif %}
{% if movie.genre %}
<div class="mt-2">
{% for genre in movie.genre|split(',')|slice(0, 2) %}
<span class="inline-block bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full font-medium mr-1 mb-1">{{ genre|trim }}</span>
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<!-- Default grid view -->
<div class="row g-3">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4">
{% for movie in movies %}
<div class="col-12 col-md-6 col-lg-3 col-xl-2">
<div class="card h-100">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-shrink-0">
{% if movie.poster_url %}
<img class="rounded" style="width: 64px; height: 96px; object-fit: cover;" src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}">
{% else %}
<div class="bg-light rounded d-flex align-items-center justify-content-center" style="width: 64px; height: 96px;">
<svg class="text-muted" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
</div>
{% endif %}
<div class="bg-white rounded-lg shadow-md border border-gray-200 h-full">
<div class="p-4">
<div class="flex items-center">
<div class="flex-shrink-0">
{% if movie.poster_url %}
<img class="rounded" style="width: 64px; height: 96px; object-fit: cover;" src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}">
{% else %}
<div class="bg-gray-100 rounded flex items-center justify-center" style="width: 64px; height: 96px;">
<svg class="text-gray-600" width="32" height="32" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
</div>
<div class="ms-3 flex-grow-1">
<h5 class="card-title mb-1">
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="text-decoration-none">
{{ movie.title }}
</a>
</h5>
<div class="d-flex align-items-center gap-2 small text-muted mb-2">
{% if movie.release_date %}
<span>{{ movie.release_date|date('Y') }}</span>
{% endif %}
{% if movie.rating %}
<span>⭐ {{ movie.rating }}/10</span>
{% endif %}
</div>
{% if movie.source_name %}
<p class="card-text small text-muted mb-2">
{{ movie.source_name }}
</p>
{% endif %}
</div>
</div>
{% if movie.overview %}
<div class="mt-3">
<p class="card-text small text-muted" style="display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;">
{{ movie.overview|slice(0, 150) }}{% if movie.overview|length > 150 %}...{% endif %}
</p>
</div>
{% endif %}
<div class="mt-3 d-flex justify-content-between align-items-center small text-muted">
{% if movie.runtime_minutes %}
<span>{{ (movie.runtime_minutes / 60)|round(1) }}h {{ movie.runtime_minutes % 60 }}m</span>
{% endif %}
<div class="d-flex gap-1">
{% if movie.watched %}
<span class="badge bg-success">
Watched
</span>
</div>
<div class="ml-3 flex-1">
<h5 class="text-lg font-semibold mb-1">
<a href="{{ path_for('movies.show', {'id': movie.id}) }}" class="no-underline text-gray-900 hover:text-blue-600">
{{ movie.title }}
</a>
</h5>
<div class="flex items-center gap-2 text-sm text-gray-600 mb-2">
{% if movie.release_date %}
<span>{{ movie.release_date|date('Y') }}</span>
{% endif %}
{% if movie.is_favorite %}
<span class="badge bg-danger">
Favorite
</span>
{% if movie.rating %}
<span>⭐ {{ movie.rating }}/10</span>
{% endif %}
</div>
{% if movie.source_name %}
<p class="text-sm text-gray-600 mb-2">
{{ movie.source_name }}
</p>
{% endif %}
</div>
</div>
{% if movie.overview %}
<div class="mt-3">
<p class="text-sm text-gray-600" style="display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;">
{{ movie.overview|slice(0, 150) }}{% if movie.overview|length > 150 %}...{% endif %}
</p>
</div>
{% endif %}
<div class="mt-3 flex justify-between items-center text-sm text-gray-600">
{% if movie.runtime_minutes %}
<span>{{ (movie.runtime_minutes / 60)|round(1) }}h {{ movie.runtime_minutes % 60 }}m</span>
{% endif %}
<div class="flex gap-1">
{% if movie.watched %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
Watched
</span>
{% endif %}
{% if movie.is_favorite %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
Favorite
</span>
{% endif %}
</div>
</div>
</div>
@@ -365,42 +485,89 @@
</div>
{% endif %}
<!-- Pagination -->
<!-- Top Pagination & Controls -->
{% if pagination.total_pages > 1 %}
<div class="d-flex align-items-center justify-content-between mt-4">
<div class="d-flex align-items-center gap-2">
<label for="per_page" class="form-label mb-0">Show:</label>
<select id="per_page" class="form-select form-select-sm w-auto">
<option value="12" {{ pagination.per_page == 12 ? 'selected' : '' }}>12</option>
<option value="24" {{ pagination.per_page == 24 ? 'selected' : '' }}>24</option>
<option value="48" {{ pagination.per_page == 48 ? 'selected' : '' }}>48</option>
<option value="100" {{ pagination.per_page == 100 ? 'selected' : '' }}>100</option>
</select>
<span class="text-muted small">per page</span>
<div class="flex items-center justify-between mb-6 p-4 bg-gray-50 rounded-lg">
<div class="flex items-center gap-4">
<div class="text-sm text-gray-700">
Showing {{ (pagination.current_page - 1) * pagination.per_page + 1 }} to {{ min(pagination.current_page * pagination.per_page, pagination.total_items) }} of {{ pagination.total_items }} movies
</div>
<div class="flex items-center gap-2">
<label for="per_page_top" class="text-sm font-medium text-gray-700">Show:</label>
<select id="per_page_top" class="text-sm border border-gray-300 rounded px-2 py-1 focus:ring-blue-500 focus:border-blue-500">
<option value="12" {{ pagination.per_page == 12 ? 'selected' : '' }}>12</option>
<option value="24" {{ pagination.per_page == 24 ? 'selected' : '' }}>24</option>
<option value="48" {{ pagination.per_page == 48 ? 'selected' : '' }}>48</option>
<option value="100" {{ pagination.per_page == 100 ? 'selected' : '' }}>100</option>
</select>
<span class="text-sm text-gray-600">per page</span>
</div>
</div>
<div class="d-flex align-items-center gap-2">
<div class="flex items-center space-x-2">
<!-- Previous Button -->
{% if pagination.has_prev %}
<a href="?page={{ pagination.prev_page }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="btn btn-outline-secondary btn-sm">
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</svg>
Previous
</a>
{% else %}
<span class="px-3 py-2 text-sm font-medium text-gray-300 bg-gray-100 border border-gray-200 rounded-lg cursor-not-allowed flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</svg>
Previous
</span>
{% endif %}
<div class="btn-group" role="group">
{% for page_num in range(max(1, pagination.current_page - 2), min(pagination.total_pages, pagination.current_page + 2)) %}
<a href="?page={{ page_num }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="btn btn-sm {{ page_num == pagination.current_page ? 'btn-primary' : 'btn-outline-secondary' }}">
{{ page_num }}
</a>
{% endfor %}
</div>
<!-- Page Numbers -->
{% set start_page = max(1, pagination.current_page - 2) %}
{% set end_page = min(pagination.total_pages, pagination.current_page + 2) %}
{% if start_page > 1 %}
<a href="?page=1{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors">1</a>
{% if start_page > 2 %}
<span class="px-2 py-2 text-sm font-medium text-gray-500">...</span>
{% endif %}
{% endif %}
{% for page_num in start_page..end_page %}
{% if page_num == pagination.current_page %}
<span class="px-3 py-2 text-sm font-medium text-white bg-blue-600 border border-blue-600 rounded-lg">{{ page_num }}</span>
{% else %}
<a href="?page={{ page_num }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors">{{ page_num }}</a>
{% endif %}
{% endfor %}
{% if end_page < pagination.total_pages %}
{% if end_page < pagination.total_pages - 1 %}
<span class="px-2 py-2 text-sm font-medium text-gray-500">...</span>
{% endif %}
<a href="?page={{ pagination.total_pages }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors">{{ pagination.total_pages }}</a>
{% endif %}
<!-- Next Button -->
{% if pagination.has_next %}
<a href="?page={{ pagination.next_page }}{% if search %}&search={{ search }}{% endif %}{% if pagination.per_page != 24 %}&per_page={{ pagination.per_page }}{% endif %}&view={{ view_mode }}{% for genre in filters.genres %}&genres[]={{ genre }}{% endfor %}{% for director in filters.directors %}&directors[]={{ director }}{% endfor %}"
class="btn btn-outline-secondary btn-sm">
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:text-gray-700 transition-colors flex items-center">
Next
<svg class="w-4 h-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
</a>
{% else %}
<span class="px-3 py-2 text-sm font-medium text-gray-300 bg-gray-100 border border-gray-200 rounded-lg cursor-not-allowed flex items-center">
Next
<svg class="w-4 h-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
</span>
{% endif %}
</div>
</div>
@@ -504,6 +671,13 @@ document.getElementById('per_page')?.addEventListener('change', function() {
url.searchParams.set('page', '1'); // Reset to first page
window.location = url.toString();
});
document.getElementById('per_page_top')?.addEventListener('change', function() {
const url = new URL(window.location);
url.searchParams.set('per_page', this.value);
url.searchParams.set('page', '1'); // Reset to first page
window.location = url.toString();
});
</script>
{% endblock %}

View File

@@ -1,349 +1,413 @@
{% extends "layouts/app.twig" %}
{% block content %}
<div class="container-fluid px-4 py-3">
<!-- Back button -->
<div class="mb-4">
<a href="{{ path_for('movies.index') }}" class="btn btn-link text-decoration-none p-0">
<svg class="me-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</svg>
Back to Movies
</a>
</div>
<!-- Hero Section with Backdrop -->
<div class="relative">
{% if movie.backdrop_url %}
<div class="h-96 md:h-[500px] relative overflow-hidden">
<img src="/images/{{ movie.backdrop_url }}" alt="{{ movie.title }} backdrop" class="w-full h-full object-cover">
<div class="absolute inset-0 bg-gradient-to-t from-black via-black/50 to-transparent"></div>
<div class="absolute inset-0 bg-gradient-to-r from-black/80 via-black/40 to-transparent"></div>
<div class="card shadow-sm">
<div class="row g-0">
<!-- Movie poster -->
<div class="col-md-4">
<div class="card-body p-4">
<div class="ratio ratio-2x3">
<!-- Back button -->
<div class="absolute top-4 left-4 z-10">
<a href="{{ path_for('movies.index') }}" class="inline-flex items-center text-white hover:text-gray-300 transition-colors bg-black/20 backdrop-blur-sm rounded-full px-4 py-2">
<svg class="mr-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</svg>
Back to Movies
</a>
</div>
<!-- Hero Content -->
<div class="absolute bottom-0 left-0 right-0 p-6 md:p-8">
<div class="max-w-4xl">
<h1 class="text-4xl md:text-6xl font-bold text-white mb-2 drop-shadow-lg">{{ movie.title }}</h1>
{% if movie.tagline %}
<p class="text-xl md:text-2xl text-gray-200 mb-4 drop-shadow-md">{{ movie.tagline }}</p>
{% endif %}
<!-- Quick Info -->
<div class="flex flex-wrap gap-4 text-sm text-white mb-4">
{% if movie.release_date %}
<span class="flex items-center bg-black/30 backdrop-blur-sm rounded-full px-3 py-1">
<svg class="mr-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
{{ movie.release_date|date('Y') }}
</span>
{% endif %}
{% if movie.rating %}
<span class="flex items-center bg-black/30 backdrop-blur-sm rounded-full px-3 py-1">
<svg class="mr-2" width="16" height="16" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
{{ movie.rating }}/10
</span>
{% endif %}
{% if movie.runtime_minutes %}
<span class="flex items-center bg-black/30 backdrop-blur-sm rounded-full px-3 py-1">
<svg class="mr-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{{ (movie.runtime_minutes / 60)|round(1) }}h {{ movie.runtime_minutes % 60 }}m
</span>
{% endif %}
</div>
<!-- Status badges -->
<div class="flex flex-wrap gap-2 mb-4">
{% if movie.watched %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-green-500 text-white">
<svg class="mr-2" width="14" height="14" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
</svg>
Watched
</span>
{% endif %}
{% if movie.is_favorite %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-red-500 text-white">
<svg class="mr-2" width="14" height="14" fill="currentColor" viewBox="0 0 20 20">
<path d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z"/>
</svg>
Favorite
</span>
{% endif %}
</div>
<!-- Action buttons -->
<div class="flex flex-wrap gap-3">
<button class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-medium transition-colors flex items-center">
<svg class="mr-2" width="18" height="18" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-6 8a9 9 0 110-18 9 9 0 010 18z"/>
</svg>
Mark as Watched
</button>
<button class="bg-white/10 hover:bg-white/20 backdrop-blur-sm text-white border border-white/30 px-6 py-3 rounded-lg font-medium transition-colors flex items-center">
<svg class="mr-2" width="18" height="18" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
</svg>
Add to Favorites
</button>
</div>
</div>
</div>
</div>
{% else %}
<!-- Fallback hero without backdrop -->
<div class="bg-gradient-to-r from-blue-900 to-purple-900 h-64 relative">
<div class="absolute top-4 left-4 z-10">
<a href="{{ path_for('movies.index') }}" class="inline-flex items-center text-white hover:text-gray-300 transition-colors">
<svg class="mr-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</svg>
Back to Movies
</a>
</div>
<div class="absolute bottom-0 left-0 right-0 p-6">
<h1 class="text-4xl font-bold text-white mb-2">{{ movie.title }}</h1>
{% if movie.tagline %}
<p class="text-xl text-gray-200">{{ movie.tagline }}</p>
{% endif %}
</div>
</div>
{% endif %}
</div>
<!-- Main Content -->
<div class="max-w-7xl mx-auto px-4 py-8">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Poster and Quick Actions -->
<div class="lg:col-span-1">
<div class="sticky top-4">
<!-- Poster -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden mb-6">
<div class="aspect-[2/3]">
{% if movie.poster_url %}
<img src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}" class="img-fluid rounded">
<img src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}" class="w-full h-full object-cover">
{% else %}
<div class="w-100 h-100 d-flex align-items-center justify-content-center bg-light rounded">
<svg class="text-muted" width="96" height="96" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<div class="w-full h-full flex items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200">
<svg class="text-gray-400 w-16 h-16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
</div>
{% endif %}
</div>
</div>
<!-- Action buttons -->
<div class="mt-4 d-grid gap-2">
<button class="btn btn-primary">
<svg class="me-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-6 8a9 9 0 110-18 9 9 0 010 18z"/>
</svg>
Mark as Watched
</button>
<button class="btn btn-outline-danger">
<svg class="me-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
</svg>
Add to Favorites
</button>
<!-- Quick Stats -->
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Quick Stats</h3>
<div class="space-y-3">
{% if movie.vote_count %}
<div class="flex justify-between items-center">
<span class="text-gray-600">Votes</span>
<span class="font-medium">{{ movie.vote_count|number_format }}</span>
</div>
{% endif %}
{% if movie.watch_count %}
<div class="flex justify-between items-center">
<span class="text-gray-600">Watch Count</span>
<span class="font-medium">{{ movie.watch_count }}</span>
</div>
{% endif %}
<div class="flex justify-between items-center">
<span class="text-gray-600">Source</span>
<span class="font-medium">{{ movie.source_name }}</span>
</div>
</div>
</div>
</div>
</div>
<!-- Movie details -->
<div class="col-md-8">
<div class="card-body p-4">
<div class="mb-4">
<h1 class="display-4 fw-bold text-dark mb-2">{{ movie.title }}</h1>
{% if movie.tagline %}
<p class="lead text-muted mb-3">{{ movie.tagline }}</p>
{% endif %}
<!-- Main Details -->
<div class="lg:col-span-2 space-y-8">
<!-- Overview -->
{% if movie.overview %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Overview</h2>
<p class="text-gray-700 leading-relaxed">{{ movie.overview }}</p>
</div>
{% endif %}
<!-- Movie metadata -->
<div class="d-flex flex-wrap gap-3 small text-muted mb-3">
{% if movie.release_date %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
{{ movie.release_date|date('Y') }}
</span>
{% endif %}
<!-- Cast & Crew -->
<div class="bg-white rounded-xl shadow-lg p-6">
<h2 class="text-2xl font-bold text-gray-900 mb-6">Cast & Crew</h2>
{% if movie.rating %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
{{ movie.rating }}/10
</span>
{% endif %}
{% if movie.runtime_minutes %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{{ (movie.runtime_minutes / 60)|round(1) }}h {{ movie.runtime_minutes % 60 }}m
</span>
{% endif %}
{% if movie.vote_count %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"/>
</svg>
{{ movie.vote_count }} votes
</span>
{% endif %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"/>
</svg>
{{ movie.source_name }}
</span>
<!-- Director and Writer -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
{% if movie.director %}
<div class="flex items-start">
<div class="bg-blue-100 rounded-full p-3 mr-4">
<svg class="text-blue-600" width="24" height="24" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
</div>
<!-- Status badges -->
<div class="d-flex flex-wrap gap-2">
{% if movie.watched %}
<span class="badge bg-success d-flex align-items-center">
<svg class="me-1" width="12" height="12" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
</svg>
Watched
</span>
{% endif %}
{% if movie.watch_count > 0 %}
<span class="badge bg-primary">{{ movie.watch_count }} watch{{ movie.watch_count > 1 ? 'es' : '' }}</span>
{% endif %}
{% if movie.is_favorite %}
<span class="badge bg-danger d-flex align-items-center">
<svg class="me-1" width="12" height="12" fill="currentColor" viewBox="0 0 20 20">
<path d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z"/>
</svg>
Favorite
</span>
{% endif %}
{% if movie.status %}
<span class="badge bg-secondary">{{ movie.status|title }}</span>
{% endif %}
</div>
</div>
<!-- Overview -->
{% if movie.overview %}
<div class="mb-4">
<h2 class="h5 fw-semibold text-dark mb-2">Overview</h2>
<p class="text-muted">{{ movie.overview }}</p>
</div>
{% endif %}
<!-- Cast & Crew Section -->
<div class="mb-4">
<h2 class="h5 fw-semibold text-dark mb-3">Cast & Crew</h2>
<div class="row g-3">
{% if movie.director %}
<div class="col-md-6">
<div class="d-flex align-items-center">
<svg class="me-2 text-muted" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
<div>
<small class="text-muted d-block">Director</small>
<span class="fw-medium">{{ movie.director }}</span>
</div>
</div>
</div>
{% endif %}
{% if movie.writer %}
<div class="col-md-6">
<div class="d-flex align-items-center">
<svg class="me-2 text-muted" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
</svg>
<div>
<small class="text-muted d-block">Writer</small>
<span class="fw-medium">{{ movie.writer }}</span>
</div>
</div>
</div>
{% endif %}
</div>
{% if actors %}
<div class="mt-3">
<small class="text-muted d-block mb-2">Cast</small>
<div class="d-flex flex-wrap gap-2">
{% for actor in actors %}
<span class="badge bg-light text-dark">{{ actor.name }}</span>
{% endfor %}
</div>
</div>
{% endif %}
</div>
<!-- Movie Details Grid -->
<div class="row g-4 mb-4">
<!-- Genres -->
{% if movie.genre %}
<div class="col-md-4">
<h3 class="h6 fw-semibold text-dark mb-3">Genres</h3>
<div class="d-flex flex-wrap gap-2">
{% for genre in movie.genre|split(',') %}
<span class="badge bg-primary">{{ genre|trim }}</span>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Production -->
{% if movie.production_companies or movie.production_countries %}
<div class="col-md-4">
<h3 class="h6 fw-semibold text-dark mb-3">Production</h3>
<div class="mb-2">
{% if movie.production_companies %}
<small class="text-muted d-block">Companies</small>
<span class="fw-medium">{{ movie.production_companies }}</span>
{% endif %}
</div>
{% if movie.production_countries %}
<div class="mb-2">
<small class="text-muted d-block">Countries</small>
<span class="fw-medium">{{ movie.production_countries }}</span>
</div>
{% endif %}
</div>
{% endif %}
<!-- Technical Details -->
{% if movie.budget or movie.revenue or movie.original_language %}
<div class="col-md-4">
<h3 class="h6 fw-semibold text-dark mb-3">Technical</h3>
<div class="mb-2">
{% if movie.budget %}
<small class="text-muted d-block">Budget</small>
<span class="fw-medium">${{ movie.budget|number_format(0, '.', ',') }}</span>
{% endif %}
</div>
{% if movie.revenue %}
<div class="mb-2">
<small class="text-muted d-block">Revenue</small>
<span class="fw-medium">${{ movie.revenue|number_format(0, '.', ',') }}</span>
</div>
{% endif %}
{% if movie.original_language %}
<div class="mb-2">
<small class="text-muted d-block">Language</small>
<span class="fw-medium">{{ movie.original_language|upper }}</span>
</div>
{% endif %}
</div>
{% endif %}
</div>
<!-- Collection/Series Info -->
{% if movie.belongs_to_collection %}
<div class="mb-4 p-3 bg-light rounded">
<h3 class="h6 fw-semibold text-dark mb-2">Collection</h3>
<span class="fw-medium">{{ movie.belongs_to_collection }}</span>
</div>
{% endif %}
<!-- Streaming & Availability -->
{% if movie.streaming_providers or movie.availability %}
<div class="mb-4">
<h3 class="h5 fw-semibold text-dark mb-3">Where to Watch</h3>
<div class="row g-3">
{% if movie.streaming_providers %}
<div class="col-md-6">
<small class="text-muted d-block mb-2">Streaming</small>
<div class="d-flex flex-wrap gap-2">
{% for provider in movie.streaming_providers %}
<span class="badge bg-success">{{ provider }}</span>
{% endfor %}
</div>
</div>
{% endif %}
{% if movie.availability %}
<div class="col-md-6">
<small class="text-muted d-block mb-2">Availability</small>
<span class="fw-medium">{{ movie.availability }}</span>
</div>
{% endif %}
<div>
<h3 class="font-semibold text-gray-900">Director</h3>
<p class="text-gray-600">{{ movie.director }}</p>
</div>
</div>
{% endif %}
<!-- User Reviews & Ratings -->
{% if movie.user_reviews or movie.critic_reviews %}
<div class="mb-4">
<h3 class="h5 fw-semibold text-dark mb-3">Reviews & Ratings</h3>
<div class="row g-4">
{% if movie.user_reviews %}
<div class="col-md-6">
<h4 class="h6 fw-semibold text-dark mb-2">User Reviews</h4>
<div class="vstack gap-3">
{% for review in movie.user_reviews[:3] %}
<div class="p-3 bg-light rounded">
<div class="d-flex align-items-center mb-2">
<div class="d-flex text-warning">
{% for i in 1..5 %}
<svg class="me-1" width="16" height="16" fill="{{ i <= review.rating ? 'currentColor' : 'none' }}" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
{% endfor %}
</div>
<span class="ms-2 small text-muted">{{ review.author }}</span>
</div>
<p class="small text-muted">{{ review.content|slice(0, 150) }}{% if review.content|length > 150 %}...{% endif %}</p>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% if movie.critic_reviews %}
<div class="col-md-6">
<h4 class="h6 fw-semibold text-dark mb-2">Critic Reviews</h4>
<div class="vstack gap-3">
{% for review in movie.critic_reviews[:3] %}
<div class="p-3 bg-light rounded">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="fw-medium">{{ review.publication }}</span>
<span class="badge bg-info">{{ review.rating }}/100</span>
</div>
<p class="small text-muted">{{ review.excerpt|slice(0, 150) }}{% if review.excerpt|length > 150 %}...{% endif %}</p>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% if movie.writer %}
<div class="flex items-start">
<div class="bg-green-100 rounded-full p-3 mr-4">
<svg class="text-green-600" width="24" height="24" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
</svg>
</div>
<div>
<h3 class="font-semibold text-gray-900">Writer</h3>
<p class="text-gray-600">{{ movie.writer }}</p>
</div>
</div>
{% endif %}
<!-- Metadata (for debugging/advanced users) -->
{% if metadata %}
<div class="mt-4 pt-4 border-top">
<details class="group">
<summary class="cursor-pointer small fw-medium text-muted hover:text-dark d-flex align-items-center">
<svg class="me-2 group-open:rotate-90 transition-transform" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
Technical Details & Metadata
</summary>
<div class="mt-3 small">
<pre class="bg-light p-3 rounded"><code>{{ metadata|json_encode(constant('JSON_PRETTY_PRINT')) }}</code></pre>
</div>
</details>
</div>
{% endif %}
</div>
<!-- Cast -->
{% if actors %}
<div>
<h3 class="text-lg font-semibold text-gray-900 mb-4">Cast</h3>
<div class="grid grid-cols-2 md:grid-cols-3 gap-4">
{% for actor in actors %}
<div class="flex items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors">
<div class="w-10 h-10 bg-gradient-to-br from-blue-400 to-purple-500 rounded-full flex items-center justify-center mr-3">
<span class="text-white font-medium text-sm">{{ actor.name|first|upper }}</span>
</div>
<div>
<p class="font-medium text-gray-900 text-sm">{{ actor.name }}</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
<!-- Details Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Genres -->
{% if movie.genre %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Genres</h3>
<div class="flex flex-wrap gap-2">
{% for genre in movie.genre|split(',') %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-800">{{ genre|trim }}</span>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Production -->
{% if movie.production_companies or movie.production_countries %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Production</h3>
{% if movie.production_companies %}
<div class="mb-3">
<p class="text-sm text-gray-600 mb-1">Companies</p>
<p class="font-medium">{{ movie.production_companies }}</p>
</div>
{% endif %}
{% if movie.production_countries %}
<div>
<p class="text-sm text-gray-600 mb-1">Countries</p>
<p class="font-medium">{{ movie.production_countries }}</p>
</div>
{% endif %}
</div>
{% endif %}
<!-- Technical Details -->
{% if movie.budget or movie.revenue or movie.original_language %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Technical</h3>
{% if movie.budget %}
<div class="mb-3">
<p class="text-sm text-gray-600 mb-1">Budget</p>
<p class="font-medium">${{ movie.budget|number_format(0, '.', ',') }}</p>
</div>
{% endif %}
{% if movie.revenue %}
<div class="mb-3">
<p class="text-sm text-gray-600 mb-1">Revenue</p>
<p class="font-medium">${{ movie.revenue|number_format(0, '.', ',') }}</p>
</div>
{% endif %}
{% if movie.original_language %}
<div>
<p class="text-sm text-gray-600 mb-1">Language</p>
<p class="font-medium">{{ movie.original_language|upper }}</p>
</div>
{% endif %}
</div>
{% endif %}
</div>
<!-- Collection Info -->
{% if movie.belongs_to_collection %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Collection</h2>
<div class="flex items-center">
<div class="bg-purple-100 rounded-full p-3 mr-4">
<svg class="text-purple-600" width="24" height="24" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/>
</svg>
</div>
<div>
<h3 class="font-semibold text-gray-900">{{ movie.belongs_to_collection }}</h3>
<p class="text-gray-600">Part of a collection</p>
</div>
</div>
</div>
{% endif %}
<!-- Technical Details & Metadata -->
{% if metadata %}
<div class="space-y-6">
<h2 class="text-2xl font-bold text-gray-900">Technical Details & Metadata</h2>
<!-- Jellyfin ID -->
{% if metadata.jellyfin_id %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-3 flex items-center">
<svg class="mr-2 text-blue-600" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"/>
</svg>
Jellyfin ID
</h3>
<div class="bg-gray-50 rounded-lg p-3">
<code class="text-sm text-gray-800 font-mono">{{ metadata.jellyfin_id }}</code>
</div>
</div>
{% endif %}
<!-- Genres -->
{% if metadata.genres %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-3 flex items-center">
<svg class="mr-2 text-green-600" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"/>
</svg>
Genres
</h3>
<div class="flex flex-wrap gap-2">
{% for genre in metadata.genres %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-800">{{ genre }}</span>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Studios -->
{% if metadata.studios %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-3 flex items-center">
<svg class="mr-2 text-purple-600" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/>
</svg>
Studios
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
{% for studio in metadata.studios %}
<div class="bg-gray-50 rounded-lg p-3">
<p class="font-medium text-gray-900">{{ studio.Name }}</p>
<p class="text-xs text-gray-600 font-mono">{{ studio.Id }}</p>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Image URLs -->
{% if metadata.poster_url or metadata.backdrop_url %}
<div class="bg-white rounded-xl shadow-lg p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-3 flex items-center">
<svg class="mr-2 text-orange-600" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
Image URLs
</h3>
<div class="space-y-3">
{% if metadata.poster_url %}
<div>
<p class="text-sm font-medium text-gray-700 mb-1">Poster URL</p>
<div class="bg-gray-50 rounded-lg p-3 overflow-x-auto">
<code class="text-xs text-gray-800 font-mono break-all">{{ metadata.poster_url }}</code>
</div>
</div>
{% endif %}
{% if metadata.backdrop_url %}
<div>
<p class="text-sm font-medium text-gray-700 mb-1">Backdrop URL</p>
<div class="bg-gray-50 rounded-lg p-3 overflow-x-auto">
<code class="text-xs text-gray-800 font-mono break-all">{{ metadata.backdrop_url }}</code>
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
<!-- Raw Metadata (Collapsible) -->
<div class="bg-white rounded-xl shadow-lg p-6">
<details class="group">
<summary class="cursor-pointer flex items-center text-gray-700 hover:text-gray-900 transition-colors">
<svg class="mr-2 group-open:rotate-90 transition-transform" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
<span class="font-medium">Full Raw Metadata</span>
</summary>
<div class="mt-4 bg-gray-50 rounded-lg p-4 overflow-x-auto">
<pre class="text-xs text-gray-800 whitespace-pre-wrap"><code>{{ metadata|json_encode(constant('JSON_PRETTY_PRINT')) }}</code></pre>
</div>
</details>
</div>
</div>
{% endif %}
</div>
</div>
</div>