/* =============================================================================
   HEARTED - Design System
   A personal content archive with soul.
   ============================================================================= */

/* =============================================================================
   Design Tokens - Dark Theme (Default)
   ============================================================================= */
:root {
    /* Brand - H3arted Red */
    --brand: #e74c3c;
    --brand-dark: #c0392b;
    --brand-light: #ff6b5b;
    --brand-glow: rgba(231, 76, 60, 0.4);

    /* Surfaces - Dark Theme */
    --bg-base: #09090b;
    --bg-elevated: #18181b;
    --bg-surface: #1f1f23;
    --bg-surface-hover: #27272a;
    --bg-overlay: rgba(0, 0, 0, 0.8);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-muted: #27272a;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.15);
    --border-focus: var(--brand);

    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-inverse: #09090b;

    /* Source Colors */
    --source-x: #1d9bf0;
    --source-instagram: #e1306c;
    --source-pinterest: #e60023;
    --source-web: #71717a;
    --source-screenshot: #8b5cf6;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px var(--brand-glow);

    /* Transitions */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;

    /* Container */
    --container-max: 1800px;

    /* Theme transition */
    color-scheme: dark;
}

/* =============================================================================
   Light Theme Override
   ============================================================================= */
[data-theme="light"] {
    /* Surfaces - Light Theme */
    --bg-base: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-surface: #f1f5f9;
    --bg-surface-hover: #e2e8f0;
    --bg-overlay: rgba(255, 255, 255, 0.9);
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-muted: #e2e8f0;

    /* Borders - Light */
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.15);

    /* Text - Light */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #fafafa;

    /* Shadows - Light (softer) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(231, 76, 60, 0.2);

    color-scheme: light;
}

/* Smooth theme transition */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease !important;
}

/* =============================================================================
   Light Theme Component Overrides
   ============================================================================= */

/* Navbar in light mode */
[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.85);
    border-bottom-color: var(--border-default);
}

/* Cards in light mode */
[data-theme="light"] .item-card {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .item-card:hover {
    box-shadow: var(--shadow-md);
}

/* Card overlays need darker text in light mode */
[data-theme="light"] .card-overlay {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

[data-theme="light"] .card-overlay-title {
    color: var(--text-primary);
}

/* Search input in light mode */
[data-theme="light"] .search-input {
    background: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .search-input:focus {
    background: rgba(0, 0, 0, 0.06) !important;
}

/* Toolbar in light mode */
[data-theme="light"] .toolbar {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

/* Filter panel in light mode */
[data-theme="light"] .filter-panel {
    background: var(--bg-elevated);
}

/* Modal backgrounds */
[data-theme="light"] .modal-content {
    background: var(--bg-elevated) !important;
}

/* Badge adjustments for light mode */
[data-theme="light"] .badge-video,
[data-theme="light"] .badge-count {
    background: rgba(0, 0, 0, 0.7);
}

/* Card favorite/checkbox backgrounds */
[data-theme="light"] .card-favorite,
[data-theme="light"] .card-checkbox-mark {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
}

/* Detail page in light mode */
[data-theme="light"] .detail-section {
    background: var(--bg-surface);
}

/* Empty state icons */
[data-theme="light"] .empty-state > i {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(231, 76, 60, 0.05));
}

/* Toast notifications */
[data-theme="light"] .toast {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

/* =============================================================================
   Reset & Base
   ============================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--brand);
    color: white;
}

/* =============================================================================
   Accessibility - Focus Rings
   ============================================================================= */

/* Default focus visible ring for interactive elements */
:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

/* Remove default focus ring when using mouse */
:focus:not(:focus-visible) {
    outline: none;
}

/* Links */
a:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Nav links - subtle ring */
.nav-link:focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.5);
    outline-offset: 0;
    border-radius: var(--radius-md);
}

/* Card interactive elements */
.card-favorite:focus-visible,
.card-checkbox:focus-visible,
.card-quick-add-btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

/* Dropdown items */
.search-dropdown-item:focus-visible,
.dropdown-item:focus-visible {
    outline: none;
    background: var(--bg-hover);
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: 8px 16px;
    background: var(--brand);
    color: white;
    text-decoration: none;
    z-index: 1001;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* =============================================================================
   Navbar - Minimal, Dark, Floating
   ============================================================================= */
.navbar {
    background: rgba(9, 9, 11, 0.8);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.navbar .container {
    max-width: var(--container-max);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary) !important;
    text-decoration: none;
    transition: opacity var(--duration-fast) var(--ease-smooth);
}

.navbar-brand:hover {
    opacity: 0.8;
}

.navbar-brand i {
    color: var(--brand);
    font-size: 0.95rem;
}

.navbar-toggler {
    border: 1px solid var(--border-default);
    padding: var(--space-sm);
}

.navbar-toggler-icon {
    filter: invert(1);
}

.nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.8rem;
    padding: 6px 10px !important;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-smooth);
    display: flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--text-secondary) !important;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.08);
}

/* Search Input */
.search-wrapper {
    position: relative;
    width: 220px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid transparent !important;
    border-radius: var(--radius-full) !important;
    color: var(--text-primary) !important;
    padding: 6px 12px 6px 32px !important;
    font-size: 0.8rem;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--border-subtle) !important;
    box-shadow: none !important;
    outline: none;
}

