/* ============================================================
   Viewer - Page détail item
   ============================================================ */

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}
.back-link:hover { color: var(--accent); }

.item-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 860px) {
    .item-layout { grid-template-columns: 1fr; }
}

/* --- Galerie photos --- */
.gallery-main {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}
.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.gallery-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.gallery-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border: 2px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
}
.gallery-thumb.active { border-color: var(--accent); }
.gallery-empty {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    border-radius: 4px;
}

/* --- Viewer 3D --- */
.viewer3d-block {
    margin-top: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
}
.viewer3d-block h3 {
    margin: 0 0 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}
.viewer3d-block select {
    width: 100%;
    margin-bottom: 10px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 3px;
}
#viewer3d-container {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #EAEDF0;
    border-radius: 3px;
    overflow: hidden;
}
#viewer3d-canvas {
    width: 100%;
    height: 100%;
    display: block;
}
#viewer3d-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}
.fichier3d-info {
    font-size: 13px;
    color: var(--text-muted);
    margin: 10px 0 4px;
}
.fichier3d-lien-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

/* --- Colonne infos --- */
.item-info h1 {
    font-size: 24px;
    margin: 0 0 6px;
}
.item-reference {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0 0 6px;
}
.item-dims {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 10px;
}
.item-poids {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    margin: -6px 0 10px;
}
.item-prix {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 20px;
}

.item-facts {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}
.item-facts {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    table-layout: auto;
}
.item-facts th, .item-facts td {
    text-align: left;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.item-facts th {
    white-space: nowrap;
    padding-right: 20px;
    color: var(--text-muted);
    font-weight: 600;
    vertical-align: top;
}
.item-facts td {
    font-family: var(--font-body);
    width: 100%;
}
.td-muted { color: var(--text-muted); font-size: 13px; }


.annonce-resultat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
}
.annonce-resultat pre {
    white-space: pre-wrap;
    font-family: var(--font-body);
    font-size: 13px;
    margin: 0;
}

.edit-link {
    display: inline-block;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}
.edit-link:hover { color: var(--accent); }

.item-createur {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px;
}
.item-createur a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.item-createur a:hover { text-decoration: underline; }

/* --- Section annonce Vinted --- */
.annonce-details {
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 16px;
    background: var(--surface);
    overflow: hidden;
}
.annonce-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.annonce-summary::-webkit-details-marker { display: none; }
.annonce-summary::before {
    content: '▸';
    font-size: 11px;
    transition: transform 0.15s ease;
}
.annonce-details[open] .annonce-summary::before { transform: rotate(90deg); }

