/* Fonts: DM Mono - chargée via layout */

/* =========================================
   RESET & BASE
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    background-color: #16161a;
    color: #ffffff;
    font-family: 'DM Mono', monospace;
    min-height: 100svh;
    overflow-x: hidden;
}

/* =========================================
   LAYOUT PRINCIPAL
   ========================================= */

.app-container {
    position: relative;
    width: 100%;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: #16161a;
}

.app-container.has-sidebar {
    flex-direction: column;
    height: 100svh;
}

/* Conteneur sidebar + contenu (sous le header) */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    min-height: 0;
}

/* Contenu principal */
.main-content {
    flex: 1;
    overflow-y: auto;
    background-color: #1a1a2e;
    padding-bottom: 2rem;
    min-width: 0;
}

.container {
    width: 100%;
    padding: 2rem;
}

/* =========================================
   SIDEBAR
   ========================================= */

.sidebar {
    width: 200px;
    background: #16161a;
    border-right: 1px solid #2a2a3e;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 1rem 0;
}

.header-logo-svg {
    width: auto;
    height: 50px;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #a0a0b0;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    transition: color 0.2s ease;
}

.sidebar-link:hover {
    color: #a78bfa;
}

.sidebar-bottom {
    padding-top: 1rem;
    border-top: 1px solid #2a2a3e;
}

.sidebar-logout {
    font-size: 0.85rem;
    color: #6b6b7b;
}

.sidebar-logout:hover {
    color: #a78bfa;
}

/* =========================================
   HEADER
   ========================================= */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #16161a;
    border-bottom: 1px solid #2a2a3e;
    color: #ffffff;
    flex-shrink: 0;
    z-index: 10;
}

/* Header non-connecté (pages auth) */
.app-container:not(.has-sidebar):not(.home-page) > .header {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    justify-content: space-between;
}

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: #ffffff;
}

.header-logo-img {
    width: auto;
    height: 50px;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.header-subtitle {
    font-weight: 400;
    opacity: 0.8;
}

/* Barre de recherche */
.header-search {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
}

.header-search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.header-search-icon {
    position: absolute;
    left: 0.75rem;
    pointer-events: none;
}

.header-search .header-search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.75rem !important;
    background-color: #1a1a2e;
    border: 1px solid #3d3d5c;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.85rem;
}