/* Search Shortcut Hint */
.search-shortcut-hint {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: 0.7rem;
    font-family: inherit;
    color: var(--text-muted);
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.search-wrapper.is-focused .search-shortcut-hint {
    opacity: 0;
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    margin-left: var(--space-sm);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(15deg);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.search-dropdown-section {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.search-dropdown-section:last-child {
    border-bottom: none;
}

.search-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.search-dropdown-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.search-dropdown-clear:hover {
    color: var(--brand);
    background: rgba(231, 76, 60, 0.1);
}

.search-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.search-dropdown-item:hover,
.search-dropdown-item.is-selected {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.search-dropdown-item i {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-dropdown-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md) var(--space-sm);
}

.search-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.search-tag-pill:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

/* =============================================================================
   Main Container
   ============================================================================= */
.main-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-md) var(--space-md);
}

/* =============================================================================
   Gallery Toolbar - Ultra Minimal
   ============================================================================= */
.gallery-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    margin: 0 calc(-1 * var(--space-md)) var(--space-sm);
    background: linear-gradient(to bottom, var(--bg-elevated), transparent);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toolbar-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.toolbar-actions {
    display: flex;
    gap: var(--space-xs);
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.toolbar-btn:hover {
    background: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.toolbar-btn--primary {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

.toolbar-btn--primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: white;
}

.toolbar-btn--danger {
    color: #ef4444;
}

.toolbar-btn--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.toolbar-btn--text {
    border: none;
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Selection toolbar */
.toolbar-selection {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.selection-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
}

.bulk-actions {
    display: flex;
    gap: var(--space-xs);
    margin-right: var(--space-sm);
    padding-right: var(--space-sm);
    border-right: 1px solid var(--border-subtle);
}

/* Enhanced toolbar layout */
.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.toolbar-btn--subtle {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 4px 8px;
    width: auto;
    gap: var(--space-xs);
}

.toolbar-btn--subtle:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.toolbar-btn--ghost {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 4px 10px;
    width: auto;
    gap: var(--space-xs);
    border-radius: var(--radius-sm);
}

.toolbar-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.selection-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--brand);
}

.selection-indicator i {
    font-size: 1rem;
}

.selection-quick-actions {
    display: flex;
    gap: 2px;
}

/* Quick tags for bulk tag modal */
.quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.quick-tag-btn {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.quick-tag-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: rgba(231, 76, 60, 0.1);
}

/* Sort dropdown */
.toolbar-select {
    height: 36px;
    padding: 0 var(--space-md) 0 var(--space-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.toolbar-select:hover {
    background-color: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-glow);
}

.toolbar-select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.view-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.view-toggle-btn.is-active {
    color: var(--brand);
    background: rgba(231, 76, 60, 0.12);
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn-filter {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--duration-fast) var(--ease-smooth);
    min-height: 36px;
}

.btn-filter:hover {
    background: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.btn-capture {
    background: var(--brand);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--duration-fast) var(--ease-smooth);
    min-height: 36px;
}

.btn-capture:hover {
    background: var(--brand-dark);
    color: white;
    transform: translateY(-1px);
}

.btn-capture:active {
    transform: translateY(0);
}

.btn-load-more {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: var(--space-md) var(--space-2xl);
    border-radius: var(--radius-full);
    font-weight: 500;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-load-more:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* =============================================================================
   Masonry Grid
   ============================================================================= */
.gallery-container {
    padding-bottom: var(--space-3xl);
    /* Edge-to-edge on larger screens */
    margin: 0 calc(-1 * var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

@media (min-width: 1200px) {
    .gallery-container {
        margin: 0 calc(-1 * var(--space-lg));
        padding-left: var(--space-lg);
        padding-right: var(--space-lg);
    }
}

/* Masonry grid - JS positions items absolutely */
.masonry-grid {
    position: relative;
    width: 100%;
    /* Height is set by JS based on content */
}

/* Prevent FOUC: hide items until masonry positions them (sets position:absolute) */
/* This works for both initial load AND infinite scroll appends */
.masonry-grid .item-card {
    opacity: 0;
}

/* Reveal items after masonry positions them (adds .is-positioned class) */
.masonry-grid .item-card.is-positioned {
    opacity: 1;
    transition: opacity 0.25s ease-out;
}

/* Card entrance animations handled by Loading & Reveal section (is-loading / is-revealed classes) */

/* Fade grid edges for visual polish */
.gallery-container::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--bg-base) 0%, transparent 100%);
    pointer-events: none;
    z-index: 10;
}

.load-more-container {
    text-align: center;
    padding: var(--space-2xl) 0;
}

/* Infinite scroll sentinel */
#scroll-sentinel,
.scroll-sentinel {
    width: 100%;
    padding: var(--space-xl) 0;
    scroll-margin-bottom: 200px;
    /* Start with display:none to prevent intersection observer from triggering */
    display: none;
}

/* Show sentinel after masonry has positioned it */
#scroll-sentinel.sentinel-ready,
.scroll-sentinel.sentinel-ready {
    display: block;
}

#scroll-sentinel .loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Hide sentinel while loading to prevent multiple triggers */
#scroll-sentinel.htmx-request {
    pointer-events: none;
}

/* =============================================================================
   Item Cards - Content-First with Hover Overlay
   ============================================================================= */
.item-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    /* JS masonry sets position, width, left, top */
    transition: transform var(--duration-normal) var(--ease-smooth),
                box-shadow var(--duration-normal) var(--ease-smooth);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(231, 76, 60, 0.1);
}

.item-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.item-card:focus-within {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Selection Checkbox */
.card-checkbox {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    z-index: 10;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s var(--ease-smooth);
}

.item-card:hover .card-checkbox,
.item-card.is-selected .card-checkbox {
    opacity: 1;
}

.card-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.card-checkbox-mark {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.15s var(--ease-smooth);
}

.card-checkbox input:checked + .card-checkbox-mark {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

.card-checkbox:hover .card-checkbox-mark {
    border-color: white;
    transform: scale(1.1);
}

/* Favorite Heart Button */
.card-favorite {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: 10;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.item-card:hover .card-favorite,
.card-favorite.is-favorited {
    opacity: 1;
}

.card-favorite.is-favorited {
    color: var(--brand);
    background: rgba(231, 76, 60, 0.2);
}

.card-favorite:hover {
    transform: scale(1.15);
    color: var(--brand);
    background: rgba(231, 76, 60, 0.3);
}

.card-favorite:active {
    transform: scale(0.95);
}

/* Stats Panel */
.stats-panel {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-md) var(--space-lg);
    overflow: hidden;
}

.stats-loading {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-sm);
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.stats-row {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 80px;
}

.stat-item--primary .stat-value {
    color: var(--brand);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-sources {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.stats-source-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-muted);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stats-source-pill i {
    font-size: 0.9rem;
}

.stats-source--x { color: #1da1f2; }
.stats-source--instagram { color: #e4405f; }
.stats-source--pinterest { color: #e60023; }
.stats-source--midjourney { color: #9b59b6; }
.stats-source--web { color: #3498db; }
.stats-source--screenshot { color: #27ae60; }

/* Stats panel mobile */
@media (max-width: 768px) {
    .stats-panel {
        padding: var(--space-sm) var(--space-md);
    }

    .stats-row {
        gap: var(--space-md);
    }

    .stat-item {
        min-width: 60px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stats-source-pill {
        padding: 3px 8px;
        font-size: 0.75rem;
    }
}

.toolbar-btn.is-active {
    background: var(--brand);
    color: white;
}

/* Selected Card State */
.item-card.is-selected {
    outline: 3px solid var(--brand);
    outline-offset: -3px;
    animation: card-select-pulse 0.2s ease-out;
}

@keyframes card-select-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

.item-card.is-selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(236, 72, 153, 0.1);
    pointer-events: none;
    z-index: 5;
}

.item-card.is-selected .card-checkbox-mark {
    background: var(--brand);
    border-color: var(--brand);
    animation: checkbox-pop 0.15s ease-out;
}

@keyframes checkbox-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Focused Card State (keyboard nav) */
.item-card.is-focused {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.item-card.is-focused.is-selected {
    outline: 3px solid var(--brand);
    box-shadow: 0 0 0 3px #60a5fa;
}

/* Card Media Container */
.card-media {
    position: relative;
    overflow: hidden;
    background: var(--bg-elevated);
}

/* =============================================================================
   Simple Image Fade-In
   - Images start hidden, fade in when loaded
   - Natural sizing, no absolute positioning
   ============================================================================= */

/* Images fade in when loaded */
.card-media > img:not(.card-poster) {
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-media > img.loaded:not(.card-poster) {
    opacity: 1;
}

/* Hover zoom on images */
.item-card:hover .card-media > img:not(.card-poster) {
    transform: scale(1.03);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Card Video - Hover to play */
.card-video {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    opacity: 0;
    position: absolute;
    inset: 0;
    transition: opacity 0.3s var(--ease-smooth);
}

.card-video.is-playing {
    opacity: 1;
}

.card-poster {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    /* Always visible - video layers on top */
}

.item-card:hover .card-poster {
    transform: scale(1.05);
}

/* Hover Overlay - Bottom gradient with content */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.5) 35%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s var(--ease-smooth);
    display: flex;
    align-items: flex-end;
    pointer-events: none;
}

.item-card:hover .card-overlay {
    opacity: 1;
}

.card-overlay-content {
    padding: var(--space-md);
    width: 100%;
    transform: translateY(8px);
    transition: transform 0.3s var(--ease-smooth);
}

.item-card:hover .card-overlay-content {
    transform: translateY(0);
}

.card-overlay-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    margin: 0 0 var(--space-sm) 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.card-overlay-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Card Tags */
.card-overlay-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: var(--space-sm);
}

.card-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-tag--more {
    background: rgba(255, 255, 255, 0.08);
}

/* Source Pills */
.card-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(8px);
    text-transform: capitalize;
}

.card-source--x { background: rgba(29, 155, 240, 0.3); }
.card-source--instagram { background: rgba(225, 48, 108, 0.3); }
.card-source--pinterest { background: rgba(230, 0, 35, 0.3); }
.card-source--midjourney { background: rgba(114, 137, 218, 0.3); }
.card-source--screenshot { background: rgba(139, 92, 246, 0.3); }
.card-source--web { background: rgba(255, 255, 255, 0.1); }

/* Badges - Always visible */
.badge-video {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s var(--ease-smooth);
}

/* Minimal playable badge - just icon, no background */
.badge-video--playable {
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    width: auto;
    height: auto;
    font-size: 1.25rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

.badge-video--playable.is-playing {
    opacity: 0.7;
}

.badge-count {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Quote Card (text-only tweets) */
.card-quote {
    padding: var(--space-xl);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.card-quote i {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.2);
}

.card-quote p {
    color: white;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Placeholder Card */
.card-placeholder {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
}

.card-placeholder i {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.card-placeholder span {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================================================
   Tweet Quote Cards
   ============================================================================= */
.tweet-quote-card {
    background: var(--bg-elevated);
    padding: 20px 20px 20px 24px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.tweet-quote-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--source-x);
}

.tweet-quote-card .quote-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    color: rgba(255, 255, 255, 0.08);
    font-size: 1.5rem;
    line-height: 1;
}

.tweet-quote-card .quote-text {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    position: relative;
    z-index: 1;
}

.tweet-quote-card .quote-author {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 12px 0 0 0;
    font-weight: 500;
}

/* No image placeholder */
.no-image-placeholder {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-image-placeholder i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Detail page quote */
.tweet-quote-detail {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    position: relative;
    border-left: 4px solid var(--source-x);
}

.tweet-quote-detail .quote-icon {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-xl);
    color: var(--border-default);
    font-size: 3rem;
    line-height: 1;
}

.tweet-quote-detail .quote-text {
    color: var(--text-primary);
    font-size: 1.25rem;
    line-height: 1.8;
    margin: 0;
    font-style: italic;
    position: relative;
    z-index: 1;
    border: none;
    padding: 0;
}

.tweet-quote-detail .quote-author {
    color: var(--text-muted);
    font-size: 1rem;
    margin: var(--space-lg) 0 0 0;
    font-style: normal;
    font-weight: 500;
}

/* =============================================================================
   Empty State - Unified Component
   ============================================================================= */

/* Base empty state - works inline or full-page */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    min-height: 300px;
}

.empty-state > i {
    width: 100px;
    height: 100px;
    margin-bottom: var(--space-lg);
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.15), rgba(231, 76, 60, 0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--brand);
    opacity: 0.7;
}

.empty-state h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 var(--space-sm);
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-muted);
    margin: 0 0 var(--space-lg);
    max-width: 320px;
    line-height: 1.5;
}

.empty-state .btn {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-weight: 600;
}

.empty-state .btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border: none;
}

.empty-state .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

/* Success variant (for "no duplicates" etc) */
.empty-state--success > i {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
    color: #22c55e;
}

/* Muted variant (for search/filter results) */
.empty-state--muted > i {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.15), rgba(148, 163, 184, 0.05));
    color: var(--text-muted);
}

/* Hero variant - larger, for main pages */
.empty-state-hero {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    max-width: 480px;
    margin: 0 auto;
}

.empty-state-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-xl);
    background: var(--brand);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: var(--shadow-glow); }
    50% { box-shadow: 0 0 30px var(--brand-glow); }
}

.empty-state-icon i {
    font-size: 2.5rem;
    color: white;
}

.empty-state-hero h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.empty-state-hero p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

/* =============================================================================
   Filter Panel (Offcanvas)
   ============================================================================= */
.filter-panel {
    background: var(--bg-elevated) !important;
    border-left: 1px solid var(--border-subtle) !important;
    width: 340px !important;
}

.filter-panel .offcanvas-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-lg);
}

