/* ============================================================
   Viewer - Catalogue impressions 3D
   Même système de tokens que admin.css (cohérence visuelle globale)
   ============================================================ */

:root {
    --bg: #F4F6F8;
    --surface: #FFFFFF;
    --border: #D8DCE2;
    --text: #1A1D23;
    --text-muted: #5C6470;
    --accent: #E8631C;

    --font-body: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 40px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.5;
}

.page-header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--text);
}
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.page-header-identity {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 14px;
}
.header-logo {
    width: 100px;
    height: auto;
    object-fit: contain;
    display: block;
}
.page-header-text h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.1;
}
.page-header-text .subtitle {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.btn-admin-access {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: border-color 0.15s ease, color 0.15s ease;
    line-height: 1;
}
.btn-admin-access svg {
    flex-shrink: 0;
    align-self: center;
}
.btn-admin-access span {
    line-height: 1;
}
.btn-admin-access:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-admin-connected {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-admin-connected:hover {
    background: rgba(232, 99, 28, 0.06);
}
.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
}
.subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.empty-state {
    color: var(--text-muted);
    font-size: 14px;
}

.catalogue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 300px);
    gap: 20px;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    width: 300px;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.card-image {
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    background: #EFF1F3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-image-placeholder {
    font-size: 12px;
    color: var(--text-muted);
}

.card-body {
    flex: 1;
    padding: 14px;
    display: flex;
    flex-direction: column;
}
.card-reference {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.card-title {
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px;
}
.card-label {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-specs {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    margin: 0 0 4px;
}
.card-spec {
    display: flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}
.card-spec + .card-spec::before {
    content: '·';
    color: var(--border);
    margin: 0;
}
.card-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    stroke: var(--text-muted);
}
.card-badges {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    margin-bottom: 4px;
}
.badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 8px;
    white-space: nowrap;
}
.card-prix {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 15px;
    color: var(--accent);
    margin: 5px 0 0;
}

/* --- Badge état annonce sur les cartes --- */
.card-annonce-badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    margin-bottom: 4px;
    width: auto;
}
.card-annonce-initiée   { background: #E8F0FE; color: #3B6FD4; border-color: #3B6FD4; }
.card-annonce-postée    { background: #E7F3EC; color: #2F7D52; border-color: #2F7D52; }
.card-stock {
    background: var(--surface);
    color: var(--text-muted);
    border-color: var(--border);
}
.stock-zero     { background: #FBEAEA !important; color: #C23B3B !important; border-color: #C23B3B !important; }
.stock-positive { background: #E7F3EC !important; color: #2F7D52 !important; border-color: #2F7D52 !important; }
.card-annonce-vide { background: #EAEDF0; color: #8A919E; border-color: #C8CDD5; }

/* --- Barre de recherche --- */
.search-bar-wrap {
    margin: 0 0 16px;
}
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 12px;
    transition: border-color 0.15s ease;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: var(--text-muted);
}
.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text);
    padding: 11px 0;
}
.search-input::placeholder { color: var(--text-muted); }
.search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    flex-shrink: 0;
}
.search-clear svg { width: 14px; height: 14px; }
.search-clear:hover { color: var(--accent); }
.search-empty-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px 0;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 32px 0 16px;
    flex-wrap: wrap;
}
.pagination-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.pagination-btn:not(.pagination-disabled):hover { border-color: var(--accent); color: var(--accent); }
.pagination-disabled { opacity: 0.4; cursor: default; }
.pagination-pages { display: flex; gap: 4px; }
.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.pagination-page:hover { border-color: var(--accent); color: var(--accent); }
.pagination-current {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    cursor: default;
}
.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: var(--text-muted);
    font-size: 13px;
}

/* --- Toolbar haut catalogue (recherche + per page) --- */
.pagination-footer {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
}
.per-page-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.per-page-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.per-page-select {
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--surface);
    font-size: 12px;
    font-family: var(--font-body);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s ease;
    height: auto;
    line-height: 1.4;
}
.per-page-select:focus { outline: none; border-color: var(--accent); }
.result-count-pager {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}