.header-search-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.header-search-btn {
    padding: 0.6rem 1.2rem;
    background: #D3CDFD;
    color: #0A0D1B;
    border: none;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.header-search-btn:hover {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    transform: none;
}

/* Menu utilisateur */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-login,
.btn-register {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-login {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.btn-register {
    background-color: #ffffff;
    color: #7c3aed;
}

.btn-register:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Bouton déconnexion */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Menu burger — caché en desktop */
.burger-menu {
    display: none;
}

/* =========================================
   TYPOGRAPHIE
   ========================================= */

h1, h2, h3 {
    color: #ffffff;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

h1 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #e0e0e0;
}

h2 {
    font-size: 1.4rem;
}

h3 {
    font-size: 1.15rem;
}

p {
    line-height: 1.6;
    margin-bottom: 1rem;
    color: #a0a0b0;
}

a {
    color: #a78bfa;
    text-decoration: none;
}

a:hover {
    color: #c4b5fd;
}

/* =========================================
   MESSAGES FLASH
   ========================================= */

.message {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.success {
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* =========================================
   FORMULAIRES
   ========================================= */

.auth-box,
.form-container {
    background-color: #252537;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #1a1a2e;
    border: 1px solid #3d3d5c;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background-color: #1a1a2e;
}

input::placeholder {
    color: #6b6b7b;
}

input.error {
    border-color: #ef4444;
}

.error-text {
    color: #fca5a5;
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

/* Ligne double (ex : date + grade) */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* Cases à cocher */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

input[type="checkbox"] {
    width: auto;
    accent-color: #8b5cf6;
}

/* =========================================
   BOUTONS
   ========================================= */

/*
.btn,
button[type="submit"]:not(.btn-home-connect) {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover,
button[type="submit"]:not(.btn-home-connect):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    color: #ffffff;
}
*/

.btn-primary {
    background: #D3CDFD;
    color: #0A0D1B;
}

.btn-secondary {
    background: #0A0D1B;
    color: #D3CDFD;
}

.btn-secondary:hover {
    background: #4d4d6c;
    box-shadow: 0 4px 12px rgba(61, 61, 92, 0.4);
}

.btn-danger {
    background: #EA8787;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-block {
    width: 100%;
}

.btn-search {
    background: #D3CDFD;
    color: #0A0D1B;
    font-size: 0.75rem;
    padding: 0.6rem 1.2rem;
}

/* =========================================
   TABLEAUX
   ========================================= */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #CFC9F8;
    color: #090D19;
    height: 3rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #2a2a3e;
}

td {
    border-bottom: 1px solid #1e1e30;
    color: #c0c0d0;
    font-size: 0.8rem;
}

tbody tr {
    background: #16161f;
}

tbody tr:nth-child(even) {
    background: #1a1a28;
}

tbody tr:hover {
    background-color: rgba(139, 92, 246, 0.08);
}

tbody tr:last-child td {
    border-bottom: none;
}

.sort-indicator {
    opacity: 0.6;
    margin-left: 0.5rem;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: #6b6b7b;
}

/* Lignes cliquables */
tr.clickable-row {
    cursor: pointer;
}

tr.clickable-row:hover {
    background-color: rgba(167, 139, 250, 0.08);
}

/* Colonne badge gradué — masquée par défaut, visible en mobile */
.graded-badge-header,
.graded-badge-cell {
    display: none;
}

/* =========================================
   BADGES
   ========================================= */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-yes {
    background-color: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.badge-no {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* =========================================
   BOUTONS D'ACTION (tableaux)
   ========================================= */

.actions-cell {
    text-align: center;
    white-space: nowrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    margin: 0 0.15rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: pointer;
}

.edit-btn {
    color: #6b6b7b;
}

.edit-btn:hover {
    color: #a78bfa;
}

.delete-btn {
    color: #6b6b7b;
}

.delete-btn:hover {
    color: #ef4444;
}

.action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.supr-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    color: #ef4444;
}

.supr-btn:hover {
    color: #a78bfa;
}

/* =========================================
   RECHERCHE
   ========================================= */

.search-form {
    margin: 2rem 0;
}

.search-form form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
}

.search-form input[type="text"] {
    flex: 1;
}

.search-form button {
    white-space: nowrap;
}

/* =========================================
   PAGES AUTHENTIFICATION
   ========================================= */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}

.auth-box {
    max-width: 420px;
    width: 100%;
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #3d3d5c;
    color: #a0a0b0;
}

/* =========================================
   PAGE COMPTE
   ========================================= */

.account-container {
    max-width: 100%;
    margin: 0 auto;
}

.account-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 1.5rem;
}

.account-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: #e0e0e0;
}

.info-card {
    box-sizing: border-box;
    padding: 40px;
    width: 100%;
    border: 1px solid rgba(211, 205, 253, 0.2);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem 0;
    border-bottom: 1px solid #3d3d5c;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-size: 0.8rem;
    color: #a0a0b0;
}

.info-row .value {
    font-size: 0.8rem;
    color: #e0e0e0;
}

.change-password-btn { color: #5A5DEA; font-size: 0.8rem; }
.delete-account-btn  { color: #EA8787; font-size: 0.8rem; }
.edit-profile-btn    { color: #D3CDFD; font-size: 0.8rem; }

.change-password-btn:hover,
.delete-account-btn:hover,
.edit-profile-btn:hover {
    color: #a78bfa;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* =========================================
   CONFIRMATION DE SUPPRESSION
   ========================================= */

.warning-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.card-info {
    background-color: #1a1a2e;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    text-align: left;
}

.warning-message {
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: inherit;
    padding: 1rem;
    margin: 1.5rem 0;
    font-weight: 500;
    margin-bottom: 5%;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* =========================================
   OVERLAY FORMULAIRE CARTE
   ========================================= */

.card-form-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.card-form-container h1 {
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: #a0a0b0;
    margin-bottom: 1.5rem;
}

.card-form-info {
    text-align: center;
    margin-bottom: 2rem;
}

.card-form-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.card-form-detail {
    font-size: 0.85rem;
    color: #6b6b7b;
    margin-bottom: 0.15rem;
}

.card-form {
    width: 100%;
    max-width: 480px;
    border: 1px solid #2a2a3e;
    background: #16161a;
    padding: 2rem;
}

.card-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.card-form-actions .btn {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    padding: 0.7rem 1.5rem;
}

/* =========================================
   DÉTAIL CARTE
   ========================================= */

.card-detail {
    border: 1px solid rgba(211, 205, 253, 0.2);
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #3d3d5c;
}

.card-number {
    color: #a0a0b0;
    font-size: 0.95rem;
}

.card-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    padding: 1rem;
    background: #1a1a2e;
    border-radius: 8px;
}

.info-item .label {
    display: block;
    font-size: 0.8rem;
    color: #a0a0b0;
    margin-bottom: 0.25rem;
}

.info-item .value {
    font-weight: 500;
    color: #ffffff;
}

.card-notes {
    background: #1a1a2e;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.card-notes h3 {
    margin-bottom: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 4rem;
    flex-wrap: wrap;
}

/* Boutons d'action sur la fiche */
.scan-btn     { color: #D3CDFD; }
.modifier-btn { color: #5A5DEA; }
.supprimer-btn { color: #EA8787; }
.retour-btn   { color: #a0a0b0; }

.scan-btn:hover,
.modifier-btn:hover,
.supprimer-btn:hover,
.retour-btn:hover {
    color: #a78bfa;
}

/* =========================================
   EN-TÊTE COLLECTION
   ========================================= */

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.collection-header h1 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #e0e0e0;
}

.collection-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-count,
.stat-value {
    color: #a0a0b0;
    font-size: 0.85rem;
}

/* =========================================
   PAGE SCAN
   ========================================= */

.scan-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.scan-section {
    background: #252537;
    padding: 1.5rem;
    text-align: center;
}

.scan-section h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #D3CDFD;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.scan-preview {
    position: relative;
    margin-bottom: 1rem;
}

.scan-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border: 1px solid #3d3d5c;
    display: block;
    margin: 0 auto;
}

.scan-empty {
    padding: 3rem 1rem;
    border: 2px dashed #3d3d5c;
    margin-bottom: 1rem;
    color: #6b6b7b;
}

.scan-empty .scan-icon {
    margin-bottom: 0.75rem;
    color: #6b6b7b;
}

.scan-empty p {
    color: #6b6b7b;
    font-size: 0.85rem;
    margin: 0;
}

.scan-file-input {
    display: none;
}

.scan-btn-capture,
.scan-btn-retake {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.scan-btn-capture {
    background: #D3CDFD;
    color: #0A0D1B;
    border: none;
    width: 100%;
}

.scan-btn-capture:hover {
    background: #c4b5fd;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.scan-btn-retake {
    background: #0A0D1B;
    color: #D3CDFD;
    border: 1px solid #3d3d5c;
}

.scan-btn-retake:hover {
    background: #4d4d6c;
}

.scan-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.scan-upload-form,
.scan-delete-form {
    display: inline;
}

.scan-btn-delete {
    background: none;
    border: none;
    padding: 0.7rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    color: #EA8787;
    cursor: pointer;
    transition: color 0.2s ease;
}

.scan-btn-delete:hover {
    color: #ef4444;
}

.scan-uploading {
    color: #D3CDFD;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    animation: pulse 1.5s ease-in-out infinite;
}

/* =========================================
   MODAL CAMÉRA
   ========================================= */

.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.camera-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-viewport video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Cadre de visée — carte standard */
.camera-guide {
    height: 70%;
    aspect-ratio: 63 / 88;
    border: 2px solid rgba(211, 205, 253, 0.8);
    border-radius: 12px;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(211, 205, 253, 0.3);
}

/* Cadre de visée — carte gradée (slab) */
.camera-guide--slab {
    aspect-ratio: 32 / 54;
    border-radius: 4px;
    border-color: rgba(190, 243, 223, 0.8);
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(190, 243, 223, 0.3);
}

.camera-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: #000;
    flex-shrink: 0;
}

.camera-btn-cancel {
    background: none;
    border: none;
    color: #D3CDFD;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 80px;
    text-align: left;
}

.camera-btn-shutter {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid #D3CDFD;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.camera-btn-shutter:active {
    transform: scale(0.9);
}

.shutter-ring {
    display: block;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #D3CDFD;
    transition: all 0.15s ease;
}

.camera-btn-shutter:active .shutter-ring {
    background: #a78bfa;
}

.camera-btn-placeholder {
    min-width: 80px;
}

/* =========================================
   PAGE D'ACCUEIL
   ========================================= */

.home-page {
    flex-direction: column;
    background: linear-gradient(180deg, #8962FE 0%, #45318D 49.97%, #090D19 100%);
}

.home-page .main-content {
    background: transparent;
}

/* Centre (logo + formulaire de connexion) */
.home-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100svh - 200px);
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
    overflow: hidden;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.logo-svg {
    width: min(300px, 60vw);
    max-width: 100%;
    height: auto;
    animation: logoFadeIn 1.2s ease-out forwards, logoGlow 3s ease-in-out 1.2s infinite;
    opacity: 0;
    filter: drop-shadow(0 0 0 transparent);
}

.home-page .logo-svg {
    filter: none;
    animation: logoFadeIn 1.2s ease-out forwards;
}

.logo-path {
    opacity: 0;
    animation: pathFadeIn 0.6s ease-out forwards;
}

.path-1 { animation-delay: 0.1s; }
.path-2 { animation-delay: 0.3s; }
.path-3 { animation-delay: 0.4s; }
.path-4 { animation-delay: 0.6s; }
.path-5 { animation-delay: 0.8s; }

#text {
    font-size: clamp(1rem, 4vw, 2rem);
    height: 1lh;
    font-weight: 400;
    color: #c4b5fd;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.02em;
}

.home-page #text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Carte centrale (non connecté) */
.home-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 40px;
    gap: 24px;
    background: transparent;
    border: none;
    width: 380px;
    max-width: 90vw;
}

.home-card .logo-container {
    padding: 0;
}

.home-card .logo-svg {
    width: min(250px, 50vw);
}

.home-card #text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    margin-top: 0;
}

/* Bouton SE CONNECTER initial */
.home-card > #btn-show-login {
    margin-top: 8px;
}

/* Formulaire connexion intégré (caché par défaut) */
.home-login-form {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0;
    margin-top: 8px;
    padding: 32px;
    background: rgba(211, 205, 253, 0.05);
    border: 1px solid rgba(211, 205, 253, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.home-login-form.visible {
    display: flex;
    opacity: 1;
}

.home-login-form form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
}

.home-login-form .form-group {
    width: 100%;
    margin-bottom: 0;
}

.home-login-form .form-group label {
    display: block;
    color: #8b5cf6;
    font-size: 10px;
    font-weight: 500;
    line-height: 13px;
    letter-spacing: 0.02em;
    margin-bottom: 0;
}

.home-login-form input[type="text"],
.home-login-form input[type="email"],
.home-login-form input[type="password"] {
    width: 100%;
    height: 47px;
    padding: 8px;
    background: rgba(211, 205, 253, 0.05) !important;
    border: 1px solid rgba(211, 205, 253, 0.2) !important;
    border-radius: 0 !important;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.85rem;
    box-shadow: none !important;
}

/* Surcharge auto-remplissage navigateur */
.home-login-form input:-webkit-autofill,
.home-login-form input:-webkit-autofill:hover,
.home-login-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0px 1000px #45318D inset !important;
    box-shadow: 0 0 0px 1000px #45318D inset !important;
    background-color: #45318D !important;
    transition: background-color 9999s ease-in-out 0s;
}

.home-login-form input::selection {
    background: rgba(139, 92, 246, 0.4);
    color: #ffffff;
}

.home-login-form input::placeholder {
    color: rgba(211, 205, 253, 0.4);
}

.home-login-form input[type="text"]:focus,
.home-login-form input[type="email"]:focus,
.home-login-form input[type="password"]:focus {
    outline: none;
    border: 1px solid rgba(211, 205, 253, 0.5) !important;
    box-shadow: none !important;
    background: rgba(211, 205, 253, 0.05) !important;
}

/* Lien mot de passe oublié */
.home-login-forgot {
    text-align: left;
    width: 100%;
    margin: 0;
}

.home-login-forgot a {
    color: #D3CDFD;
    font-size: 10px;
    font-weight: 400;
    line-height: 13px;
    text-decoration: underline;
    font-style: normal;
}

.home-login-forgot a:hover {
    color: #ffffff;
}

/* Bouton SE CONNECTER */
.btn-home-connect {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 16px;
    width: 100%;
    height: 40px;
    padding: 16px 24px;
    background: #D3CDFD;
    color: #0A0D1B;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.02em;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0;
}

.btn-home-connect:hover {
    background: #c4b5fd;
}

/* Footer */
.home-footer-text {
    position: absolute;
    bottom: 2rem;
    text-align: center;
}

.home-footer-text p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin: 0;
}

.home-footer-text a {
    color: rgba(255, 255, 255, 0.7);
}

.home-footer-text a:hover {
    color: #ffffff;
}

/* =========================================
   ANIMATIONS
   ========================================= */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

@keyframes logoFadeIn {
    0%   { opacity: 0; transform: scale(0.8) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pathFadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes logoGlow {
    0%, 100% { filter: drop-shadow(0 0 15px rgba(124, 58, 237, 0.4)); }
    50%       { filter: drop-shadow(0 0 30px rgba(167, 139, 250, 0.6)); }
}

/* =========================================
   BARRE DE DÉFILEMENT
   ========================================= */

.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: #1a1a2e;
}

.main-content::-webkit-scrollbar-thumb {
    background: #3d3d5c;
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #8b5cf6;
}

/* =========================================
   MESSAGERIE
   ========================================= */

/* Badge messages non lus (sidebar + burger) */
.msg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #8b5cf6;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 9px;
    margin-left: 0.5rem;
    line-height: 1;
}

/* En-tête de la liste */
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.message-header h1 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #e0e0e0;
}

.message-actions-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Bouton nouveau message */
.compose-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #D3CDFD;
    color: #0A0D1B;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.compose-btn:hover {
    background: #c4b5fd;
    color: #8b5cf6;
}