.annonce-etat-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.annonce-etat-initiée {
    background: #E8F0FE;
    color: #3B6FD4;
    border-color: #3B6FD4;
}
.annonce-etat-postée {
    background: #E7F3EC;
    color: #2F7D52;
    border-color: #2F7D52;
}
.badge-stock { font-weight: 600; }
.stock-zero     { background: #FBEAEA; color: #C23B3B; }
.stock-positive { background: none; color: inherit; }

.annonce-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}
.annonce-editor {
    width: 100%;
    min-height: 280px;
    margin: 14px 0 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    background: #FCFCFD;
    box-sizing: border-box;
}
.annonce-editor:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232, 99, 28, 0.12);
}
.annonce-posted {
    margin: 14px 0 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    background: #F4F6F8;
    white-space: pre-wrap;
}
.annonce-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.btn-annonce-copy { margin-left: auto; }
.btn-annonce-save, .btn-annonce-post, .btn-annonce-delete, .btn-annonce-action {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    font-family: var(--font-body);
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-annonce-save {
    background: var(--text);
    color: var(--surface);
    border-color: var(--text);
}
.btn-annonce-save:hover { background: var(--accent); border-color: var(--accent); }
.btn-annonce-post {
    background: var(--surface);
    color: var(--text);
}
.btn-annonce-post:hover { border-color: var(--accent); color: var(--accent); }
.btn-annonce-delete {
    background: var(--surface);
    color: var(--error);
    border-color: var(--border);
}
.btn-annonce-delete:hover { background: var(--error-bg); border-color: var(--error); }
.btn-annonce-action {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-annonce-action:hover { border-color: var(--accent); color: var(--accent); }

.annonce-feedback {
    font-size: 13px;
    margin: 8px 0 0;
}

/* --- Bouton Modifier cet item (style btn-add de admin.css) --- */
.btn-add {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 3px;
    background: var(--text);
    color: var(--surface);
    border: 1px solid var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-add:hover { background: var(--accent); border-color: var(--accent); }

/* --- Boutons téléchargement (galerie + viewer 3D) --- */
.btn-media-download {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(255,255,255,0.88);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    backdrop-filter: blur(4px);
    z-index: 10;
}
.btn-media-download svg {
    width: 16px;
    height: 16px;
    display: block;
}
.btn-media-download:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-annonce-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-muted);
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-annonce-copy svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-annonce-copy:hover { border-color: var(--accent); color: var(--accent); }

/* --- Galerie full-screen --- */
#gallery-fullscreen {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
#gallery-fullscreen.fs-open { display: flex; }

.fs-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 3px;
    user-select: none;
}

.fs-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.fs-close svg { width: 20px; height: 20px; stroke: #fff; }
.fs-close:hover { background: rgba(255,255,255,0.2); }

.fs-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.fs-nav svg { width: 22px; height: 22px; stroke: #fff; }
.fs-nav:hover { background: rgba(255,255,255,0.25); }
.fs-prev { left: 16px; }
.fs-next { right: 16px; }

.fs-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

/* ============================================================
   Cartes fichiers 3D
   ============================================================ */
.fichiers3d-cards { margin-top: 20px; }
.fichiers3d-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin: 0 0 12px;
}
.fichier3d-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease;
}
.fichier3d-card:hover { border-color: var(--accent); }

.fichier3d-card-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--bg);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fichier3d-card-icon svg { width: 20px; height: 20px; stroke: var(--accent); }

.fichier3d-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.fichier3d-card-format {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.fichier3d-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fichier3d-card-lien {
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
}
.fichier3d-card-lien:hover { text-decoration: underline; }

.fichier3d-card-actions { flex-shrink: 0; }
.fichier3d-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.fichier3d-card-btn svg { width: 15px; height: 15px; }
.fichier3d-card-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Overlay au survol : icône œil + texte */
.fichier3d-card-hover {
    position: absolute;
    inset: 0;
    background: rgba(232, 99, 28, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.fichier3d-card-hover svg { width: 16px; height: 16px; stroke: var(--accent); }
.fichier3d-card:hover .fichier3d-card-hover { opacity: 1; }

/* ============================================================
   Accordéon viewer 3D (s'ouvre sous les cartes fichiers)
   ============================================================ */
.fichiers3d-section { margin-top: 20px; }

.fichier3d-card.active {
    border-color: var(--accent);
    background: rgba(232, 99, 28, 0.04);
}

.viewer3d-accordion {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: #1A1D23;
}

.viewer3d-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.viewer3d-accordion-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.viewer3d-accordion-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.viewer3d-accordion-actions .fichier3d-card-btn {
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.45);
    background: transparent;
}
.viewer3d-accordion-actions .fichier3d-card-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.viewer3d-accordion-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1A1D23;
}
.viewer3d-accordion-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
#viewer3d-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    margin: 0;
    pointer-events: none;
}
.viewer3d-accordion-hint {
    padding: 8px 14px;
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    border-top: 1px solid rgba(255,255,255,0.07);
    font-style: italic;
}

.btn-back-catalogue {
    display: block;
    width: fit-content;
    margin-bottom: 20px;
    padding: 9px 20px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-back-catalogue:hover { border-color: var(--accent); color: var(--accent); }

/* --- Bouton Voir l'annonce Vinted --- */
.btn-vinted {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin-bottom: 16px;
    border: 1px solid #009EE0;
    border-radius: 3px;
    background: transparent;
    color: #009EE0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    transition: background 0.15s ease;
}
.btn-vinted svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-vinted:hover { background: rgba(0, 158, 224, 0.08); }

/* --- Rangée de boutons actions item --- */
.item-actions-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.item-actions-row .btn-add,
.item-actions-row .btn-vinted {
    margin-bottom: 0;
}
