:root {
    --color-background: #1a1a2e;
    --color-surface: #2d2d44;
    --color-header: #16213e;
    --color-border: #3d3d5c;
    --color-text: #e0e0e0;
    --color-primary: #3498db;
    --control-radius: 6px;
    --overlay-z-index: 1000;
}

/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100dvh;
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
}

/* Dark theme scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #3d3d5c;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a6a;
}

#app {
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.media-player-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--overlay-z-index);
    background-color: #000;
}

.media-player-overlay iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Header */
header {
    background-color: #16213e;
    color: #e0e0e0;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #2d2d44;
}

header h1 {
    font-size: 18px;
    flex: 1;
}

/* ================================================================= */
/* Login Page */
/* ================================================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    background-color: #2d2d44;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.login-header {
    background-color: #16213e;
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid #3d3d5c;
}

.login-header h1 {
    color: #e0e0e0;
    font-size: 22px;
    margin: 0;
}

.login-form {
    padding: 30px;
}

.login-error {
    background-color: rgba(231, 76, 60, 0.15);
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    color: #b0b0b0;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-field input {
    width: 100%;
    padding: 12px 14px;
    background-color: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.login-field input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.login-field input::placeholder {
    color: #6b6b7b;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.login-btn:hover:not(:disabled) {
    background-color: #2980b9;
}

.login-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.login-btn:disabled {
    background-color: #5a5a7a;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #2d2d44;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    border: 1px solid #3d3d5c;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
}

.text-action,
.sort-header-button,
.tag-item-main {
    appearance: none;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: inherit;
}

.text-action:not(:disabled),
.sort-header-button,
.tag-item-main {
    cursor: pointer;
}

.text-action:disabled {
    cursor: default;
}

.text-action:focus-visible,
.sort-header-button:focus-visible,
.tag-item-main:focus-visible,
.pref-icon:focus-visible,
.column-resize-handle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.sort-header-button {
    width: 100%;
    font-weight: inherit;
}

.column-resize-handle {
    position: absolute;
    top: 0;
    right: -5px;
    bottom: 0;
    width: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
}

.tile-thumbnail.is-downloaded {
    cursor: pointer;
}

.bottom-sheet-close {
    display: none;
    width: 100%;
    margin-bottom: 8px;
}

.modal-content h2 {
    margin-bottom: 12px;
    font-size: 18px;
    color: #e0e0e0;
}

.modal-content form {
    display: flex;
    flex-direction: column;
}

.modal-content label {
    margin-top: 8px;
    margin-bottom: 4px;
    font-weight: bold;
    font-size: 13px;
    color: #b0b0b0;
}

.modal-content input {
    padding: 6px;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    font-size: 13px;
    background-color: #1a1a2e;
    color: #e0e0e0;
}

.modal-content button:not(.text-action, .pref-icon) {
    margin-top: 12px;
    padding: 8px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.modal-content button:not(.text-action, .pref-icon):hover {
    background-color: #2980b9;
}

/* File selection modal */
.file-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    max-height: 400px;
    overflow-y: auto;
}

.file-list li {
    margin-bottom: 8px;
}

.file-item {
    width: 100%;
    text-align: left;
    padding: 12px;
    background-color: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
    color: #e0e0e0;
}

.file-item:hover {
    background-color: #3d3d5c;
    border-color: #3498db;
}

.cancel-btn {
    background-color: #95a5a6;
}

.cancel-btn:hover {
    background-color: #7f8c8d;
}

