/* 1. Reset & Normalize */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f9fafb;
    color: #111827;
    line-height: 1.5;
}

/* 2. Variables CSS */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #d97706;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 12px;
    --header-height: 64px;
}

/* 3. Header - Nouveau design */
.main-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 600;
    font-size: 1.25rem;
    transition: opacity 0.2s;
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ia-accent {
    color: var(--primary);
}

.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gray-700);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.mobile-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.mobile-toggle:active,
.mobile-toggle:focus {
    background: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: block;
    padding: 10px 16px;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
    margin-left: 8px;
}

.nav-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Navigation dropdown */
.nav-dropdown {
    position: relative;
    margin-left: 8px;
}

.nav-dropdown-btn {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.nav-dropdown-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* Style spécial pour le bouton "Nouveau" (action principale) */
.nav-dropdown-btn.nav-btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    font-weight: 600;
}

.nav-dropdown-btn.nav-btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    min-width: 220px;
    z-index: 1000;
    display: none;
    padding: 6px;
    margin-top: 8px;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-700);
    font-size: 0.9em;
    text-decoration: none;
    transition: background 0.15s;
}

.nav-dropdown-item:hover {
    background: var(--gray-100);
    text-decoration: none;
    color: var(--gray-700);
}

.nav-icon {
    font-size: 1.1em;
    width: 18px;
    text-align: center;
}

/* Section labels: masqués sur desktop, visibles sur mobile */
.nav-section-label {
    display: none;
}

/* Backdrop overlay: masqué sur desktop */
.nav-backdrop {
    display: none;
}

