/* Privacy.jecode.click — design solo, mobile-first, dark, opaque (pas de blur) */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #000;
    color: #f5f5f7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
input, button, select, textarea { font: inherit; color: inherit; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

a { color: inherit; }

button { cursor: pointer; border: none; background: none; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 20px;
    background: #1c1c1e; color: #f5f5f7;
    border-radius: 14px; font-weight: 500;
    border: 1px solid #2c2c2e;
    transition: background .15s, transform .05s;
    width: 100%;
}
.btn:hover { background: #2c2c2e; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: #0a84ff; border-color: #0a84ff; color: #fff; }
.btn.primary:hover { background: #0969d6; }
.btn.danger { background: #2c1818; color: #ff6b6b; border-color: #4a1f1f; }
.btn.ghost { background: transparent; border-color: #2c2c2e; }

input[type="password"], input[type="text"], input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    background: #1c1c1e; border: 1px solid #2c2c2e;
    border-radius: 12px;
    color: #fff;
    outline: none;
}
input:focus { border-color: #0a84ff; }

label { font-size: 13px; color: #8e8e93; margin-bottom: 6px; display: block; }

.stack { display: flex; flex-direction: column; gap: 12px; }

/* === AUTH === */
.screen-auth {
    display: flex; align-items: center; justify-content: center;
    min-height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.auth-card {
    width: 100%; max-width: 400px;
    background: #111;
    border: 1px solid #1c1c1e;
    border-radius: 22px;
    padding: 32px 24px;
    display: flex; flex-direction: column; gap: 18px;
}
@media (min-width: 480px) {
    .auth-card { padding: 36px 28px; gap: 20px; border-radius: 24px; }
}
.brand { text-align: center; margin-bottom: 8px; }
.brand .logo {
    font-size: 56px; line-height: 1; color: #0a84ff; margin-bottom: 8px;
}
.brand h1 { font-size: 22px; font-weight: 600; letter-spacing: -.3px; }

.sep { display: flex; align-items: center; gap: 12px; color: #8e8e93; font-size: 12px; }
.sep::before, .sep::after { content: ''; flex: 1; height: 1px; background: #2c2c2e; }

.recovery-toggle { text-align: center; margin: -4px 0 -4px; }
.recovery-toggle a {
    color: #8e8e93; font-size: 13px; text-decoration: none;
    border-bottom: 1px dotted #3a3a3c;
    padding-bottom: 1px;
}
.recovery-toggle a:hover { color: #c7c7cc; border-color: #6a6a6e; }

.status { padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.status.err { background: #2a1414; color: #ff6b6b; }
.status.ok  { background: #14241a; color: #34d399; }
.warn { padding: 14px; background: #2a2010; color: #ffb84d; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.warn code { background: #000; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* === PIN === */
.pin-display {
    display: flex; gap: 14px; justify-content: center; margin: 20px 0;
}
.pin-dot {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #3a3a3c; background: transparent;
    transition: background .15s, border-color .15s, transform .1s;
}
.pin-dot.filled { background: #0a84ff; border-color: #0a84ff; }
.pin-dot.shake { animation: shake .4s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.pin-pad {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    width: 100%; max-width: 280px; margin: 0 auto;
}
@media (min-width: 380px) {
    .pin-pad { gap: 14px; }
}
.pin-key {
    aspect-ratio: 1;
    background: #1c1c1e;
    border-radius: 50%;
    font-size: clamp(20px, 6vw, 26px); font-weight: 400;
    color: #fff;
    transition: background .1s, transform .05s;
    -webkit-tap-highlight-color: transparent;
}
.pin-key:hover { background: #2c2c2e; }
.pin-key:active { background: #3a3a3c; transform: scale(.95); }
.pin-key.fn { background: transparent; font-size: 14px; color: #8e8e93; }
.pin-key.fn:hover { background: #1c1c1e; }

/* === APP / GALERIE === */
.app-bar {
    position: sticky; top: 0; z-index: 10;
    background: #000;
    padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid #1c1c1e;
}
.app-bar h1 {
    font-size: 17px; font-weight: 600; flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}
.app-bar .folder-tag {
    font-size: 10px; padding: 4px 8px;
    background: #1c1c1e; border-radius: 8px; color: #8e8e93;
    text-transform: uppercase; letter-spacing: .5px;
    white-space: nowrap;
}
.app-bar .icon-btn {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #1c1c1e; color: #fff;
}
.app-bar .icon-btn:hover { background: #2c2c2e; }

@media (max-width: 380px) {
    .app-bar { gap: 6px; padding: 10px 10px; }
    .app-bar h1 { font-size: 15px; }
    .app-bar .folder-tag { font-size: 9px; padding: 3px 6px; }
    .app-bar .icon-btn { width: 34px; height: 34px; flex: 0 0 34px; }
    .app-bar .icon-btn svg { width: 18px; height: 18px; }
}

main.app-main {
    padding: 8px;
    padding-bottom: max(90px, env(safe-area-inset-bottom));
    max-width: 1400px;
    margin: 0 auto;
}
@media (min-width: 1024px) {
    main.app-main { padding: 16px; padding-bottom: 100px; }
}
.empty {
    text-align: center; padding: 60px 20px; color: #8e8e93;
}
.empty .icon { font-size: 48px; opacity: .4; margin-bottom: 12px; }

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}
@media (min-width: 480px) {
    .grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
}
@media (min-width: 768px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
}
@media (min-width: 1280px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
}
.tile {
    position: relative;
    aspect-ratio: 1;
    background: #111;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}
.tile img, .tile video {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
}
.tile.excluded::after {
    content: ''; position: absolute; inset: 0;
    background: rgba(0,0,0,.55);
    border: 2px solid #ff453a;
    border-radius: 6px;
}
.tile .badge {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0,0,0,.65);
    color: #fff; font-size: 10px;
    padding: 2px 6px; border-radius: 6px;
}
.tile.selected {
    outline: 3px solid #0a84ff; outline-offset: -3px;
}

/* Tile fichier (coffre) */
.file-tile {
    width: 100%; height: 100%;
    background: linear-gradient(160deg, #1c1c1e, #111);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 10px 8px;
    text-align: center;
}
.file-tile .file-icon {
    position: relative;
    color: #0a84ff;
    margin-bottom: 8px;
}
.file-tile .file-ext {
    position: absolute;
    bottom: -4px; right: -10px;
    background: #0a84ff; color: #fff;
    font-size: 9px; font-weight: 700;
    padding: 2px 5px; border-radius: 4px;
    letter-spacing: .3px;
}
.file-tile .file-name {
    font-size: 11px; color: #c7c7cc;
    line-height: 1.25;
    word-break: break-word;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tile .check {
    position: absolute; top: 6px; left: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    background: #0a84ff; color: #fff;
    display: none; align-items: center; justify-content: center;
    font-size: 14px;
}
.tile.selected .check { display: flex; }

/* FAB upload */
.fab {
    position: fixed; right: 16px;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
    width: 56px; height: 56px; border-radius: 50%;
    background: #0a84ff; color: #fff;
    box-shadow: 0 8px 22px rgba(10,132,255,.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
}
@media (min-width: 768px) {
    .fab { width: 60px; height: 60px; right: 22px; bottom: max(22px, env(safe-area-inset-bottom)); }
}
.fab:hover { background: #0969d6; }
.fab svg { width: 28px; height: 28px; }

/* Diaporama plein écran */
.slideshow {
    position: fixed; inset: 0; z-index: 100;
    background: #000; display: none;
    align-items: center; justify-content: center;
}
.slideshow.active { display: flex; }
.slide-media { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; }
.slide-controls {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top));
    display: flex; gap: 10px; justify-content: space-between;
    background: linear-gradient(to bottom, rgba(0,0,0,.65), transparent);
    pointer-events: none;
}
.slide-controls button { pointer-events: auto; }
.slide-controls .left, .slide-controls .right {
    display: flex; gap: 8px;
}
.slide-bottom {
    position: absolute; left: 0; right: 0;
    bottom: 0; padding: 14px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    display: flex; gap: 10px; justify-content: center;
    background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
}
.slide-btn {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(28,28,30,.85); color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.slide-btn:hover { background: rgba(60,60,67,.95); }
.slide-btn.danger { color: #ff453a; }

/* Upload progress */
.uploads {
    position: fixed; right: 16px;
    bottom: max(90px, calc(env(safe-area-inset-bottom) + 90px));
    width: min(320px, calc(100vw - 32px));
    background: #1c1c1e; border-radius: 14px;
    padding: 12px;
    display: none; z-index: 6;
    max-height: 50vh; overflow-y: auto;
}
.uploads.active { display: block; }
.up-item { font-size: 13px; margin-bottom: 8px; }
.up-name { color: #fff; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-bar { height: 4px; background: #3a3a3c; border-radius: 2px; overflow: hidden; }
.up-bar > div { height: 100%; background: #0a84ff; width: 0; transition: width .2s; }
.up-item.done .up-bar > div { background: #34d399; }
.up-item.err .up-bar > div { background: #ff453a; }

/* Modale post-upload */
.post-upload-dialog {
    background: #1c1c1e; color: #fff;
    border: 1px solid #2c2c2e;
    border-radius: 22px;
    padding: 26px 22px 22px;
    width: min(360px, calc(100vw - 32px));
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,.6);
}
.post-upload-dialog::backdrop {
    background: rgba(0,0,0,.65);
}
.pud-icon {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #14241a; color: #34d399;
    font-size: 28px; line-height: 56px;
}
.pud-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.pud-msg { font-size: 14px; color: #c7c7cc; line-height: 1.5; margin-bottom: 22px; }
.pud-msg b { color: #fff; }
.pud-actions { display: flex; flex-direction: column; gap: 10px; }

/* Action bar (sélection multiple) */
.actionbar {
    position: sticky;
    top: calc(58px + env(safe-area-inset-top));
    z-index: 9;
    background: #000;
    padding: 10px 12px;
    display: none; gap: 8px;
    border-bottom: 1px solid #1c1c1e;
    flex-wrap: wrap;
}
.actionbar.active { display: flex; }
.actionbar .count { flex: 1; align-self: center; font-size: 13px; min-width: 60px; }
.actionbar .btn { font-size: 13px; }
