*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #150e12;
    --surface:  #1f151b;
    --border:   #35242d;
    --accent:   #ec4899;
    --accent-h: #f472b6;
    --green:    #22c55e;
    --red:      #ef4444;
    --text:     #f5e9f0;
    --muted:    #a68a97;
    --radius:   12px;
    --radius-sm:8px;
    --shadow:   0 4px 32px rgba(0,0,0,.4);
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
}

a { color: var(--accent); }

/* ── Layout ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
    margin: auto;
}
.card-wide { max-width: 900px; }

.logo { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; }
.logo svg { flex-shrink: 0; }
.logo-text { font-size: 1.35rem; font-weight: 700; letter-spacing: -.5px; }
.logo-text span { color: var(--accent); }

h1 { font-size: 1.1rem; font-weight: 600; margin-bottom: .35rem; }
h2 { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }
.subtitle { font-size: .875rem; color: var(--muted); margin-bottom: 2rem; }

.back-link {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .8rem; color: var(--muted); text-decoration: none; margin-bottom: 1.25rem;
}
.back-link:hover { color: var(--text); }

/* ── Form ── */
.field { margin-bottom: 1.25rem; }
label {
    display: block; font-size: .8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .5rem;
}
input[type=text], input[type=search], textarea, select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .95rem;
    padding: .75rem 1rem;
    outline: none;
    font-family: inherit;
    transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface); }

.code-input {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    letter-spacing: .12em;
    text-align: center;
    text-transform: uppercase;
}

.hint { font-size: .78rem; color: var(--muted); margin-top: .4rem; }

/* ── Button ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    background: var(--accent); color: #fff; border: none; border-radius: 8px;
    font-size: .95rem; font-weight: 700; padding: .8rem 1.4rem; cursor: pointer;
    transition: background .15s, transform .1s; text-decoration: none; width: 100%;
}
.btn:hover { background: var(--accent-h); }
.btn:active { transform: scale(.98); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--red); }
.btn-sm { font-size: .85rem; padding: .55rem 1rem; width: auto; }
.btn-auto { width: auto; }

/* ── Alert ── */
.alert {
    border-radius: 8px; padding: .85rem 1rem; font-size: .875rem; margin-bottom: 1.5rem;
    display: flex; align-items: flex-start; gap: .6rem;
}
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-info    { background: rgba(236,72,153,.1);  border: 1px solid rgba(236,72,153,.3); color: #f9a8d4; }

.key-warning {
    background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); border-radius: var(--radius);
    padding: 1.1rem 1.25rem; margin-bottom: 1.5rem; font-size: .85rem; color: #fcd34d;
    display: flex; gap: .75rem; align-items: flex-start; line-height: 1.6;
}
.key-warning svg { flex-shrink: 0; margin-top: 2px; }

.secret-wrap {
    background: var(--bg); border: 1px solid var(--green); border-radius: 8px;
    padding: 1.2rem 1.25rem; margin: 1.25rem 0;
}
.secret-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--green); margin-bottom: .5rem; }
.secret-value { font-family: 'Courier New', monospace; font-size: 1.3rem; letter-spacing: .1em; text-align: center; user-select: all; color: var(--text); }

.copied-feedback { font-size: .78rem; color: var(--green); display: none; align-items: center; gap: .3rem; margin-top: .5rem; justify-content: center; }
.copied-feedback.show { display: flex; }

/* ── Dashboard header ── */
.dash-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.dash-header .logo { margin-bottom: 0; }
.dash-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Search ── */
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap svg { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap input[type=search] { padding-left: 2.6rem; }

/* ── Grille de vêtements ── */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.item-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, transform .15s;
    display: block;
}
.item-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.item-photo {
    width: 100%; aspect-ratio: 1; background: var(--surface);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.item-photo img { width: 100%; height: 100%; object-fit: cover; }
.item-photo svg { color: var(--muted); }
.item-body { padding: .7rem .8rem; }
.item-name { font-weight: 600; font-size: .88rem; margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-loc { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-cat {
    display: inline-block; margin-top: .4rem; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .03em; padding: .2rem .5rem; border-radius: 999px;
    background: rgba(236,72,153,.15); color: var(--accent);
}

.empty-state {
    text-align: center; padding: 2.5rem 1rem; color: var(--muted); font-size: .9rem;
    border: 1px dashed var(--border); border-radius: var(--radius); grid-column: 1 / -1;
}

/* ── Photo capture ── */
.photo-input-wrap { text-align: center; }
.photo-preview {
    width: 100%; max-width: 280px; aspect-ratio: 1; margin: 0 auto 1rem;
    border-radius: var(--radius); border: 2px dashed var(--border);
    background: var(--bg); display: flex; align-items: center; justify-content: center;
    overflow: hidden; color: var(--muted); cursor: pointer;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview.has-image { border-style: solid; }

/* ── Item detail ── */
.detail-photo {
    width: 100%; border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem;
    background: var(--bg); aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-photo svg { color: var(--muted); }

.detail-row { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .9rem; font-size: .9rem; }
.detail-row svg { flex-shrink: 0; color: var(--accent); margin-top: .15rem; }
.detail-row .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: .15rem; }

/* ── Codes list (partage) ── */
.code-list { display: flex; flex-direction: column; gap: .6rem; margin: 1.25rem 0; }
.code-row {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem;
    flex-wrap: wrap;
}
.code-row-label { font-weight: 600; font-size: .88rem; }
.code-row-meta { font-size: .76rem; color: var(--muted); font-family: 'Courier New', monospace; }
.code-row form { margin: 0; }
.code-row button {
    font-size: .78rem; padding: .4rem .75rem; border-radius: 6px; border: 1px solid var(--border);
    background: transparent; color: var(--muted); cursor: pointer; font-family: inherit;
}
.code-row button:hover { color: var(--red); border-color: var(--red); }

.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

footer { margin-top: 2rem; font-size: .78rem; color: var(--muted); text-align: center; max-width: 900px; }

/* ── Petits écrans (mobile) ── */
@media (max-width: 480px) {
    body { padding: 1rem; }
    .card { padding: 1.5rem; }
}
@media (max-width: 380px) {
    .code-input { font-size: 1.05rem; letter-spacing: .06em; }
    .secret-value { font-size: 1.05rem; letter-spacing: .06em; }
}