.dropdown-arrow {
    font-size: 0.8em;
    transition: transform 0.2s;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* 4. Layout global */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main {
    min-height: calc(100vh - var(--header-height) - 120px);
    padding: 30px 0;
}

.main-footer {
    background: var(--gray-100);
    padding: 30px 20px;
    text-align: center;
    color: var(--gray-500);
    margin-top: auto;
}

.main-footer p {
    margin: 5px 0;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* 4. Composants réutilisables */

.card-header {
    background: #f0f4f8;
    padding: 18px;
    border-bottom: 1px solid var(--gray-200);
}

.card-body {
    padding: 18px;
}

.souvenir-card-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .souvenir-card-footer {
        grid-template-columns: 1fr;
    }
}

.tag-chip {
    background: #e0f2fe;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s;
}

.tag-chip:hover {
    background: #bae6fd;
}

.comp-global-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.comp-global-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.comp-global-tag-personne { background: #ede9fe; color: #5b21b6; }
.comp-global-tag-lieu { background: #ccfbf1; color: #0f766e; }
.comp-global-tag-objet { background: #fee2e2; color: #b91c1c; }
.comp-global-tag-idee { background: #fef3c7; color: #92400e; }
.comp-global-tag-autre { background: #f3f4f6; color: #374151; }
.comp-global-tag-tag { background: #e0f2fe; color: #0369a1; }

.comp-global-tags-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9em;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.comp-global-tags-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.comp-global-tags-icon {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.comp-global-tags-type {
    font-weight: 600;
    text-transform: capitalize;
    min-width: 60px;
    font-size: 0.85em;
    color: #64748b;
}

.comp-global-tags-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: #374151;
}

.comp-global-tag-link {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    text-decoration: none;
    transition: all 0.15s;
}

.comp-global-tag-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Markdown content styling */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    font-size: 1em;
    font-weight: 600;
    margin: 0.5em 0 0.25em;
    color: #1e293b;
}

.markdown-content p {
    margin: 0.5em 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.5em 0;
    padding-left: 2em;
}

.markdown-content li {
    margin: 0.25em 0;
    padding-left: 0.25em;
}

.markdown-content strong {
    font-weight: 600;
}

.markdown-content em {
    font-style: italic;
}

.markdown-content code {
    background: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85em;
    margin: 0.5em 0;
    white-space: pre-wrap;
    max-width: 100%;
}

.markdown-content blockquote {
    border-left: 3px solid #3b82f6;
    margin: 0.5em 0;
    padding-left: 1em;
    color: #64748b;
}

/* Raw text styling (auto-detects Markdown vs plain text with newlines) */
.raw-text p {
    margin: 0.5em 0;
}

.raw-text p:last-child {
    margin-bottom: 0;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden,
.hidden {
    display: none !important;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
}

.overlay img {
    max-height: 95vh;
    max-width: 95vw;
    object-fit: contain;
    touch-action: pinch-zoom;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.upload-queue {
    margin: 20px 0;
    max-height: 200px;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    margin-bottom: 10px;
}

.search-results {
    margin: 20px 0;
}

.result-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 10px;
}

.result-card h4 {
    margin: 0 0 10px 0;
}

.result-card p {
    margin: 0;
    color: var(--gray-500);
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s forwards;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(20px); } }

/* Boutons */
button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: var(--primary-dark);
}

button.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

button.danger {
    background: var(--danger);
}

/* Form elements */
input, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    margin-bottom: 10px;
}

.drop-zone {
    border: 2px dashed var(--gray-300);
    padding: 40px;
    text-align: center;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.drop-zone.hover {
    border-color: var(--primary);
}

/* 5. Responsive breakpoints */

@media (max-width: 768px) {
    .souvenirs-grid {
        grid-template-columns: 1fr;
    }
    .mic-btn {
        width: 100px;
        height: 100px;
        font-size: 2.5em;
    }
    .drop-zone {
        padding: 30px 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    header nav ul {
        flex-direction: column;
        gap: 10px;
    }
}

/* Load more button */
.load-more-container {
    text-align: center;
    margin: 30px 0;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2563eb;
}

/* Mobile Navigation Overlay */
@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
    }

    /* Backdrop overlay semi-transparent */
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(2px);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }
    .nav-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

    .main-nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        max-height: calc(100vh - var(--header-height) - 8px);
        overflow-y: auto;
        background: white;
        border-bottom: 1px solid var(--gray-200);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
        border-radius: 0 0 16px 16px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: all 0.25s ease;
        z-index: 999;
    }

    .main-nav.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-list {
        flex-direction: column;
        padding: 6px 12px 12px;
        gap: 1px;
    }

    /* Section labels visibles sur mobile seulement */
    .nav-section-label {
        display: block;
        padding: 14px 12px 4px;
        font-size: 0.7em;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--gray-400);
        font-weight: 600;
        user-select: none;
    }

    /* Premier label : moins de padding au-dessus */
    .nav-section-label:first-of-type {
        padding-top: 6px;
    }

    .nav-link {
        width: 100%;
        padding: 11px 12px;
        border-radius: 8px;
    }

    .nav-link:active {
        background: var(--gray-100);
    }

    .nav-dropdown {
        margin-left: 0;
        width: 100%;
    }

    .nav-dropdown-btn {
        width: 100%;
        justify-content: space-between;
        padding: 11px 12px;
        border: none;
        border-radius: 8px;
        background: transparent;
        font-size: 0.95em;
        font-weight: 500;
    }

    .nav-dropdown-btn:hover {
        background: var(--gray-100);
        border-color: transparent;
    }

    .nav-dropdown-btn.nav-btn-primary {
        background: transparent;
        color: var(--gray-700);
        font-weight: 500;
    }

    .nav-dropdown-btn.nav-btn-primary:hover {
        background: var(--gray-100);
        transform: none;
        box-shadow: none;
    }

    /* Menu déroulant inline (pas d'absolute) */
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0 0 4px 12px;
        margin-top: 0;
        min-width: auto;
        background: transparent;
    }

    .nav-dropdown-item {
        padding: 10px 12px;
        font-size: 0.9em;
        border-radius: 6px;
    }

    .nav-dropdown-item:active {
        background: var(--gray-100);
    }
}

/* Sentiment badges - centralized styles */
.sentiment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1em;
    flex-shrink: 0;
}

.sentiment-normal {
    width: 24px;
    height: 24px;
}

.sentiment-small {
    width: 18px;
    height: 18px;
    font-size: 0.75em;
}

.sentiment-normal {
    width: 24px;
    height: 24px;
    font-size: 1em;
}

.sentiment-xlarge {
    width: 48px;
    height: 48px;
    font-size: 2em;
    flex-shrink: 0;
}

.sentiment-positif {
    background: #dcfce7;
}

.sentiment-neutre {
    background: #f1f5f9;
}

.sentiment-négatif {
    background: #fee2e2;
}

.sentiment-mixte {
    background: #fef3c7;
}