/* Tab Content */
.tab-content {
    background-color: #1a1a2e;
    padding: 10px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tab-pane {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Vue.js uses v-show for tab visibility, no need for CSS display rules */

/* Filters */
.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.selection-date-row {
    display: contents;
}

.filter-group label {
    font-weight: bold;
    white-space: nowrap;
    font-size: 13px;
    color: #b0b0b0;
}

.filter-group input[type="text"],
.filter-group input[type="date"],
.filter-group select {
    padding: 4px 8px;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    font-size: 13px;
    background-color: #2d2d44;
    color: #e0e0e0;
}

.queue-add-group input[type="text"] {
    min-width: 150px;
}

.queue-add-group button:disabled,
.filter-row > button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.filter-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

button {
    padding: 5px 12px;
    border: 1px solid #3d3d5c;
    background-color: #2d2d44;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    font-size: 13px;
}

button:hover {
    background-color: #3d3d5c;
}

button.primary {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

button.primary:hover {
    background-color: #2980b9;
}

button.danger {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

button.danger:hover {
    background-color: #c0392b;
}

/* Slider */
.slider-group {
    min-width: 250px;
}

.slider {
    width: 180px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    margin-top: 8px;
    flex: 1;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #1a1a2e;
}

thead {
    background-color: #16213e;
    color: #e0e0e0;
}

th,
td {
    padding: 4px 6px;
    text-align: left;
    border: 1px solid #3d3d5c;
    font-size: 13px;
    color: #e0e0e0;
}

th {
    font-weight: bold;
    position: sticky;
    top: -1px;
    background-color: #16213e;
    z-index: 10;
    font-size: 13px;
    /* Prevent content showing above header during scroll */
    box-shadow: 0 -2px 0 0 #16213e;
}

tbody tr:nth-child(even) {
    background-color: #22223a;
}

tbody tr:hover {
    background-color: #2d2d44;
}

.loading {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

/* Movies Table Resizable Columns */
.movies-table {
    table-layout: fixed;
    width: 100%;
}

.movies-table th.resizable {
    position: sticky;
    top: -1px;
    user-select: none;
    background-color: #16213e;
    z-index: 10;
    box-shadow: 0 -2px 0 0 #16213e;
}

.movies-table th.resizable::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background-color: transparent;
    pointer-events: auto;
}

.movies-table th.resizable:hover::after {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Ensure table cells have higher z-index than sticky header pseudo-elements */
.movies-table tbody td {
    position: relative;
    z-index: 1;
}

/* Column widths */
.movies-table .col-thumbnail {
    width: 151px;
    /* Tight fit: thumbnail actual width (~147px) + padding (4px) */
}

.movies-table .col-identifier {
    width: 178px;
}

.movies-table .col-publish-date {
    width: 85px;
}

.movies-table .col-download-time {
    width: 181px;
}

.movies-table .col-sizes {
    width: 60px;
}

.movies-table .col-actresses {
    width: 290px;
}

.movies-table .col-categories {
    width: auto;
    /* Auto-expand to absorb extra table width */
}

.movies-table .col-operations {
    width: 90px;
}

/* Thumbnail */
.thumbnail {
    display: block;
    max-width: 147px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.movies-table td:first-child {
    padding: 2px;
}

/* Queue Table Resizable Columns */
.queue-table {
    table-layout: fixed;
}

.queue-table th.resizable {
    position: sticky;
    top: -1px;
    user-select: none;
    background-color: #16213e;
    z-index: 10;
    box-shadow: 0 -2px 0 0 #16213e;
}

.queue-table th.resizable::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background-color: transparent;
    pointer-events: auto;
}

.queue-table th.resizable:hover::after {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Ensure table cells have higher z-index than sticky header pseudo-elements */
.queue-table tbody td {
    position: relative;
    z-index: 1;
}

/* Queue table column widths */
.queue-table .col-queue-id {
    width: 65px;
}

.queue-table .col-identifier {
    width: 85px;
}

.queue-table .col-publish-date {
    width: 90px;
}

.queue-table .col-added-time {
    width: 150px;
}

.queue-table .col-retry-count {
    width: 75px;
}

.queue-table .col-operations {
    width: 80px;
}

/* Operations Column */
.operations {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.operations button {
    padding: 3px 6px;
    font-size: 11px;
}

/* Combine Sections */
.combine-section-vertical {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.combine-section-vertical h2 {
    margin-bottom: 8px;
    font-size: 16px;
    flex-shrink: 0;
    color: #e0e0e0;
}

.combine-section {
    display: flex;
    gap: 15px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.combine-section.three-column {
    gap: 12px;
}

.combine-column {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.combine-column h3 {
    margin-bottom: 6px;
    flex-shrink: 0;
    font-size: 14px;
    color: #b0b0b0;
}

.combine-column h3:first-child {
    margin-top: 0;
}

.combine-column h3:not(:first-child) {
    margin-top: 15px;
}

/* Tag List Styles */
.tag-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px;
    background-color: #22223a;
}

.tag-item {
    padding: 4px 8px;
    background-color: #3d3d5c;
    border-radius: 4px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #e0e0e0;
}

.tag-item.empty {
    color: #7f8c8d;
    font-style: italic;
    background-color: transparent;
    width: 100%;
    justify-content: center;
}

.tag-item.clickable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.tag-item.clickable:hover {
    background-color: #4a4a6a;
}

.tag-item.selected {
    background-color: #3498db;
    color: white;
}

/* Selected Tags (in middle column) */
.selected-list .tag-item.selected-tag {
    background-color: #27ae60;
    color: white;
}

/* Combined Tags (in right column) */
.tag-item.combined-tag {
    background-color: #9b59b6;
    color: white;
}

.tag-item.combined-tag:hover {
    background-color: #8e44ad;
}

.tag-item.combined-tag.selected {
    background-color: #2980b9;
    box-shadow: 0 0 0 2px #3498db;
}

/* Tag Remove Button (X) */
.tag-remove {
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    opacity: 0.7;
    padding: 0 2px;
    margin-left: 2px;
}

.tag-remove:hover {
    opacity: 1;
}

.selected-tag .tag-remove:hover {
    color: #c0392b;
}

.combined-tag .tag-remove:hover {
    color: #e74c3c;
}

.combine-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-shrink: 0;
}

.combine-actions button {
    flex: 1;
}

.combine-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stats */
.stats-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.stats-section {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.stats-section h3 {
    margin-bottom: 6px;
    flex-shrink: 0;
    font-size: 14px;
    color: #e0e0e0;
}

.stats-section .table-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

/* Stats Tables Resizable Columns */
.stats-symbols-table,
.stats-actresses-table,
.stats-categories-table {
    table-layout: fixed;
}

.stats-symbols-table th.resizable,
.stats-actresses-table th.resizable,
.stats-categories-table th.resizable {
    position: sticky;
    top: -1px;
    user-select: none;
    background-color: #16213e;
    z-index: 10;
    box-shadow: 0 -2px 0 0 #16213e;
}

.stats-symbols-table th.resizable::after,
.stats-actresses-table th.resizable::after,
.stats-categories-table th.resizable::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background-color: transparent;
    pointer-events: auto;
}

.stats-symbols-table th.resizable:hover::after,
.stats-actresses-table th.resizable:hover::after,
.stats-categories-table th.resizable:hover::after {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Ensure table cells have higher z-index than sticky header pseudo-elements */
.stats-symbols-table tbody td,
.stats-actresses-table tbody td,
.stats-categories-table tbody td {
    position: relative;
    z-index: 1;
}

/* Stats table column widths */
.stats-symbols-table .col-stats-symbol {
    width: 70px;
}

.stats-symbols-table .col-stats-seen,
.stats-symbols-table .col-stats-imported,
.stats-symbols-table .col-stats-downloaded,
.stats-actresses-table .col-stats-seen,
.stats-actresses-table .col-stats-imported,
.stats-actresses-table .col-stats-downloaded,
.stats-categories-table .col-stats-seen,
.stats-categories-table .col-stats-imported,
.stats-categories-table .col-stats-downloaded {
    width: 70px;
}

.stats-actresses-table .col-stats-actress-names {
    width: 150px;
}

.stats-categories-table .col-stats-category-names {
    width: 150px;
}

.stats-name-cell {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.stats-name-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-user-select: text;
    user-select: text;
}

.stats-name-link:hover {
    color: #3498db;
    text-decoration: underline;
}

.stats-name-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Summary row styling for Statistics tables */
tfoot .summary-row {
    background-color: #1e3a5f;
    border-top: 2px solid #3498db;
    position: sticky;
    bottom: 0;
    z-index: 9;
}

tfoot .summary-row td {
    font-weight: bold;
    color: #e0e0e0;
    background-color: #1e3a5f;
}

tfoot .summary-row:hover {
    background-color: #254a73;
}

tfoot .summary-row:hover td {
    background-color: #254a73;
}

/* Multi-line text */
.multiline {
    white-space: pre-line;
}

/* Sortable headers */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background-color: #1e3a5f;
}

/* Sort arrows for non-resizable sortable columns (Statistics tab) */
th.sortable:not(.resizable)::after {
    content: ' ⇅';
    opacity: 0.5;
}

th.sortable:not(.resizable).sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

th.sortable:not(.resizable).sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

/* Sort arrows for resizable sortable columns (Movies and Queue tabs) - use ::before to avoid conflict with resize handle */
th.sortable.resizable::before {
    content: ' ⇅';
    opacity: 0.5;
    margin-right: 4px;
}

th.sortable.resizable.sort-asc::before {
    content: ' ↑';
    opacity: 1;
}

th.sortable.resizable.sort-desc::before {
    content: ' ↓';
    opacity: 1;
}

/* ================================================================= */
/* View Toggle */
/* ================================================================= */

.view-toggle {
    display: flex;
    gap: 2px;
}

.view-toggle button {
    padding: 4px 8px;
    background-color: #2d2d44;
    border: 1px solid #3d3d5c;
    cursor: pointer;
    font-size: 14px;
    min-width: 32px;
    color: #e0e0e0;
}

.view-toggle button:first-child {
    border-radius: 4px 0 0 4px;
}

.view-toggle button:last-child {
    border-radius: 0 4px 4px 0;
}

.view-toggle button.active {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.view-toggle button:hover:not(.active) {
    background-color: #3d3d5c;
}

.view-icon {
    font-size: 14px;
}

/* ================================================================= */
/* Sort Controls */
/* ================================================================= */

.control-row {
    justify-content: flex-start;
    gap: 16px;
}

.view-organize-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-weight: bold;
    font-size: 13px;
    color: #b0b0b0;
}

.sort-buttons {
    display: flex;
    gap: 4px;
}

.sort-buttons button {
    padding: 4px 10px;
    background-color: #2d2d44;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    color: #e0e0e0;
}

.sort-buttons button:hover:not(.active) {
    background-color: #3d3d5c;
}

.sort-buttons button.active {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.sort-arrow {
    margin-left: 4px;
    font-weight: bold;
}

/* ================================================================= */
/* Date Range */
/* ================================================================= */

.date-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-range label {
    display: none;
}

.date-separator {
    font-weight: bold;
    color: #b0b0b0;
}

/* ================================================================= */
/* Tile View */
/* ================================================================= */

.tile-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    margin-top: 8px;
    padding: 4px;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.movie-tile {
    background-color: #2d2d44;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

.movie-tile:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
    border-color: #3498db;
}

.tile-thumbnail {
    width: 100%;
    aspect-ratio: 3 / 4;
    background-color: #22223a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tile-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile-no-thumbnail {
    color: #7f8c8d;
    font-size: 12px;
    text-align: center;
}

.tile-info {
    padding: 8px;
    background-color: #2d2d44;
}

.tile-row {
    font-size: 11px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-secondary {
    color: #9f9faf;
    margin-top: 2px;
}

.tile-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.tile-actions button {
    flex: 1;
    padding: 4px 8px;
    font-size: 11px;
    min-height: 28px;
}

.tile-loading {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-style: italic;
}

/* ================================================================= */
/* Mobile Responsive Styles */
/* ================================================================= */

/* Tablet screens (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    .bottom-sheet-close {
        display: block;
    }

    /* Header adjustments */
    header h1 {
        font-size: 16px;
    }

    /* Filter rows - stack on tablets */
    .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    /* Control row - keep horizontal on tablets but wrap */
    .control-row {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .sort-controls {
        flex-wrap: wrap;
    }

    .sort-buttons {
        flex-wrap: wrap;
    }

    .filter-group {
        width: 100%;
        justify-content: space-between;
    }

    .filter-group input[type="text"],
    .filter-group input[type="date"],
    .filter-group select {
        flex: 1;
        min-width: 0;
    }

    .filter-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }

    .slider-group {
        width: 100%;
    }

    .slider {
        flex: 1;
        width: auto;
    }

    /* Stats container - stack vertically on tablets */
    .stats-container {
        flex-direction: column;
    }

    .stats-section {
        flex: none;
        height: 400px;
    }

    /* Combine sections - stack on tablets */
    .combine-section {
        flex-direction: column;
    }

    .combine-section.three-column {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .combine-section.three-column .combine-column {
        flex: 1 1 30%;
        min-width: 200px;
        height: 350px;
    }

    .combine-column {
        flex: none;
        height: 400px;
    }

    /* Tag list adjustments for tablets */
    .tag-item {
        font-size: 11px;
        padding: 3px 6px;
    }

    .tag-remove {
        font-size: 12px;
    }
}

/* Mobile phones (max-width: 768px) */
@media screen and (max-width: 768px) {

    /* Reduce overall padding */
    .tab-content {
        padding: 8px;
    }

    /* Header - keep horizontal layout on mobile */
    header {
        padding: 8px 12px;
    }

    header h1 {
        font-size: 15px;
    }

    /* Modal content - full width on mobile */
    .modal-content {
        max-width: 95%;
        padding: 16px;
    }

    .modal-content h2 {
        font-size: 16px;
    }

    .modal-content label,
    .modal-content input,
    .modal-content button {
        font-size: 14px;
    }

    /* File selection modal */
    .file-list {
        max-height: 300px;
    }

    .file-item {
        padding: 10px;
        font-size: 12px;
    }

    /* Filter groups - full width */
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-group label {
        margin-bottom: 4px;
        font-size: 12px;
    }

    .filter-group input[type="text"],
    .filter-group input[type="date"],
    .filter-group select {
        width: 100%;
        font-size: 14px;
        padding: 6px 8px;
    }

    /* Control row on mobile - wrap elements */
    .control-row {
        gap: 8px;
    }

    .sort-controls {
        width: 100%;
        order: 2;
    }

    .view-toggle {
        order: 1;
    }

    .filter-actions {
        order: 3;
    }

    .sort-buttons button {
        padding: 6px 8px;
        font-size: 11px;
    }

    .sort-label {
        font-size: 12px;
    }

    /* Date range on mobile */
    .date-range {
        width: 100%;
        flex-direction: row;
    }

    .date-range input[type="date"] {
        flex: 1;
        min-width: 0;
    }

    /* Buttons - larger touch targets */
    button {
        padding: 8px 14px;
        font-size: 14px;
        min-height: 36px;
    }

    .filter-actions button {
        flex: 1;
    }

    /* Tables - enable horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 12px;
    }

    /* Table text - adjust for readability */
    th,
    td {
        padding: 6px 8px;
        font-size: 12px;
    }

    th {
        font-size: 12px;
    }

    /* Movies table - adjust columns for mobile */
    .movies-table .col-thumbnail {
        width: 120px;
    }

    .movies-table .col-identifier {
        width: 90px;
    }

    .movies-table .col-publish-date {
        width: 95px;
    }

    .movies-table .col-download-time {
        width: 115px;
    }

    .movies-table .col-sizes {
        width: 70px;
    }

    .movies-table .col-actresses {
        width: 140px;
    }

    .movies-table .col-operations {
        width: 85px;
    }

    /* Thumbnail - scale down on mobile */
    .thumbnail {
        max-width: 110px;
        height: auto;
    }

    /* Operations - stack vertically */
    .operations button {
        padding: 6px 8px;
        font-size: 12px;
        min-height: 32px;
    }

    /* Combine sections */
    .combine-section-vertical h2 {
        font-size: 15px;
    }

    .combine-column h3 {
        font-size: 13px;
    }

    .combine-actions {
        flex-direction: column;
    }

    .combine-actions button {
        width: 100%;
    }

    /* Three-column layout stacks on mobile */
    .combine-section.three-column {
        flex-direction: column;
    }

    .combine-section.three-column .combine-column {
        flex: none;
        height: 200px;
        min-width: 100%;
    }

    /* Tag list mobile styles */
    .tag-list {
        padding: 4px;
        gap: 3px;
    }

    .tag-item {
        font-size: 11px;
        padding: 4px 6px;
    }

    .tag-item.empty {
        font-size: 12px;
    }

    .tag-remove {
        font-size: 13px;
        padding: 0 1px;
    }

    /* Stats sections */
    .stats-section {
        flex: none;
        height: 350px;
    }

    .stats-section h3 {
        font-size: 13px;
    }

    /* Queue table columns */
    .queue-table .col-queue-id {
        width: 70px;
    }

    .queue-table .col-identifier {
        width: 95px;
    }

    .queue-table .col-publish-date {
        width: 100px;
    }

    .queue-table .col-added-time {
        width: 155px;
    }

    .queue-table .col-retry-count {
        width: 80px;
    }

    .queue-table .col-operations {
        width: 85px;
    }
}

/* Small mobile phones (max-width: 480px) */
@media screen and (max-width: 480px) {

    /* Further reduce padding */
    .tab-content {
        padding: 6px;
    }

    header {
        padding: 6px 8px;
    }

    header h1 {
        font-size: 14px;
    }

    /* Modal */
    .modal-content {
        padding: 12px;
    }

    .modal-content h2 {
        font-size: 15px;
    }

    /* Smaller buttons */
    button {
        padding: 6px 12px;
        font-size: 13px;
        min-height: 34px;
    }

    /* Table text */
    th,
    td {
        padding: 4px 6px;
        font-size: 11px;
    }

    th {
        font-size: 11px;
    }

    /* Movies table - minimal columns */
    .movies-table .col-thumbnail {
        width: 100px;
    }

    .movies-table .col-identifier {
        width: 80px;
    }

    .movies-table .col-publish-date {
        width: 85px;
    }

    .movies-table .col-download-time {
        width: 105px;
    }

    .movies-table .col-sizes {
        width: 60px;
    }

    .movies-table .col-actresses {
        width: 120px;
    }

    .movies-table .col-operations {
        width: 75px;
    }

    /* Thumbnail */
    .thumbnail {
        max-width: 95px;
    }

    /* Operations buttons - even smaller */
    .operations button {
        padding: 4px 6px;
        font-size: 11px;
        min-height: 28px;
    }

    /* Stats sections */
    .stats-section {
        flex: none;
        height: 300px;
    }

    /* Combine sections */
    .combine-column {
        flex: none;
        height: 300px;
    }
}

/* Landscape mode for phones */
@media screen and (max-width: 896px) and (orientation: landscape) {

    /* Reduce header height in landscape */
    header {
        padding: 5px 10px;
    }

    header h1 {
        font-size: 14px;
    }

    /* Make better use of width */
    .filter-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .filter-group {
        flex: 1 1 auto;
        min-width: 200px;
    }

    /* Stats - side by side if possible */
    .stats-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .stats-section {
        flex: 1 1 300px;
        min-width: 300px;
        height: 300px;
    }
}

/* Touch-friendly enhancements for all mobile devices */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets */
    button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger input fields for touch */
    input[type="text"],
    input[type="password"],
    input[type="date"],
    select {
        min-height: 44px;
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }

    /* Larger clickable areas for table rows */
    tbody tr {
        min-height: 44px;
    }

    /* Disable hover effects on touch devices */
    button:hover,
    tbody tr:hover {
        background-color: inherit;
    }

    /* Use active state instead */
    button:active {
        opacity: 0.7;
    }

}

/* ================================================================= */
/* Mobile Collapsible Filters */
/* ================================================================= */

.filter-toggle-btn {
    display: none;
    background-color: #3498db;
    color: white;
    border: 1px solid #3498db;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 8px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.filter-toggle-btn:active {
    background-color: #2980b9;
}

.filters-collapsible {
    display: contents;
}

/* Desktop/Mobile visibility classes */
.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

/* Floating navigation and filters for tablet and mobile layouts */
@media screen and (max-width: 1024px) {
    header {
        display: block;
        height: 0;
        padding: 0;
        border: 0;
    }

    header h1 {
        display: none;
    }

    .header-mobile-tabs {
        position: fixed;
        top: 12px;
        left: -16px;
        right: auto;
        z-index: 200;
        margin: 0;
    }

    .mobile-tab-toggle,
    .filter-toggle-btn {
        width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    }

    .mobile-tab-dropdown {
        top: calc(100% + 8px);
        right: auto;
        left: 16px;
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 76px);
        overflow-y: auto;
        margin: 0;
    }

    .mobile-control-row {
        display: block;
        position: fixed;
        top: 64px;
        left: -16px;
        right: auto;
        z-index: 200;
        padding: 0;
        background: transparent;
    }

    .mobile-only {
        display: flex;
        flex-wrap: wrap;
    }

    .app-shell .desktop-only {
        display: none;
    }

    .filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        background-color: #3498db;
        border-color: #3498db;
        font-size: 22px;
    }

    .floating-control-label {
        display: none;
    }

    .filters-collapsible {
        display: none;
    }

    .filters-collapsible.expanded {
        display: flex;
        position: fixed;
        top: 116px;
        right: 0;
        left: 0;
        z-index: 190;
        width: 100vw;
        max-height: calc(100dvh - 128px);
        overflow-y: auto;
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        background-color: #22223a;
        border: 1px solid #3d3d5c;
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    }

    /* Mobile control row styling */
    .mobile-only.control-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .mobile-view-organize-row {
        width: 100%;
    }

    .mobile-view-organize-row .organize-btn {
        flex: 1;
    }

    .mobile-only .sort-controls {
        width: 100%;
    }

    .mobile-sort-controls .sort-label {
        display: none;
    }

    .mobile-sort-controls .sort-buttons {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        width: 100%;
    }

    .mobile-sort-controls .sort-buttons button {
        min-width: 0;
        padding-inline: 4px;
    }

    .mobile-only .filter-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .mobile-only .filter-actions button {
        flex: 1;
    }

    .filters-collapsible .filter-row {
        margin: 0;
    }

    .filters-collapsible .filter-group {
        flex-direction: row;
        align-items: center;
    }

    .filters-collapsible .selection-date-row {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .filters-collapsible .selection-date-row .filter-group {
        width: 100%;
    }

    .filters-collapsible .selection-date-row .date-range {
        flex: none;
    }

    .filters-collapsible .filter-group input[type="text"],
    .filters-collapsible .filter-group input[type="date"],
    .filters-collapsible .filter-group select,
    .filters-collapsible .slider {
        width: auto;
        flex: 1;
    }

    .filters-collapsible .filter-actions {
        display: flex;
        flex-direction: row;
        width: 100%;
    }

    /* Ensure tile/table containers take remaining space */
    .tile-container,
    .table-container {
        flex: 1 1 0;
        min-height: 200px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto;
        transition-duration: 0.01ms;
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
    }
}

/* ================================================================= */
/* Toast Notifications */
/* ================================================================= */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: 400px;
}

.toast {
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    animation: slideIn 0.3s ease-out;
    word-wrap: break-word;
}

.toast.success {
    background-color: #27ae60;
}

.toast.error {
    background-color: #e74c3c;
}

.toast.info {
    background-color: #3498db;
}

.toast:hover {
    opacity: 0.9;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ================================================================= */
/* Details Popup */
/* ================================================================= */

.details-popup {
    max-width: 500px;
}

.details-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #3d3d5c;
}

.details-row:last-child {
    border-bottom: none;
}

.details-label {
    font-weight: bold;
    color: #9f9faf;
    min-width: 120px;
    flex-shrink: 0;
}

.details-value {
    flex: 1;
    color: #e0e0e0;
    word-break: break-word;
}

/* Selectable text (allows copy on mobile) */
.selectable {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

/* Menu button (3-dot) */
.menu-btn {
    background-color: #4a4a6a;
    color: #e0e0e0;
    border-color: #4a4a6a;
    font-size: 16px;
    font-weight: bold;
    padding: 4px 10px;
    min-width: 32px;
}

.menu-btn:hover {
    background-color: #5a5a7a;
    border-color: #5a5a7a;
}

/* ================================================================= */
/* iOS Safari Specific Fixes */
/* ================================================================= */

@supports (-webkit-touch-callout: none) {

    /* iOS Safari only */
    html,
    body,
    #app {
        height: -webkit-fill-available;
    }

    #app>div:not(.modal) {
        height: -webkit-fill-available;
        min-height: 0;
    }

    .tab-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .tab-pane {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tile-container,
    .table-container {
        flex: 1 1 auto;
        min-height: 150px;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Keep filter toggle button visible on iOS */
    .filter-toggle-btn {
        position: sticky;
        top: 0;
        z-index: 100;
        flex-shrink: 0;
    }

    /* Make filter rows more compact on iOS */
    .filter-row {
        flex-shrink: 0;
    }

    .filters-collapsible {
        flex-shrink: 0;
    }

    .control-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .sort-buttons button {
        padding: 4px 6px;
        font-size: 11px;
    }
}

/* ================================================================= */
/* Settings Tab */
/* ================================================================= */

.settings-container {
    padding: 20px;
    max-width: 600px;
}

.settings-container h2 {
    color: #e0e0e0;
    margin-bottom: 24px;
    font-size: 20px;
    border-bottom: 1px solid #3d3d5c;
    padding-bottom: 12px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    color: #b0b0b0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.settings-option {
    background-color: #2d2d44;
    border-radius: 8px;
    padding: 16px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: #3498db;
    flex-shrink: 0;
}

.checkbox-text {
    color: #e0e0e0;
    font-size: 15px;
    line-height: 1.4;
}

.settings-description {
    color: #8f8f9f;
    font-size: 13px;
    margin-top: 12px;
    margin-left: 32px;
    line-height: 1.5;
}

/* ================================================================= */
/* Mobile Tab Dropdown */
/* ================================================================= */

/* Mobile control row - hidden on desktop */
.mobile-control-row {
    display: none;
}

/* Mobile tab container for positioning dropdown */
.mobile-tab-container {
    position: relative;
}

/* Stacked tab button always visible (unified UI) */
.header-mobile-tabs {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.mobile-tab-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background-color: #34495e;
    border: 1px solid #4a5f7f;
    border-radius: 6px;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.mobile-tab-toggle:hover {
    background-color: #4a5f7f;
}

.mobile-tab-icon {
    line-height: 1;
}

.mobile-tab-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: #34495e;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-radius: 0 0 6px 6px;
    margin-top: 4px;
}

.mobile-tab-item {
    width: 100%;
    padding: 14px 16px;
    background-color: transparent;
    border: none;
    color: white;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid #2c3e50;
}

.mobile-header-action {
    display: block;
    text-decoration: none;
}

@media screen and (max-width: 1024px) {
    .header-mobile-tabs {
        position: fixed;
        top: 12px;
        left: -16px;
        right: auto;
        z-index: 200;
        margin: 0;
    }

    .mobile-control-row {
        display: block;
    }

    .mobile-tab-toggle {
        border-radius: 0 22px 22px 0;
    }

    .mobile-tab-dropdown {
        top: calc(100% + 8px);
        right: auto;
        left: 16px;
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 76px);
        overflow-y: auto;
        margin: 0;
    }

    .mobile-logout-btn {
        color: #ff9b91;
    }
}

.mobile-tab-item:hover {
    background-color: #4a5f7f;
}

.mobile-tab-item.active {
    background-color: #2c3e50;
    border-left: 3px solid #3498db;
}

.mobile-tab-item:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}

.bottom-sheet-handle {
    display: none;
}

/* Mobile adjustments for tabs */
@media screen and (max-width: 768px) {
    /* Settings adjustments for mobile */
    .settings-container {
        padding: 12px;
    }

    .settings-container h2 {
        font-size: 18px;
    }

    .checkbox-text {
        font-size: 14px;
    }

    .settings-description {
        margin-left: 0;
        margin-top: 8px;
    }
}

/* ================================================================= */
/* Preference Icons (Like/Dislike) */
/* ================================================================= */

.preference-icons {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.pref-icon {
    appearance: none;
    cursor: pointer;
    display: inline-block;
    width: 32px;
    height: 32px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.4;
    transition: opacity 0.2s;
    user-select: none;
    vertical-align: middle;
}

.pref-icon:hover {
    opacity: 0.7;
}

.pref-icon.active {
    opacity: 1;
}

.pref-icon.thumbs-up {
    background-image: url('/static/images/thumbs_up_outline_dark.png');
}

.pref-icon.thumbs-up.active {
    background-image: url('/static/images/thumbs_up_filled_green_dark.png');
}

.pref-icon.thumbs-down {
    background-image: url('/static/images/thumbs_down_outline_dark.png');
}

.pref-icon.thumbs-down.active {
    background-image: url('/static/images/thumbs_down_filled_red_dark.png');
}

/* Tile view preference icons */
.tile-primary-with-pref {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.tile-primary-with-pref .preference-icons {
    margin-left: auto;
    flex-shrink: 0;
}

.tile-primary-with-pref .pref-icon {
    width: 20px;
    height: 20px;
}

/* Inline preference tags (for table/popup actress/category display) */
.inline-pref-tag {
    display: flex;
    align-items: center;
    white-space: normal;
    margin-bottom: 4px;
}

.inline-pref-tag .tag-name {
    display: inline;
}

.preference-icons.inline {
    display: inline-flex;
    gap: 2px;
    margin-left: 2px;
    vertical-align: middle;
}

.preference-icons.inline .pref-icon {
    width: 24px;
    height: 24px;
}

/* Mobile adjustments for preference icons */
@media screen and (max-width: 768px) {
    .preference-icons {
        gap: 2px;
        margin-left: 4px;
    }

    .pref-icon {
        width: 28px;
        height: 28px;
    }

    .tile-primary-with-pref .pref-icon {
        width: 18px;
        height: 18px;
    }
}

@media screen and (max-width: 480px) {
    .pref-icon {
        width: 26px;
        height: 26px;
    }

    .tile-primary-with-pref .pref-icon {
        width: 16px;
        height: 16px;
    }
}

/* ================================================================= */
/* PREFERENCES TAB                                                   */
/* ================================================================= */

.preferences-container {
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.preferences-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preferences-header h2 {
    margin: 0;
    color: #e0e0e0;
}

.preferences-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.preferences-section {
    background-color: #22223a;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #3d3d5c;
}

.preferences-section h3 {
    margin: 0 0 12px 0;
    color: #9f9faf;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preferences-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preference-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background-color: #2d2d4a;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.preference-item:hover {
    background-color: #3d3d5c;
}

.preference-status {
    flex-shrink: 0;
}

.pref-icon-stat {
    display: inline-block;
    width: 36px;
    height: 36px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
}

.pref-icon-stat.thumbs-up {
    background-image: url('/static/images/thumbs_up_filled_green_dark.png');
}

.pref-icon-stat.thumbs-down {
    background-image: url('/static/images/thumbs_down_filled_red_dark.png');
}

.pref-icon-stat-small {
    display: inline-block;
    width: 28px;
    height: 28px;
    margin-right: 4px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
}

.pref-icon-stat-small.thumbs-up {
    background-image: url('/static/images/thumbs_up_filled_green_dark.png');
}

.pref-icon-stat-small.thumbs-down {
    background-image: url('/static/images/thumbs_down_filled_red_dark.png');
}

.preference-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.preference-identifier {
    font-weight: bold;
    color: #3498db;
    font-size: 14px;
}

.preference-date {
    color: #7f8c8d;
    font-size: 12px;
}

.preference-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #9f9faf;
}

.preference-actresses {
    color: #e74c3c;
}

.preference-categories {
    color: #9b59b6;
}

.preferences-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preference-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background-color: #3d3d5c;
    border-radius: 4px;
    font-size: 13px;
    color: #e0e0e0;
    transition: background-color 0.2s;
}

.preference-tag:hover {
    background-color: #4a4a6a;
}

.preference-tag .preference-main {
    width: auto;
    min-width: 0;
    gap: 0;
}

/* Clickable items */
.clickable-identifier {
    cursor: pointer;
    color: #3498db;
    text-decoration: none;
}

.clickable-identifier:hover {
    text-decoration: underline;
    color: #5dade2;
}

.clickable-actress,
.clickable-category {
    cursor: pointer;
    color: #e0e0e0;
    transition: color 0.2s;
}

.clickable-actress:hover,
.clickable-category:hover {
    color: #3498db;
    text-decoration: underline;
}

.remove-btn {
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.remove-btn:hover {
    color: #e74c3c;
}

.empty-message {
    color: #7f8c8d;
    font-style: italic;
    padding: 12px;
    text-align: center;
}

.loading-message {
    color: #7f8c8d;
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

/* Mobile responsive for preferences */
@media screen and (max-width: 768px) {
    .preferences-container {
        padding: 12px;
    }

    .preferences-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .preference-item {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
        padding-right: 32px;
    }

    .preference-main {
        min-width: 0;
        width: 100%;
        justify-content: space-between;
    }

    .preference-details {
        width: 100%;
    }

    .preference-item .remove-btn {
        position: absolute;
        right: 12px;
        top: 10px;
    }

    .preference-item .preference-status {
        margin-bottom: 4px;
    }
}

/* Let the tiled view participate in page scrolling so mobile browsers can collapse their chrome. */
@media screen and (max-width: 768px), (hover: none) and (pointer: coarse) and (orientation: landscape) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #app,
    .app-shell {
        height: auto;
        min-height: 100dvh;
    }

    .tab-content,
    .tab-pane,
    .tile-container {
        flex: none;
        min-height: 0;
        overflow: visible;
    }
}

@media screen and (max-width: 768px), (hover: none) and (pointer: coarse) and (orientation: landscape) {
    .header-mobile-tabs {
        top: 12px;
        left: -16px;
        right: auto;
    }

    .mobile-control-row {
        top: 12px;
        right: -16px;
        left: auto;
    }

    .filter-toggle-btn {
        border-radius: 22px 0 0 22px;
    }

    .mobile-tab-dropdown,
    .filters-collapsible.expanded {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw;
        max-height: 80dvh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
    }

    .mobile-tab-dropdown {
        z-index: 300;
    }

    .filters-collapsible.expanded {
        z-index: 300;
        padding: 0 12px 12px;
    }

    .bottom-sheet-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 32px;
        flex-shrink: 0;
        cursor: grab;
        touch-action: none;
    }

    .bottom-sheet-handle::before {
        width: 44px;
        height: 4px;
        border-radius: 2px;
        background-color: #8f8f9f;
        content: '';
    }

    .filters-collapsible.expanded .bottom-sheet-handle {
        align-self: stretch;
        margin: 0 -12px;
    }
}