.filter-panel .offcanvas-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.filter-panel .btn-close {
    filter: invert(1);
    opacity: 0.5;
}

.filter-panel .btn-close:hover {
    opacity: 1;
}

.filter-panel .offcanvas-body {
    padding: 0 var(--space-lg) var(--space-lg);
}

.filter-section {
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

/* Filter Chips */
.filter-chip {
    display: inline-flex;
    margin: var(--space-xs);
    cursor: pointer;
}

.filter-chip input {
    display: none;
}

.filter-chip-label {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-smooth);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.filter-chip input:checked + .filter-chip-label {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

.filter-chip:hover .filter-chip-label {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Tag Search */
.tag-search-wrapper {
    position: relative;
    margin-bottom: var(--space-sm);
}

.tag-search-icon {
    position: absolute;
    left: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.tag-search-input {
    padding-left: calc(var(--space-sm) + 1.25rem);
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 0.85rem;
    height: 36px;
}

.tag-search-input:focus {
    background: var(--bg-default);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 45, 85, 0.15);
}

.tag-search-input::placeholder {
    color: var(--text-muted);
}

.tags-scroll {
    max-height: 200px;
    overflow-y: auto;
    margin: calc(var(--space-xs) * -1);
    padding: var(--space-xs);
}

/* Date Inputs */
.date-inputs {
    display: flex;
    gap: var(--space-md);
}

.date-input-group {
    flex: 1;
}

.date-input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.date-input-group .form-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}

.date-input-group .form-control:focus {
    background: var(--bg-surface-hover);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
    color: var(--text-primary);
}

.btn-clear-filters {
    width: 100%;
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-clear-filters:hover {
    background: var(--bg-surface);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* =============================================================================
   Capture Modal
   ============================================================================= */
.capture-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
}

.capture-modal .modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-lg);
}

.capture-modal .modal-title {
    color: var(--text-primary);
    font-weight: 600;
}

.capture-modal .modal-body {
    padding: var(--space-xl);
}

.capture-modal .form-label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.capture-modal .form-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.capture-modal .form-control:focus {
    background: var(--bg-surface-hover);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
    color: var(--text-primary);
}

.capture-modal .form-control::placeholder {
    color: var(--text-muted);
}

.capture-modal .form-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.capture-modal .btn-close {
    filter: invert(1);
    opacity: 0.5;
}

/* =============================================================================
   Detail Page - Image Viewer
   ============================================================================= */
.main-image-container {
    position: relative;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.main-image-container .main-image {
    max-height: 600px;
    object-fit: contain;
    background: var(--bg-elevated);
}

.thumbnail-strip {
    border-top: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: thin;
    background: var(--bg-surface);
    padding: var(--space-sm);
    display: flex;
    gap: var(--space-sm);
}

.thumbnail-btn {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-elevated);
    transition: all var(--duration-fast) var(--ease-smooth);
}

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

.thumbnail-btn:hover {
    border-color: var(--border-hover);
}

.thumbnail-btn.active {
    border-color: var(--brand);
}

.thumbnail-btn:not(.active) {
    opacity: 0.6;
}

/* Image Navigation Arrows */
.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--bg-overlay);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.image-nav:hover {
    background: var(--brand);
}