.sent-link {
    color: #a0a0b0;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.sent-link:hover {
    color: #a78bfa;
}

/* Indicateur non lu */
.msg-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 50%;
}

/* Ligne non lue en gras */
tr.msg-unread td {
    color: #ffffff;
    font-weight: 500;
}

/* Largeurs colonnes — desktop */
.msg-status-cell {
    width: 20px;
    padding: 0.75rem 0.25rem;
    text-align: center;
}

.msg-sender {
    width: 140px;
    white-space: nowrap;
}

.msg-date {
    width: 130px;
    white-space: nowrap;
    color: #6b6b7b;
    font-size: 0.75rem;
}

.msg-subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0;
    width: 100%;
}

/* Largeur colonne actions (messagerie) */
.actions-cell {
    width: 50px;
    text-align: center;
}

/* Vue lecture message */
.message-view {
    max-width: 700px;
}

.message-view-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #2a2a3e;
}

.message-view-header h1 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 0.75rem;
}

.message-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message-meta-item {
    font-size: 0.8rem;
    color: #a0a0b0;
}

.message-meta-item strong {
    color: #c0c0d0;
}

.message-body {
    background: #1a1a2e;
    padding: 1.25rem;
    color: #c0c0d0;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    min-height: 100px;
}

.message-view-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.delete-msg-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #EA8787;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.delete-msg-btn:hover {
    color: #ef4444;
}

