/* PhotoShare — thème sombre « table lumineuse » : ardoise, cadres de diapositive, accent ambre. */
:root {
    --bg: #1E2329;
    --surface: #2A3038;
    --surface-2: #343B45;
    --line: #3E4652;
    --text: #E8EAED;
    --muted: #9AA3AE;
    --accent: #E3A83B;
    --accent-ink: #1E2329;
    --danger: #E5675B;
    --radius: 10px;
    --font: "Bahnschrift", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    --mono: "Cascadia Mono", Consolas, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
a { color: inherit; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Barre du haut */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 10px 20px; background: rgba(30, 35, 41, .94); backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; letter-spacing: .02em; }
.brand svg { color: var(--accent); width: 26px; height: 26px; }
.pathbar { display: flex; align-items: center; gap: 12px; flex: 1 1 400px; min-width: 0; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; min-width: 0; }
.breadcrumb li { white-space: nowrap; }
.breadcrumb li + li::before { content: "›"; color: var(--muted); margin-right: 4px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 600; }
.relpath { font: 12px var(--mono); color: var(--muted); background: var(--surface); padding: 3px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; }
.filters { display: flex; gap: 6px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: 13px; }
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-name { color: var(--muted); }
.user form { margin: 0; }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font: inherit; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .tile:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; width: 100%; justify-content: center; padding: 10px; }
.btn-primary:hover { background: #F0B952; }
.btn-ghost { background: transparent; }
.btn-back { font-weight: 600; }

/* Contenu */
.content { padding: 24px 20px 60px; max-width: 1600px; margin: 0 auto; }
.content-bare { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.empty { color: var(--muted); text-align: center; padding: 60px 0; }

/* Grille de miniatures : cadres de diapositive */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.tile {
    display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; background: none;
    color: var(--text); text-decoration: none; cursor: pointer; font: inherit; text-align: left;
}
.tile-frame {
    position: relative; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden;
    background: #F2EEE6; padding: 10px; border-radius: 4px;
    box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 6px 18px rgba(0,0,0,.35);
    transition: transform .15s ease, box-shadow .15s ease;
}
.tile-frame img { width: 100%; height: 100%; object-fit: cover; background: #202020; border-radius: 2px; }
.tile:hover .tile-frame { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 12px 26px rgba(0,0,0,.45); }
.tile-name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile:hover .tile-name { color: var(--text); }
.tile-folder .tile-frame { background: var(--surface); border: 1px solid var(--line); box-shadow: none; }
.tile-folder svg { width: 46%; height: 46%; color: var(--accent); stroke-width: 1.2; }
.play-badge {
    position: absolute; inset: auto 16px 16px auto; width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center; background: rgba(0,0,0,.65); color: #fff;
}
.play-badge svg { fill: currentColor; stroke: none; width: 18px; height: 18px; margin-left: 2px; }

/* Accueil */
.home h1 { font-weight: 500; margin: 10px 0 24px; }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.home-tile {
    display: flex; flex-direction: column; gap: 6px; padding: 28px; min-height: 190px; justify-content: flex-end;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
    transition: border-color .15s, transform .15s;
}
.home-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.home-tile svg { width: 44px; height: 44px; color: var(--accent); margin-bottom: auto; }
.home-tile-title { font-size: 22px; font-weight: 600; }
.home-tile-sub { color: var(--muted); }

/* Connexion */
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand svg { width: 48px; height: 48px; color: var(--accent); }
.login-brand h1 { margin: 6px 0 2px; font-size: 26px; }
.login-brand p { margin: 0; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-size: 13px; color: var(--muted); margin-top: 8px; }
.login-card input {
    padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button { margin-top: 18px; }
.error ul { margin: 0; padding: 10px 12px; list-style: none; background: rgba(229,103,91,.12); border: 1px solid var(--danger); border-radius: 8px; color: #F3A59D; }
.error.validation-summary-valid { display: none; }
.field-error { color: #F3A59D; font-size: 12px; }
.notice { background: rgba(227,168,59,.12); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; }

/* Messages */
.message-panel { max-width: 520px; margin: 80px auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; }
.message-panel h1 { font-weight: 500; margin-top: 0; }
.message-panel p { color: var(--muted); }

/* Visionneuse */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(10,12,14,.96); display: grid; grid-template-rows: auto 1fr; }
.lightbox[hidden] { display: none; }
.lightbox-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.lightbox-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.lightbox-stage { display: grid; place-items: center; overflow: hidden; padding: 0 70px 20px; min-height: 0; }
.lightbox-stage img, .lightbox-stage video { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.lightbox-stage .loading { color: var(--muted); }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: rgba(42,48,56,.8); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.nav:hover { border-color: var(--accent); }
.nav-prev { left: 12px; }
.nav-next { right: 12px; }
.nav[disabled] { opacity: .3; cursor: default; }

@media (max-width: 640px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
    .relpath, .user-name { display: none; }
    .lightbox-stage { padding: 0 8px 10px; }
    .nav { top: auto; bottom: 16px; transform: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