.image-nav-prev { left: var(--space-md); }
.image-nav-next { right: var(--space-md); }

.main-image-container:hover .image-nav {
    opacity: 1;
}

/* Image Counter */
.image-counter {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-overlay);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
}

/* =============================================================================
   Cards (Bootstrap Override)
   ============================================================================= */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.card-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-md);
    font-weight: 600;
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-md);
}

/* =============================================================================
   Tables
   ============================================================================= */
.table {
    color: var(--text-primary);
}

.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    border-color: var(--border-subtle);
}

.table td {
    border-color: var(--border-subtle);
}

/* =============================================================================
   Badges
   ============================================================================= */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
}

.bg-secondary {
    background: var(--bg-surface) !important;
    color: var(--text-secondary) !important;
}

.bg-primary {
    background: var(--brand) !important;
}

/* =============================================================================
   Forms (Bootstrap Override)
   ============================================================================= */
.form-control,
.form-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-md);
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-surface-hover);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
    color: var(--text-primary);
}

.form-label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.form-text {
    color: var(--text-muted);
}

.input-group-text {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* =============================================================================
   Buttons (Bootstrap Override)
   ============================================================================= */
.btn {
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    box-shadow: none;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.btn-outline-secondary:hover {
    background: var(--bg-surface);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-outline-danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-outline-light {
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.btn-outline-light:hover {
    background: var(--bg-surface);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-link {
    color: var(--brand);
}

.btn-link:hover {
    color: var(--brand-light);
}

/* =============================================================================
   Modal (Bootstrap Override)
   ============================================================================= */
.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-lg);
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
}

.modal-body {
    padding: var(--space-xl);
    color: var(--text-primary);
}

.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-lg);
}

.btn-close {
    filter: invert(1);
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* Keyboard Keys */
kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    box-shadow: 0 1px 0 var(--border-subtle);
}

/* =============================================================================
   Dropdown (Bootstrap Override)
   ============================================================================= */
.dropdown-menu {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
}

.dropdown-item:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* =============================================================================
   Alerts
   ============================================================================= */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

/* =============================================================================
   HTMX Loading Indicator
   ============================================================================= */
.htmx-indicator {
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-smooth);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* =============================================================================
   Scrollbar Styling
   ============================================================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* =============================================================================
   Animations
   ============================================================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Note: Card animations handled by is-loading / is-revealed classes in styles.css */

/* =============================================================================
   Responsive Adjustments
   ============================================================================= */
@media (max-width: 768px) {
    .main-container {
        padding: var(--space-sm);
    }

    .gallery-header {
        padding: var(--space-sm) 0 var(--space-md);
    }

    .gallery-title {
        font-size: 1.25rem;
    }

    .gallery-subtitle {
        font-size: 0.75rem;
    }

    .search-wrapper {
        width: 100%;
        margin-top: var(--space-sm);
    }

    .btn-filter,
    .btn-capture {
        padding: 6px 10px;
        min-height: 36px;
    }

    .filter-panel {
        width: 100% !important;
    }

    /* Fade at bottom smaller on mobile */
    .gallery-container::after {
        height: 80px;
    }
}

/* =============================================================================
   Detail Page
   ============================================================================= */
.detail-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-lg);
}

/* Sidebar Card */
.detail-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.detail-card .card-body {
    padding: var(--space-lg);
}

.detail-card .card-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
}

.detail-card .card-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