.back-link {
    color: #a0a0b0;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #a78bfa;
}

/* Formulaire composition */
.message-compose {
    max-width: 700px;
}

.message-compose h1 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 1.5rem;
}

.message-form .form-group {
    margin-bottom: 1.25rem;
}

.message-form .form-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Autocomplétion destinataire */
.user-search-wrapper {
    position: relative;
}

.user-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #252537;
    border: 1px solid #3d3d5c;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.user-search-item {
    padding: 0.6rem 1rem;
    color: #c0c0d0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.user-search-item:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #D3CDFD;
}

.user-search-item.no-result {
    color: #6b6b7b;
    cursor: default;
    font-style: italic;
}

.user-search-item.no-result:hover {
    background: transparent;
    color: #6b6b7b;
}

/* Message original (réponse) */
.reply-original {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #1a1a2e;
    border-left: 3px solid #3d3d5c;
}

.reply-original-label {
    font-size: 0.8rem;
    color: #6b6b7b;
    margin-bottom: 0.5rem;
}

.reply-original blockquote {
    margin: 0;
    color: #a0a0b0;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Historique de conversation */
.conversation-history {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #2a2a3e;
}

.conversation-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #a0a0b0;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conversation-msg {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid #3d3d5c;
    background: #1a1a2e;
}