/* Sentiment background for card-header-row */
.card-header-row.sentiment-bg-positif,
.card-header-row.sentiment-bg-neutre,
.card-header-row.sentiment-bg-négatif,
.card-header-row.sentiment-bg-mixte {
    margin: -16px -16px 12px -16px;
    padding: 20px 16px 10px 12px;
    border-radius: 8px 8px 0 0;
}

.card-header-row.sentiment-bg-positif { background: #dcfce7; }
.card-header-row.sentiment-bg-neutre { background: #f1f5f9; }
.card-header-row.sentiment-bg-négatif { background: #fee2e2; }
.card-header-row.sentiment-bg-mixte { background: #fef3c7; }

/* Header with sentiment for detail.html */
.header-with-sentiment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Active filters bar - minimal design */
.active-filters {
    margin: 16px 0 20px 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.active-filters-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-icon {
    font-size: 0.9em;
}

.filter-label {
    font-size: 0.85em;
    color: #64748b;
    font-weight: 500;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.filter-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.filter-tag.comp-global-tag-personne {
    background: #ede9fe;
    color: #5b21b6;
}

.filter-tag.comp-global-tag-lieu {
    background: #ccfbf1;
    color: #0f766e;
}

.filter-tag.comp-global-tag-objet {
    background: #fee2e2;
    color: #b91c1c;
}

.filter-tag.comp-global-tag-idee {
    background: #fef3c7;
    color: #92400e;
}

.filter-tag.comp-global-tag-autre {
    background: #f3f4f6;
    color: #374151;
}

.filter-tag.comp-global-tag-tag,
.filter-tag.search-tag {
    background: #e0f2fe;
    color: #0369a1;
}

.filter-count {
    font-size: 0.8em;
    color: #94a3b8;
    font-weight: 400;
}

.filter-light-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fefce8;
    color: #ca8a04;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.filter-light-btn:hover {
    background: #fef08a;
    border-color: #facc15;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(202, 138, 4, 0.2);
}

.filter-clear {
    font-size: 0.85em;
    color: #94a3b8;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
    margin-left: auto;
}

.filter-clear:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* Card styles for list.html (moved from inline style) */
.souvenirs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.souvenir-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: visible;
    transition: all 0.2s ease;
    margin-bottom: 16px;  /* Corrige espacement vertical dans la grid */
}

.souvenir-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.card-compact {
    position: relative; /* Allow absolute positioning of children */
    overflow: visible; /* Don't clip absolutely positioned children */
    padding: 0 16px 16px 16px;
    cursor: pointer;
}

.card-compact:hover {
    background: var(--gray-50);
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.merge-checkbox-container {
    margin-right: 12px; /* Space between checkbox and header info */
    align-self: flex-start; /* Align to top */
    display: none; /* Hidden by default, shown only in merge mode */
}

.card-header-info {
    flex: 1;
    padding-left: 12px;
}

.card-date {
    font-size: 0.75em;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.card-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--gray-900);
    margin: 4px 0 0 0;
    line-height: 1.3;
}

.card-menu-btn {
    background: transparent;
    border: none;
    font-size: 1.2em;
    padding: 6px 10px;
    cursor: pointer;
    opacity: 1;
    border-radius: 6px;
    color: var(--gray-700);
}

.card-menu-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.card-excerpt {
    font-size: 0.9em;
    color: var(--gray-600);
    margin: 0 0 12px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.tag-mini {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
}

.card-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

.card-elements-count {
    font-size: 0.85em;
    color: var(--gray-500);
}

.card-medias-icons {
    font-size: 1em;
    letter-spacing: 2px;
}

.card-medias-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
    align-items: center;
}

.card-medias-preview audio {
    min-width: 150px;
    flex: 0 0 auto;
    height: 40px;
    border-radius: 8px;
}

.card-medias-preview video {
    min-width: 150px;
    flex: 0 0 auto;
    border-radius: 8px;
}

.card-medias-preview img {
    border-radius: 8px;
}

.card-medias-preview::-webkit-scrollbar {
    height: 4px;
}

.card-medias-preview::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

.card-dropdown {
    position: relative;
}

.card-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 100;
    display: none;
    padding: 6px;
    margin-top: 4px;
}

.card-dropdown.open .card-dropdown-menu {
    display: block;
}

.card-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-700);
    font-size: 0.9em;
    transition: background 0.15s;
}

.card-dropdown-menu button:hover {
    background: var(--gray-100);
}

.card-dropdown-menu button.danger {
    color: var(--danger);
}

.card-dropdown-menu button.danger:hover {
    background: #fee2e2;
}

.card-dropdown-menu button svg {
    width: 16px;
    height: 16px;
}

.new-shortcut-container {
    margin-top: 24px;
    text-align: center;
}

.btn-new-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1em;
    transition: all 0.2s;
}