/* Section Dividers */
.detail-section {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.detail-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-section-title {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Metadata Table */
.detail-meta-table {
    width: 100%;
    font-size: 0.9rem;
}

.detail-meta-table tr {
    border-bottom: 1px solid var(--border-subtle);
}

.detail-meta-table tr:last-child {
    border-bottom: none;
}

.detail-meta-table th,
.detail-meta-table td {
    padding: var(--space-sm) 0;
    vertical-align: middle;
}

.detail-meta-table th {
    color: var(--text-muted);
    font-weight: 500;
    width: 40%;
}

.detail-meta-table td {
    color: var(--text-primary);
    text-align: right;
}

.detail-meta-table i {
    color: var(--text-muted);
}

/* Image Viewer */
.detail-image-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.detail-image-card img {
    width: 100%;
    height: auto;
    display: block;
}

/* Thumbnail Strip - Dark Theme */
.thumbnail-strip {
    background: var(--bg-elevated) !important;
    padding: var(--space-sm) !important;
    gap: var(--space-sm) !important;
    border-top: 1px solid var(--border-subtle);
}

.thumbnail-btn {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    padding: 0;
    background: transparent;
}

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

.thumbnail-btn:hover {
    border-color: var(--border-hover);
}

.thumbnail-btn.active {
    border-color: var(--brand);
}

/* Action Buttons */
.detail-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.btn-detail-primary {
    background: var(--brand);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-detail-primary:hover {
    background: var(--brand-dark);
    color: white;
}

.btn-detail-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-detail-secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Delete Button - Ghost Style */
.btn-detail-danger {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-detail-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Back Link */
.detail-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    padding: var(--space-sm) 0;
    margin-top: var(--space-md);
    transition: color var(--duration-fast) var(--ease-smooth);
}

.detail-back-link:hover {
    color: var(--text-primary);
}

/* Tweet Embed Card */
.tweet-embed-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.tweet-embed-card .card-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.tweet-embed-card .card-body {
    padding: var(--space-md);
    background: var(--bg-surface);
}

/* No Image Placeholder - Detail */
.detail-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.detail-no-image i {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

/* Video Placeholder */
.video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    background: var(--bg-base);
    color: var(--text-primary);
}

.video-placeholder i {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

/* Tags in Detail */
.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.detail-tag {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.detail-tag .btn-close {
    font-size: 0.5rem;
    opacity: 0.5;
    transition: opacity var(--duration-fast) var(--ease-smooth);
}

.detail-tag:hover .btn-close {
    opacity: 1;
}

/* Low Confidence Tag Indicator */
.detail-tag--low-confidence {
    opacity: 0.65;
    border-style: dashed;
    border-color: var(--warning, #f59e0b);
}

.detail-tag--low-confidence:hover {
    opacity: 0.85;
}

.tag-icon-auto {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.detail-tag--low-confidence .tag-icon-auto {
    color: var(--warning, #f59e0b);
}

.tag-confirm-btn {
    background: transparent;
    border: none;
    color: var(--success, #22c55e);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 0.8rem;
    opacity: 0.6;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.tag-confirm-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Tag Input */
.tag-input-group {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.tag-input-group input {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-xs) var(--space-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.tag-input-group input::placeholder {
    color: var(--text-muted);
}

.tag-input-group input:focus {
    outline: none;
    border-color: var(--brand);
}

.tag-input-group button {
    background: var(--brand);
    color: white;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-smooth);
}

.tag-input-group button:hover {
    background: var(--brand-dark);
}

/* =============================================================================
   Detail Page - Mobile Responsive
   ============================================================================= */
@media (max-width: 767px) {
    /* Navigation - compact on mobile */
    .detail-nav {
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
        margin-bottom: var(--space-md);
        position: sticky;
        top: 60px;
        background: var(--bg-base);
        z-index: 10;
    }

    .detail-nav-btn {
        padding: var(--space-sm) var(--space-md);
        min-height: 44px; /* iOS minimum touch target */
    }

    /* Hide text on mobile, show only icons */
    .detail-nav-btn span {
        display: none;
    }

    .detail-nav-btn i {
        font-size: 1.25rem;
    }

    /* Action buttons - full width, larger touch targets */
    .detail-actions .btn-detail-primary,
    .detail-actions .btn-detail-secondary,
    .detail-actions .btn-detail-danger {
        min-height: 48px;
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Detail card - less padding on mobile */
    .detail-card .card-body {
        padding: var(--space-md);
    }

    /* Detail sections - tighter on mobile */
    .detail-section {
        padding: var(--space-sm) 0;
    }

    /* Tags - larger touch targets */
    .detail-tag {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.85rem;
        min-height: 36px;
    }

    .detail-tag .btn-close {
        font-size: 0.6rem;
        padding: var(--space-xs);
    }

    /* Tag input - larger on mobile */
    .tag-input-group input {
        padding: var(--space-sm) var(--space-md);
        font-size: 1rem;
        min-height: 44px;
    }

    .tag-input-group button {
        padding: var(--space-sm) var(--space-md);
        min-height: 44px;
    }

    /* Image navigation arrows - larger on mobile */
    .image-nav {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    /* Metadata table - better spacing */
    .detail-meta-table th,
    .detail-meta-table td {
        padding: var(--space-sm) var(--space-xs);
        font-size: 0.9rem;
    }

    /* Twitter/Instagram sections - tighter spacing */
    .twitter-section,
    .instagram-section,
    .midjourney-section {
        padding: var(--space-md);
    }

    /* MJ prompt - easier to read on mobile */
    .mj-prompt {
        font-size: 0.85rem;
    }

    .mj-copy-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Thumbnail strip - horizontal scroll on mobile */
    .thumbnail-strip {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: var(--space-xs);
        padding-bottom: var(--space-xs);
    }

    .thumbnail-btn {
        flex-shrink: 0;
        width: 60px;
        height: 60px;
    }

    /* Related items title */
    .related-title {
        font-size: 1.1rem;
    }

    /* Dropdown menus - full width on mobile */
    .detail-actions .dropdown-menu {
        position: fixed !important;
        left: var(--space-md) !important;
        right: var(--space-md) !important;
        bottom: var(--space-md) !important;
        top: auto !important;
        width: auto !important;
        max-height: 60vh;
        overflow-y: auto;
        border-radius: var(--radius-lg);
    }

    .detail-actions .dropdown-item {
        padding: var(--space-md);
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

/* Smaller mobile devices */
@media (max-width: 375px) {
    .detail-nav-btn {
        padding: var(--space-xs) var(--space-sm);
    }

    .detail-nav-home {
        width: 40px;
        height: 40px;
    }

    .detail-card .card-body {
        padding: var(--space-sm);
    }

    .detail-tag {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.8rem;
    }
}

/* =============================================================================
   Utility Classes
   ============================================================================= */
.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--brand) !important;
}

.bg-light {
    background: var(--bg-surface) !important;
}

/* =============================================================================
   Instagram Placeholder Cards
   ============================================================================= */
.instagram-placeholder {
    aspect-ratio: 1/1;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    text-align: center;
}

.instagram-placeholder > i {
    font-size: 2.5rem;
    color: white;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.instagram-placeholder .ig-username {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instagram-placeholder .ig-type {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.instagram-placeholder .ig-type i {
    font-size: 0.7rem;
}

/* =============================================================================
   Lazy Loading Placeholders (On-demand enrichment)
   ============================================================================= */

/* Pinterest-style colored placeholder for items needing enrichment */
.ig-lazy-placeholder {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ig-lazy-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    text-align: center;
    z-index: 1;
}

.ig-lazy-placeholder > .ig-lazy-content > i {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.ig-lazy-placeholder .ig-username {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-size: 1rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ig-lazy-placeholder .ig-type {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ig-lazy-placeholder .ig-type i {
    font-size: 0.7rem;
}

.ig-loading-indicator {
    margin-top: var(--space-sm);
    opacity: 0.7;
}

.ig-loading-indicator .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
    color: white;
}

/* Fade-in animation for enriched images */
.fade-in-image {
    animation: fadeInScale 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* HTMX swap animation */
.item-card.htmx-swapping {
    opacity: 0;
    transform: scale(0.98);
}

.item-card.htmx-settling {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* No-image placeholder with consistent colored background */
.no-image-placeholder {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-image-placeholder > i {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.8);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Source badge colors */
.source-instagram {
    background: var(--source-instagram) !important;
}

/* =============================================================================
   Midjourney Detail Styles
   ============================================================================= */

.midjourney-section {
    background: linear-gradient(135deg, rgba(114, 137, 218, 0.1) 0%, rgba(88, 101, 242, 0.05) 100%);
    border: 1px solid rgba(114, 137, 218, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.midjourney-section .detail-section-title {
    color: #7289da;
    margin-bottom: var(--space-md);
}

.mj-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.mj-prompt-container {
    margin-bottom: var(--space-md);
}

.mj-prompt {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    padding-right: 2.5rem;
}

.mj-prompt code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    display: block;
    max-height: 200px;
    overflow-y: auto;
}

.mj-copy-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.mj-copy-btn:hover {
    background: var(--bg-surface);
    color: var(--brand);
}

.mj-params {
    margin-bottom: var(--space-md);
}

.mj-param-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.mj-param-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Monaco', monospace;
}

.mj-param-tag i {
    font-size: 0.75rem;
    color: #7289da;
}

.mj-meta {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-sm);
    margin-top: var(--space-sm);
}

.mj-username {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mj-username i {
    color: #7289da;
}

/* =============================================================================
   Lightbox / Quick Preview
   ============================================================================= */
[x-cloak] {
    display: none !important;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

/* Lightbox transitions */
.lightbox-enter {
    transition: opacity 0.2s var(--ease-smooth);
}
.lightbox-enter-start {
    opacity: 0;
}
.lightbox-enter-end {
    opacity: 1;
}
.lightbox-leave {
    transition: opacity 0.15s var(--ease-smooth);
}
.lightbox-leave-start {
    opacity: 1;
}
.lightbox-leave-end {
    opacity: 0;
}

.lightbox-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-nav--prev {
    left: var(--space-lg);
}

.lightbox-nav--next {
    right: var(--space-lg);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-media-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: calc(90vh - 80px);
}

.lightbox-media {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.lightbox-quote {
    max-width: 700px;
    padding: var(--space-3xl);
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    border-left: 4px solid var(--source-x);
    position: relative;
}

.lightbox-quote i {
    position: absolute;
    top: var(--space-lg);
    left: var(--space-xl);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.1);
}

.lightbox-quote p {
    font-size: 1.5rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
    position: relative;
    z-index: 1;
}

.lightbox-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-top: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
}

.lightbox-info-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.lightbox-info-right {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.lightbox-source {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.lightbox-source--x { background: rgba(29, 155, 240, 0.3); }
.lightbox-source--instagram { background: rgba(225, 48, 108, 0.3); }
.lightbox-source--pinterest { background: rgba(230, 0, 35, 0.3); }
.lightbox-source--midjourney { background: rgba(114, 137, 218, 0.3); }
.lightbox-source--screenshot { background: rgba(139, 92, 246, 0.3); }
.lightbox-source--web { background: rgba(255, 255, 255, 0.1); }

.lightbox-counter {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.lightbox-action {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.lightbox-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.lightbox-action.is-active {
    color: var(--brand);
}

.lightbox-action.is-active:hover {
    color: var(--brand-light);
}

/* Mobile lightbox adjustments */
@media (max-width: 768px) {
    .lightbox-overlay {
        padding: var(--space-sm);
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .lightbox-nav--prev {
        left: var(--space-sm);
    }

    .lightbox-nav--next {
        right: var(--space-sm);
    }

    .lightbox-close {
        top: var(--space-sm);
        right: var(--space-sm);
    }

    .lightbox-info {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-sm);
        border-radius: var(--radius-lg);
    }

    .lightbox-quote {
        padding: var(--space-xl);
    }

    .lightbox-quote p {
        font-size: 1.1rem;
    }
}

/* =============================================================================
   Context Menu
   ============================================================================= */
.context-menu {
    position: fixed;
    z-index: 3000;
    min-width: 200px;
    max-width: 280px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xs);
    animation: contextMenuIn 0.15s var(--ease-smooth);
}

@keyframes contextMenuIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.context-menu-item:hover {
    background: var(--bg-surface-hover);
}

.context-menu-item i {
    width: 18px;
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: center;
    flex-shrink: 0;
}

.context-menu-item:hover i {
    color: var(--text-primary);
}

.context-menu-item span {
    flex: 1;
}

.context-menu-item kbd {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
}

.context-menu-item--danger {
    color: #ef4444;
}

.context-menu-item--danger i {
    color: #ef4444;
}

.context-menu-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-xs) 0;
}

/* Mobile adjustments for context menu */
@media (max-width: 768px) {
    .context-menu {
        min-width: 220px;
    }

    .context-menu-item {
        padding: var(--space-md);
    }

    .context-menu-item kbd {
        display: none;
    }
}

/* =============================================================================
   Preview Panel (Side Panel)
   ============================================================================= */
.preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 90vw;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-default);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}

/* Preview panel transitions */
.preview-panel-enter {
    transition: transform 0.25s var(--ease-smooth);
}
.preview-panel-enter-start {
    transform: translateX(100%);
}
.preview-panel-enter-end {
    transform: translateX(0);
}
.preview-panel-leave {
    transition: transform 0.2s var(--ease-smooth);
}
.preview-panel-leave-start {
    transform: translateX(0);
}
.preview-panel-leave-end {
    transform: translateX(100%);
}

.preview-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.preview-panel-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.preview-panel-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.preview-panel-close:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.preview-panel-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.preview-panel-media {
    padding: var(--space-lg);
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.preview-media {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.preview-quote {
    max-width: 100%;
    padding: var(--space-xl);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--source-x);
    position: relative;
}

.preview-quote i {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.1);
}

.preview-quote p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
    position: relative;
    z-index: 1;
}

.preview-panel-info {
    padding: var(--space-lg);
    flex: 1;
}

.preview-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-md) 0;
    line-height: 1.4;
}

.preview-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.preview-source {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.preview-source--x { background: rgba(29, 155, 240, 0.2); color: var(--source-x); }
.preview-source--instagram { background: rgba(225, 48, 108, 0.2); color: var(--source-instagram); }
.preview-source--pinterest { background: rgba(230, 0, 35, 0.2); color: var(--source-pinterest); }
.preview-source--midjourney { background: rgba(114, 137, 218, 0.2); color: #7289da; }
.preview-source--screenshot { background: rgba(139, 92, 246, 0.2); color: var(--source-screenshot); }

.preview-counter {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.preview-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}

.preview-panel-actions {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.preview-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    text-decoration: none;
}

.preview-action-btn i {
    font-size: 1.1rem;
}

.preview-action-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.preview-action-btn.is-active {
    color: var(--brand);
    border-color: var(--brand);
}

.preview-action-btn.is-active:hover {
    background: rgba(231, 76, 60, 0.1);
}

.preview-panel-hint {
    padding: var(--space-sm) var(--space-lg) var(--space-lg);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.preview-panel-hint kbd {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 2px 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--text-secondary);
}

/* Mobile adjustments for preview panel */
@media (max-width: 768px) {
    .preview-panel {
        width: 100%;
        max-width: 100%;
    }

    .preview-panel-hint {
        display: none;
    }
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 16px;
    min-height: 48px;
    width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    pointer-events: auto;
    backdrop-filter: blur(12px);
    animation: toast-in 0.3s var(--ease-smooth);
}

.toast.toast-leaving {
    animation: toast-out 0.2s var(--ease-smooth) forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.toast-icon--success {
    color: #22c55e;
}

.toast-icon--error {
    color: var(--brand);
}

.toast-icon--info {
    color: var(--source-x);
}

.toast-icon--warning {
    color: #f59e0b;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    padding: var(--space-xs);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.toast-close:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.toast-action {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.toast-action:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
        bottom: var(--space-md);
    }

    .toast {
        width: 100%;
    }
}

/* =============================================================================
   Confirmation Dialog
   ============================================================================= */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: confirm-overlay-in 150ms var(--ease-smooth);
}

@keyframes confirm-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-dialog {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 400px;
    width: calc(100% - var(--space-lg) * 2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: confirm-dialog-in 150ms var(--ease-smooth);
}

@keyframes confirm-dialog-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-sm);
}

.confirm-message {
    color: var(--text-secondary);
    margin: 0 0 var(--space-lg);
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.confirm-btn {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    border: 1px solid transparent;
}

.confirm-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.confirm-btn--secondary {
    background: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.confirm-btn--secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.confirm-btn--primary {
    background: var(--brand);
    color: white;
}

.confirm-btn--primary:hover {
    background: var(--brand-dark);
}

.confirm-btn--danger {
    background: #dc3545;
    color: white;
}

.confirm-btn--danger:hover {
    background: #bb2d3b;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .confirm-dialog {
        width: calc(100% - var(--space-md) * 2);
        padding: var(--space-md);
    }

    .confirm-actions {
        flex-direction: column-reverse;
    }

    .confirm-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =============================================================================
   Quick Add to Collection
   ============================================================================= */
.card-quick-add {
    position: absolute;
    bottom: var(--space-sm);
    right: var(--space-sm);
    z-index: 10;
    opacity: 0;
    transform: translateY(4px);
    transition: all var(--duration-normal) var(--ease-smooth);
}

.item-card:hover .card-quick-add {
    opacity: 1;
    transform: translateY(0);
}

.card-quick-add-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    box-shadow: var(--shadow-md);
}

.card-quick-add-btn:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
    transform: scale(1.1);
}

.card-quick-add-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: var(--space-xs);
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: dropdown-in 0.15s var(--ease-smooth);
}

@keyframes dropdown-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-quick-add-header {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-quick-add-loading,
.card-quick-add-empty {
    padding: var(--space-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.card-quick-add-item {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--duration-fast) var(--ease-smooth);
}

.card-quick-add-item:hover {
    background: var(--bg-surface-hover);
}

.card-quick-add-item i {
    color: var(--text-muted);
}

/* =============================================================================
   Twitter/X Rich Metadata
   ============================================================================= */
.twitter-section {
    background: rgba(29, 161, 242, 0.05);
    border-color: rgba(29, 161, 242, 0.2);
}

.twitter-author {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.twitter-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.twitter-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.twitter-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.twitter-name {
    font-weight: 600;
    color: var(--text-primary);
}

.twitter-username {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.twitter-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.twitter-stat {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.twitter-stat i {
    font-size: 1rem;
    color: var(--text-muted);
}

.twitter-view-original {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: rgba(29, 161, 242, 0.1);
    border: 1px solid rgba(29, 161, 242, 0.3);
    border-radius: var(--radius-md);
    color: #1da1f2;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.twitter-view-original:hover {
    background: rgba(29, 161, 242, 0.2);
    border-color: rgba(29, 161, 242, 0.5);
    color: #1da1f2;
}

/* =============================================================================
   Instagram Rich Metadata
   ============================================================================= */
.instagram-section {
    background: linear-gradient(135deg, rgba(131, 58, 180, 0.05), rgba(253, 29, 29, 0.05));
    border-color: rgba(225, 48, 108, 0.2);
}

.instagram-author {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.instagram-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.instagram-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.instagram-username {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.instagram-meta {
    margin-bottom: var(--space-md);
}

.instagram-liked-date {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.instagram-liked-date i {
    color: #e1306c;
}

.instagram-view-original {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(45deg, rgba(131, 58, 180, 0.1), rgba(253, 29, 29, 0.1));
    border: 1px solid rgba(225, 48, 108, 0.3);
    border-radius: var(--radius-md);
    color: #e1306c;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.instagram-view-original:hover {
    background: linear-gradient(45deg, rgba(131, 58, 180, 0.2), rgba(253, 29, 29, 0.2));
    border-color: rgba(225, 48, 108, 0.5);
    color: #e1306c;
}

/* =============================================================================
   Timeline View - Apple Photos-style with Years/Months/Days
   ============================================================================= */
.timeline-container {
    padding: var(--space-md);
    max-width: 1800px;
    margin: 0 auto;
}

/* Timeline zoom toggle (Years/Months/Days) */
.timeline-zoom {
    display: flex;
    gap: 2px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 2px;
    margin-left: var(--space-md);
}

.timeline-zoom-btn {
    padding: 4px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.timeline-zoom-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.timeline-zoom-btn.is-active {
    background: var(--brand);
    color: white;
}

/* Timeline section */
.timeline-section {
    margin-bottom: var(--space-lg);
}

.timeline-section-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    margin-bottom: var(--space-sm);
}

.timeline-section-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.timeline-section-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Years view section header - bigger */
.timeline-container[data-view="years"] .timeline-section-date {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Months view section header */
.timeline-container[data-view="months"] .timeline-section-date {
    font-size: 1.1rem;
}

/* Timeline grid - base styles */
.timeline-grid {
    display: grid;
    gap: var(--space-xs);
}

/* Days view - larger cards */
.timeline-grid--days {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-sm);
}

/* Months view - medium cards */
.timeline-grid--months {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 4px;
}

/* Years view - tiny thumbnails */
.timeline-grid--years {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 2px;
}

@media (min-width: 576px) {
    .timeline-grid--days {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .timeline-grid--months {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .timeline-grid--years {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
}

@media (min-width: 992px) {
    .timeline-grid--days {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--space-md);
    }
    .timeline-grid--months {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 6px;
    }
    .timeline-grid--years {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 3px;
    }
}

/* Timeline card - simplified, fixed aspect ratio */
.timeline-card {
    display: block;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
    transition: transform var(--duration-fast) var(--ease-smooth),
                box-shadow var(--duration-fast) var(--ease-smooth);
}

.timeline-card:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-md);
}

/* Smaller cards for months/years views */
.timeline-grid--months .timeline-card,
.timeline-grid--years .timeline-card {
    border-radius: var(--radius-sm);
}

.timeline-grid--years .timeline-card {
    border-radius: 2px;
}

.timeline-grid--months .timeline-card:hover,
.timeline-grid--years .timeline-card:hover {
    transform: scale(1.05);
}

/* Hide badges in smaller views */
.timeline-grid--months .timeline-card-badge,
.timeline-grid--years .timeline-card-badge {
    display: none;
}

/* Hide quote text in smaller views */
.timeline-grid--months .timeline-card-quote p,
.timeline-grid--years .timeline-card-quote p {
    display: none;
}

.timeline-grid--months .timeline-card-quote i,
.timeline-grid--years .timeline-card-quote i {
    font-size: 1rem;
    margin: 0;
}

.timeline-grid--years .timeline-card-quote i {
    font-size: 0.75rem;
}

.timeline-grid--months .timeline-card-placeholder i,
.timeline-grid--years .timeline-card-placeholder i {
    font-size: 1rem;
}

.timeline-grid--years .timeline-card-placeholder i {
    font-size: 0.75rem;
}

.timeline-card-media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bg-elevated);
    overflow: hidden;
}

.timeline-card-media > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timeline-card-media > img.loaded {
    opacity: 1;
}

/* Shimmer loading effect */
.timeline-card-media::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        var(--bg-surface) 0%,
        var(--bg-elevated) 50%,
        var(--bg-surface) 100%
    );
    background-size: 200% 100%;
    animation: timeline-shimmer 1.5s ease-in-out infinite;
    z-index: 1;
}

.timeline-card-media:has(img.loaded)::before,
.timeline-card-media:has(.timeline-card-quote)::before,
.timeline-card-media:has(.timeline-card-placeholder)::before {
    display: none;
}

@keyframes timeline-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Quote cards */
.timeline-card-quote {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-md);
    text-align: center;
    color: white;
}

.timeline-card-quote i {
    font-size: 1.5rem;
    opacity: 0.7;
    margin-bottom: var(--space-xs);
}

.timeline-card-quote p {
    font-size: 0.75rem;
    line-height: 1.4;
    margin: 0;
    opacity: 0.95;
}

/* Placeholder cards */
.timeline-card-placeholder {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.8);
}

.timeline-card-placeholder i {
    font-size: 2rem;
}

/* Badges */
.timeline-card-badge {
    position: absolute;
    bottom: var(--space-xs);
    left: var(--space-xs);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.timeline-card-badge--count {
    left: auto;
    right: var(--space-xs);
    display: flex;
    align-items: center;
    gap: 3px;
}

.timeline-card-badge--fav {
    left: auto;
    right: var(--space-xs);
    top: var(--space-xs);
    bottom: auto;
    color: var(--brand);
    background: rgba(0, 0, 0, 0.6);
}

/* Timeline loading indicator */
.timeline-loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.timeline-loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
}

/* Per-section loading sentinel (inline with items) */
.timeline-section-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
}

.timeline-section-loading {
    color: var(--text-muted);
}

.timeline-section-loading .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* =============================================================================
   Smart Collections
   ============================================================================= */

/* Filter actions row */
.filter-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.btn-clear-filters {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-clear-filters:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-save-smart {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.05));
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-md);
    color: #fbbf24;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-save-smart:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(251, 191, 36, 0.1));
    border-color: #fbbf24;
    transform: translateY(-1px);
}

/* Smart Collection Modal */
.smart-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
}

.smart-modal .modal-header {
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-lg);
}

.smart-modal .modal-body {
    padding: var(--space-lg);
}

/* Icon Picker */
.smart-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.smart-icon-option {
    cursor: pointer;
}

.smart-icon-option input {
    display: none;
}

.smart-icon-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.smart-icon-option:hover span {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.smart-icon-option input:checked + span {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
    color: #fbbf24;
}

/* Criteria Summary */
.smart-criteria-preview {
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
}

.smart-criteria-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.smart-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.smart-badge i {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Save Button */
.btn-smart-save {
    padding: var(--space-md);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    border-radius: var(--radius-md);
    color: #000;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.btn-smart-save:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

/* Smart Collection Card in Sidebar */
.smart-collection-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-smooth);
}

.smart-collection-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.smart-collection-item.is-active {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.smart-collection-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    font-size: 0.9rem;
}

.smart-collection-name {
    flex: 1;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-collection-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: var(--radius-full);
}

/* Smart Collection Header (on browse view) */
.smart-collection-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.smart-collection-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.05));
    color: #fbbf24;
    font-size: 1.5rem;
}

.smart-collection-header-info h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.smart-collection-header-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xs);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.smart-collection-criteria {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

/* Sidebar section header */
.sidebar-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* =============================================================================
   Image Loading - Simple fade-in on load
   ============================================================================= */
/* Note: Image fade handled by .card-media > img opacity transition + .loaded class */

/* =============================================================================
   HTMX Transitions & Loading States
   ============================================================================= */

/* Page content transitions for SPA navigation */
#content {
    transition: opacity 0.2s var(--ease-smooth);
}

#content.htmx-request {
    opacity: 0.7;
    pointer-events: none;
}

/* =============================================================================
   Drag-Drop Reordering (Collection Items)
   ============================================================================= */

/* Drag handle - visible on hover */
.collection-item-drag-handle {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-smooth);
    z-index: 5;
}

.collection-item-drag-handle i {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.collection-item-card:hover .collection-item-drag-handle {
    opacity: 1;
}

.collection-item-drag-handle:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.collection-item-drag-handle:active {
    cursor: grabbing;
}

/* Dragging states via SortableJS */
.collection-item-card.sortable-ghost {
    opacity: 0.4;
    transform: scale(0.95);
}

.collection-item-card.sortable-chosen {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
    z-index: 100;
}

.collection-item-card.sortable-chosen .collection-item-drag-handle {
    opacity: 1;
    background: var(--brand);
}

.collection-item-card.sortable-drag {
    opacity: 1;
    transform: rotate(2deg) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Drop placeholder */
.collection-items-grid .sortable-fallback {
    opacity: 0.8;
    border: 2px dashed var(--brand);
    background: rgba(231, 76, 60, 0.1);
}

/* Reorder saving indicator */
.collection-items-grid.saving {
    pointer-events: none;
    opacity: 0.7;
}

.collection-items-grid.saving::after {
    content: 'Saving...';
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

/* Disable drag on mobile by default (touch gestures will be handled separately) */
@media (hover: none) and (pointer: coarse) {
    .collection-item-drag-handle {
        /* Always visible on touch devices */
        opacity: 0.8;
    }
}

/* =============================================================================
   Mobile Touch Optimizations
   ============================================================================= */

/* Ensure touch targets are at least 44x44px */
@media (hover: none) and (pointer: coarse) {
    .card-favorite,
    .card-checkbox,
    .card-quick-add-btn,
    .lightbox-close,
    .lightbox-nav,
    .lightbox-action {
        min-width: 44px;
        min-height: 44px;
    }

    /* Larger hit areas for nav buttons */
    .lightbox-nav {
        width: 60px;
    }

    /* Show overlay controls always on touch */
    .item-card .card-overlay {
        opacity: 0.8;
    }

    .item-card .card-favorite,
    .item-card .card-checkbox {
        opacity: 1;
    }

    /* Long-press visual feedback */
    .item-card.long-press-active {
        transform: scale(1.02);
        transition: transform 0.2s ease-out;
    }
}

/* Lightbox touch gestures */
.lightbox-content {
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

/* Prevent pull-to-refresh in lightbox */
.lightbox-overlay {
    overscroll-behavior: contain;
}

/* Smooth transitions for swipe feedback */
.lightbox-media-wrapper {
    will-change: transform, opacity;
}

/* Context menu touch optimizations */
@media (hover: none) and (pointer: coarse) {
    .context-menu {
        /* Larger items for touch */
        padding: var(--space-sm) 0;
    }

    .context-menu-item {
        padding: var(--space-md) var(--space-lg);
        min-height: 48px;
    }

    .context-menu-separator {
        margin: var(--space-sm) 0;
    }
}