.conversation-msg--sent     { border-left-color: #8b5cf6; }
.conversation-msg--received { border-left-color: #3d3d5c; }
.conversation-msg--active   { background: rgba(139, 92, 246, 0.1); border-left-color: #D3CDFD; }

.conversation-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.conversation-msg-author {
    font-size: 0.8rem;
    font-weight: 500;
    color: #D3CDFD;
}

.conversation-msg--received .conversation-msg-author {
    color: #a0a0b0;
}

.conversation-msg-date {
    font-size: 0.7rem;
    color: #6b6b7b;
}

.conversation-msg-subject {
    font-size: 0.75rem;
    color: #6b6b7b;
    margin-bottom: 0.4rem;
    font-style: italic;
}

.conversation-msg-body {
    font-size: 0.85rem;
    color: #c0c0d0;
    line-height: 1.5;
}

/* Liste conversations (inbox groupée) */
.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #2a2a3e;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.9rem 1rem;
    text-decoration: none;
    color: #a0a0b0;
    border-bottom: 1px solid #1e1e30;
    transition: background 0.15s ease;
}

.conv-item:last-child {
    border-bottom: none;
}

.conv-item:hover {
    background: #1a1a2e;
}

.conv-item--unread {
    color: #e0e0e0;
}

.conv-item--unread .conv-sender {
    color: #ffffff;
    font-weight: 600;
}

.conv-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2a2a45;
    color: #a78bfa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.conv-item--unread .conv-avatar {
    background: #3d2f6e;
    color: #c4b5fd;
}

.conv-content {
    flex: 1;
    min-width: 0;
}

.conv-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.conv-sender {
    font-size: 0.875rem;
    color: #c0c0d0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-date {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: #6b6b7b;
}

.conv-item--unread .conv-date {
    color: #a78bfa;
}

.conv-subject {
    font-size: 0.8rem;
    color: #6b6b7b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item--unread .conv-subject {
    color: #a0a0b0;
}

.conv-badge {
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #7c3aed;
    color: #fff;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   ÉCHANGE & WISHLIST
   ========================================= */

/* Toggle "Proposer à l'échange" */
.trade-form {
    margin-top: 1rem;
}

.trade-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    color: #6b6b7b;
    border: 1px solid #2a2a3e;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.trade-toggle-btn:hover {
    border-color: #a78bfa;
    color: #a78bfa;
}

.trade-toggle-btn--active {
    background: #1e1630;
    color: #a78bfa;
    border-color: #7c3aed;
}

.trade-toggle-btn--active:hover {
    background: #2a1f4a;
}

/* Bouton étoile wishlist */
.wishlist-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #4a4a5a;
    padding: 0.2rem;
    transition: color 0.2s ease, transform 0.15s ease;
}