.btn-new-shortcut:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.btn-new-shortcut svg {
    width: 20px;
    height: 20px;
}

/* Search compact */
.search-compact {
    display: flex;
    gap: 10px;
    margin: 0 0 20px 0;
}

.search-compact input {
    flex: 1;
    height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    font-size: 0.95em;
}

.search-compact input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-compact button {
    height: 44px;
    width: 44px;
    padding: 0;
    border-radius: 10px;
    font-size: 1.1em;
}

/* Merge Controls - Fixed Bottom */
.merge-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 90;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 2px solid #3b82f6;
    border-radius: 12px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    padding: 16px;
}

.merge-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.merge-info {
    text-align: center;
    width: 100%;
}

.merge-count {
    display: block;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 8px;
}

.merge-titles-preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    margin-top: 8px;
}

.merge-title-item {
    background: rgba(255,255,255,0.9);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    color: #374151;
    border: 1px solid #d1d5db;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.merge-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
}

.merge-header span {
    font-weight: 600;
    color: #1e40af;
    display: block;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .merge-controls {
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 12px;
    }

    .merge-title-item {
        max-width: 120px;
    }
}

/* Merge Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-content h3 {
    margin: 0 0 16px 0;
    color: #1e293b;
}

.modal-content p {
    margin: 0 0 16px 0;
    color: #64748b;
}

.merge-info {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
}

.merge-info p {
    margin: 4px 0;
    font-size: 0.9em;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Souvenir Selector Modal */
.souvenir-selector-modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

#move-souvenir-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 16px 0;
}

/* Compact souvenir cards */
.souvenir-compact-card {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
}

.souvenir-compact-card:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.souvenir-compact-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 2px #dbeafe;
}

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

.card-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95em;
}

.card-date {
    font-size: 0.8em;
    color: #64748b;
}

.card-stats-horizontal {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin: 6px 0;
    flex-wrap: wrap;
}

.card-stats-horizontal span {
    font-size: 0.85em;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-snippet {
    font-size: 0.85em;
    color: #64748b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-thumbnails {
    display: flex;
    gap: 4px;
    margin: 6px 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.card-thumbnails::-webkit-scrollbar {
    display: none;
}

.card-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* Search bar in modal */
.souvenir-selector-modal .search-compact {
    margin-bottom: 16px;
}

.souvenir-selector-modal .search-compact input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px 0 0 6px;
    font-size: 0.9em;
}

.souvenir-selector-modal .search-compact button {
    padding: 8px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
}

/* Blocs repliables - Markdown et Action Context (Janvier 2026) */
.collapsible-section {
    max-width: 800px;
    margin: 24px auto;
    padding: 0 20px;
}

.collapsible-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

.collapsible-icon {
    font-size: 1.2em;
    transition: transform 0.2s;
}

.collapsible-header.expanded .collapsible-icon {
    transform: rotate(90deg);
}

.collapsible-title {
    font-weight: 600;
    color: #1e293b;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-content.open {
    max-height: 2000px;
}

.collapsible-inner {
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
}

/* Styles pour le markdown généré */
.comp-markdown-content h2 {
    font-size: 1.2em;
    color: #1e293b;
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.comp-markdown-content h3 {
    font-size: 1.1em;
    color: #334155;
    margin: 16px 0 10px 0;
}

.comp-markdown-content p {
    line-height: 1.7;
    color: #475569;
    margin: 10px 0;
}

.comp-markdown-content ul, .comp-markdown-content ol {
    padding-left: 24px;
    margin: 12px 0;
}

.comp-markdown-content li {
    margin: 6px 0;
    color: #475569;
}

.comp-markdown-content strong {
    color: #1e293b;
}

/* Styles pour Action Context */
.comp-action-context {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85em;
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0;
}

.comp-action-context-key {
    color: #93c5fd;
}

.comp-action-context-string {
    color: #86efac;
}

.comp-action-context-number {
    color: #fcd34d;
}

.comp-action-context-boolean {
    color: #f9a8d4;
}

.comp-action-context-array {
    color: #c4b5fd;
}

.comp-action-context-null {
    color: #94a3b8;
}