.wishlist-btn:hover {
    color: #f59e0b;
    transform: scale(1.2);
}

.wishlist-btn--active {
    color: #f59e0b;
}

.wishlist-btn--active:hover {
    color: #d97706;
}

/* =========================================
   RESPONSIVE — max-width: 768px
   ========================================= */

@media (max-width: 768px) {

    /* --- Layout --- */
    .app-container {
        width: 100%;
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }

    .content-wrapper {
        flex: 1;
        min-height: 0;
    }

    .container {
        padding: 1rem;
    }

    /* --- Header --- */
    .header {
        padding: 1rem;
    }

    .header-search {
        max-width: 100%;
    }

    .header-logo-img {
        height: 40px;
    }

    /* --- Typographie --- */
    h1 {
        font-size: 1.4rem;
    }

    /* --- Menu burger --- */
    .burger-menu {
        display: block;
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        z-index: 1000;
    }

    .burger-checkbox {
        display: none;
    }

    .burger-icon {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 48px;
        height: 48px;
        background: #D3CDFD;
        border-radius: 0;
        cursor: pointer;
        box-shadow: none;
        transition: all 0.3s ease;
    }

    .burger-icon:hover {
        background: #c4b5fd;
    }

    .burger-icon span {
        display: block;
        width: 20px;
        height: 2px;
        background: #0A0D1B;
        border-radius: 0;
        margin: 2.5px 0;
        transition: all 0.3s ease;
    }

    /* Animation burger → X */
    .burger-checkbox:checked + .burger-icon span:nth-child(1) {
        transform: rotate(45deg) translate(4px, 4px);
    }

    .burger-checkbox:checked + .burger-icon span:nth-child(2) {
        opacity: 0;
    }

    .burger-checkbox:checked + .burger-icon span:nth-child(3) {
        transform: rotate(-45deg) translate(4px, -4px);
    }

    /* Menu déroulant */
    .burger-dropdown {
        position: absolute;
        bottom: 60px;
        right: 0;
        background: #16161a;
        border: 1px solid rgba(211, 205, 253, 0.2);
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.3s ease;
        min-width: 200px;
    }

    .burger-checkbox:checked ~ .burger-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .burger-dropdown a {
        display: block;
        padding: 1rem 1.25rem;
        color: #a0a0b0;
        text-decoration: none;
        font-size: 0.8rem;
        transition: all 0.2s ease;
        border-bottom: 1px solid rgba(211, 205, 253, 0.1);
    }

    .burger-dropdown a:last-child {
        border-bottom: none;
    }

    .burger-dropdown a:hover {
        background: rgba(211, 205, 253, 0.08);
        color: #D3CDFD;
    }

    /* --- Page compte --- */
    .account-info {
        grid-template-columns: 1fr;
    }

    .info-card {
        padding: 24px 16px;
    }

    .info-row {
        flex-direction: column;
        gap: 0.25rem;
    }

    /* --- Formulaires --- */
    .search-form form {
        flex-direction: column;
    }

    .button-group {
        flex-direction: column;
    }

    /* --- Overlay formulaire carte --- */
    .card-form-container {
        padding: 0.5rem;
    }

    .card-form {
        padding: 1.25rem;
    }

    .card-form-container h1 {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .card-form-info {
        margin-bottom: 1rem;
    }

    .card-form-name {
        font-size: 0.95rem;
    }

    .card-form .form-group {
        margin-bottom: 0.75rem;
    }

    .card-form label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    .card-form input,
    .card-form select,
    .card-form textarea {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .card-form textarea {
        min-height: 2.5rem;
    }

    .card-form-actions {
        margin-top: 1rem;
    }

    .card-form-actions .btn {
        padding: 0.55rem 1rem;
        font-size: 0.75rem;
    }

    /* --- Tableaux --- */
    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }

    /* Colonnes masquées en mobile */
    .price-cell, .graded-cell, .grade-cell, .quantity-cell,
    .price-header, .graded-header, .grade-header, .quantity-header,
    .company-cell, .price-cell-grad,
    .company-header, .price-header-grad {
        display: none;
    }

    /* Colonne badge gradué — visible en mobile */
    .graded-badge-header,
    .graded-badge-cell {
        display: table-cell;
        width: 24px;
        padding: 0 0.1rem;
        text-align: center;
    }

    .graded-badge {
        display: inline-block;
        vertical-align: middle;
    }

    /* Lignes possédées */
    tbody tr.owned-row {
        background: rgba(190, 243, 223, 0.15);
    }

    tbody tr.owned-row td {
        color: #BEF3DF;
    }

    /* --- Détail carte --- */
    .card-detail {
        padding: 1rem;
    }

    .card-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .card-actions a,
    .card-actions button {
        width: 100%;
        text-align: center;
    }

    /* --- Scan --- */
    .scan-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .scan-section {
        padding: 1rem;
    }

    .scan-image {
        max-width: 100%;
    }

    .scan-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* --- Confirmation suppression --- */
    .warning-message {
        margin-bottom: 1rem;
    }

    /* --- Page d'accueil --- */
    .home-center {
        min-height: calc(100svh - 180px);
        padding: 0.5rem;
    }

    .logo-container {
        padding: 1rem;
    }

    .logo-svg {
        width: 90vw;
        max-width: 350px;
    }

    .home-card {
        width: 90vw;
        padding: 32px 24px;
    }

    #text {
        font-size: 1rem;
        text-align: center;
        padding: 0 1rem;
    }

    /* --- Messagerie --- */
    .message-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-actions-header {
        width: 100%;
        justify-content: space-between;
    }

    /* Masquer point non lu et date */
    .msg-status-cell,
    .msg-status-header,
    .msg-date,
    .msg-date-header {
        display: none;
    }

    .msg-sender {
        width: auto;
        white-space: nowrap;
    }

    .msg-subject {
        max-width: 0;
        width: 100%;
    }

    .actions-cell {
        width: 40px;
        padding: 0.75rem 0.25rem;
    }

    .message-view-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 2rem;
        margin-top: 2rem;
    }

    .message-form .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .message-form .form-actions .compose-btn {
        justify-content: center;
    }

    .conversation-msg-header {
        flex-direction: column;
        gap: 0.25rem;
    }

    /* --- Conversations (liste) --- */
    .conv-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .conv-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }
}
