:root {
    --bg: #020617;
    --panel: linear-gradient(135deg, #111827, #020617);
    --border: #1e293b;
    --accent: #7aa2f7;

    --text: #e5e7eb;
    --muted: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;

    --radius: 16px;
    --gutter: 16px;
    --colWidth: 320px;
    --submenu-w: 360px;
    --submenu-h: 70vh;
}


* {
    box-sizing: border-box
}


body {
    margin: 0;
    background: linear-gradient(180deg, #0e1118, #0b0f17);
    color: var(--text);
    font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial
}


header#site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(10px);
    background: rgba(10, 13, 20, .6);
    border-bottom: 1px solid var(--border)
}

.nav-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
}

#brand {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    text-wrap-mode: nowrap;
}

/* Barre principale */
nav#primary-nav {
    display: flex;
    gap: 10px;
    margin-left: auto;
    position: relative;
}

/* Chaque item de menu */
.menu-item {
    position: relative;
}

.menu-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #141a2b;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.menu-btn:hover {
    background: #182035;
    border-color: #2a3147;
}

.menu-item.open>.menu-btn {
    background: #203055;
    border-color: #2e4373;
}

/* Sous-menu (desktop) */
.submenu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    width: var(--submenu-w);
    max-height: var(--submenu-h);
    overflow: auto;
    overscroll-behavior: contain;
    background: #0e1320;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .45);
    padding: 10px;
    box-sizing: border-box;
    z-index: 30;
}

.menu-item.open>.submenu {
    display: block;
}

.submenu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #0e1320;
    z-index: 1;
}

.submenu-title {
    font-weight: 700;
}

.submenu-link {
    display: block;
    padding: 8px 10px;
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid transparent;
    font-size: 14px;
}

.submenu-link:hover {
    background: #151b2d;
    border-color: #2a3147;
}

.submenu-section {
    padding: 4px 0;
}

.submenu-item {
    padding: 2px 0;
}

/* ————— MOBILE ————— */
@media (max-width: 768px) {
    .nav-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    nav#primary-nav {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .menu-item {
        flex: 0 0 auto;
    }

    .menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 120px;
    }

    /* Sous-menu en dessous du bouton, pleine largeur */
    .submenu {
        position: static;
        width: 100%;
        max-height: 350px;
        margin-top: 6px;
    }
}

#controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    gap: 10px;
}

@media (max-width: 768px) {
    #controls {
        justify-content: center;
    }
}

.btn {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #141a2b;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer
}

.btn:hover {
    background: #182035;
    border-color: #2a3147
}

#status {
    display: flex;
    justify-content: center;
    text-align: center;
    width: 100%;
    color: var(--muted);
    font-size: 13px
}

main#content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 80px
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--muted);
    margin: 10px 0 18px
}

.breadcrumbs a {
    color: var(--muted);
    text-decoration: none
}

.breadcrumbs .sep {
    opacity: .5
}

section#folders-section {
    margin: 8px 0 24px
}

.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--gutter)
}

.folder-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    text-decoration: none;
    color: var(--text)
}

.folder-card:hover {
    transform: translateY(-1px);
    border-color: #2a3147;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25)
}

.folder-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #1b2031;
    color: var(--accent);
    font-weight: 700;
    font-size: 15px
}

.folder-name {
    font-weight: 600
}

.masonry {
    column-width: var(--colWidth);
    column-gap: var(--gutter)
}

@media (max-width:1200px) {
    .masonry {
        column-width: 280px
    }
}

@media (max-width:900px) {
    .masonry {
        column-width: 240px
    }
}

@media (max-width:600px) {
    .masonry {
        column-width: 200px
    }
}

.masonry-item {
    display: block;
    break-inside: avoid;
    margin: 0 0 var(--gutter);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #0f1422;
    cursor: pointer;
    position: relative
}

.masonry-item:hover {
    transform: translateY(-2px);
    border-color: #2a3147;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28)
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block
}

/* Vidéo + placeholder + bouton Play centré */
.video-thumb {
    position: relative;
    width: 100%;
    background: #111824
}

.video-poster {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    background: #0e1422
}

.video-poster.placeholder {
    display: grid;
    place-items: center;
    aspect-ratio: 16/9;
    background: #111824
}

.video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    border: 2px solid rgba(255, 255, 255, .7);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center
}

.video-play::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-left: 14px solid #fff;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent
}

/* Titre (uniquement sur vidéos) */
.media-title {
    font-size: 13px;
    color: #dbe2f1;
    padding: 8px 10px;
    border-top: 1px solid var(--border, #23283a);
    background: #0f1422;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    text-decoration: none !important;
}

#image-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 100;
    align-items: center;
    justify-content: center;
    background: rgba(5, 8, 14, .82);
    padding: 24px
}

#image-modal.open {
    display: flex
}

.modal-panel {
    width: min(96vw, 1200px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: #0e1320;
    border: 1px solid var(--border);
    border-radius: 18px;
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, .55);
    overflow: hidden
}

.modal-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
    background: #0e1320
}

.modal-title {
    font-weight: 600;
    font-size: 15px
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-left: auto
}

.modal-body {
    padding: 12px;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center
}

.modal-body img,
.modal-body video {
    max-width: 100%;
    max-height: 84vh;
    height: auto;
    width: auto;
    display: block;
    border-radius: 12px;
    object-fit: contain
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 28px;
    line-height: 1
}

/* Pagination */
.pager {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap
}

.pager .pbtn {
    border: 1px solid var(--border);
    background: #141a2b;
    color: var(--text);
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    min-width: 36px;
    text-align: center
}

.pager .pbtn:hover {
    background: #182035;
    border-color: #2a3147
}

.pager .active {
    background: #203055;
    border-color: #2e4373;
    font-weight: 700
}

.pager .disabled {
    opacity: .45;
    pointer-events: none
}

.pager .ellipsis {
    color: var(--muted);
    padding: 0 4px
}

/* Bloc d'information en bas de la page principale */
#info-notice {
    margin: 24px 0 0;
}

.info-notice-inner {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, #111827, #020617);
    padding: 14px 16px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
    font-size: 13px;
    color: var(--muted);
}

.info-notice-inner h2 {
    margin: 0 0 6px;
    font-size: 15px;
    color: var(--text);
}

.info-notice-inner ul {
    margin: 0;
    padding-left: 18px;
}

.info-notice-inner li {
    margin: 3px 0;
}

/* ------------------------------------------------ */
/* -------------------- Random -------------------- */
/* ------------------------------------------------ */

.bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #141a2b;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer
}

.btn:hover {
    background: #182035;
    border-color: #2a3147
}

select {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #141a2b;
    color: var(--text);
    font-size: 14px
}

#path {
    color: var(--muted);
    font-size: 14px;
    flex: 1 1 auto;
    min-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

#counter {
    color: var(--muted);
    font-size: 13px
}

#random {
    height: 80vh;
    display: grid;
    place-items: center;
    padding: 16px
}

@media (max-width: 765px) {
    #random {
        padding: 0 16px;
        margin-bottom: 16px;
    }
}

#viewer {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #0b0f17;
    overflow: hidden;
}

#media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
    cursor: pointer
}

#hint {
    color: var(--muted);
    font-size: 14px;
    text-align: center;
    padding: 18px
}

#error {
    color: #ffb4b4;
    font-size: 14px;
    text-align: center;
    padding: 18px;
    display: none
}

/* ------------------------------------------------ */
/* -------------------- Devices ------------------- */
/* ------------------------------------------------ */


.wrap {
    max-width: 900px;
    margin: 32px auto;
    padding: 0 16px;
}

.panel {
    background: rgba(15, 23, 42, .96);
    border-radius: 18px;
    padding: 22px 22px 20px;
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .65);
}


.panel {
    background: rgba(15, 23, 42, .96);
    border-radius: 18px;
    padding: 22px 22px 20px;
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .65);
}

p.lead {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--muted);
}

.panel input,
.panel button,
.panel a {
    font: inherit
}

.panel input[type=email] {
    padding: .45rem .6rem;
    min-width: 260px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #020617;
    color: var(--text);
}

.panel input[type=email]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(122, 162, 247, .6);
}

.panel .btn {
    display: inline-block;
    padding: .45rem .9rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    text-decoration: none;
    color: #0f172a;
    background: #e2e8f0;
    font-weight: 500;
}

.panel .btn:hover {
    background: #f1f5f9
}

.panel .btn.dark {
    background: #111827;
    color: var(--text);
    border-color: #475569;
}

.panel .btn.dark:hover {
    background: #1f2937;
    border-color: #64748b;
}

.danger {
    border-color: #ef4444;
    color: #991b1b;
    background: #fee2e2;
}

.danger:hover {
    background: #fecaca;
}

.panel table {
    border-collapse: collapse;
    margin-top: 14px;
    width: 100%
}

.panel th,
.panel td {
    border: 1px solid #1e293b;
    padding: .55rem .6rem;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.panel th {
    background: #020617;
    color: var(--muted);
}

.panel code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    word-break: break-all;
    font-size: 12px;
}

.topbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.spacer {
    flex: 1
}

.notice {
    margin: 0 0 14px;
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 13px;
}

.notice-success {
    border: 1px solid rgba(34, 197, 94, .85);
    background: rgba(22, 163, 74, .18);
    color: #bbf7d0;
}

.notice-error {
    border: 1px solid rgba(248, 113, 113, .9);
    background: rgba(220, 38, 38, .15);
    color: #fecaca;
}

.footer {
    margin-top: 18px;
    font-size: 13px;
}

/* ------------------------------------------------ */
/* ------------------- Ping mail ------------------ */
/* ------------------------------------------------ */

.card {
    background: #11182a;
    border: 1px solid #22324f;
    border-radius: 12px;
    padding: 16px
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

.card label {
    font-size: 14px;
    color: #c7d0e1
}

.card input,
.card select {
    background: #0f1730;
    color: #e6edf7;
    border: 1px solid #22324f;
    border-radius: 8px;
    padding: 8px
}

.card .btn {
    appearance: none;
    border: 1px solid #22324f;
    background: #1a2338;
    color: #e6edf7;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer
}

.muted {
    color: #a9b6cc
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

.card pre {
    background: #0b1220;
    border: 1px dashed #22324f;
    padding: 10px;
    border-radius: 8px;
    max-height: 360px;
    overflow: auto;
    color: #bfcef1
}

.ok {
    color: #34d399
}

.fail {
    color: #f87171
}

.pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #22324f;
    background: #0f1730;
    margin-right: 6px
}

/* ------------------------------------------------ */
/* ------------------ Create User ----------------- */
/* ------------------------------------------------ */

.actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.panel .notice {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.panel .notice-success {
    border: 1px solid rgba(34, 197, 94, .8);
    background: rgba(22, 163, 74, .15);
    color: #bbf7d0;
}

.panel .notice-error {
    border: 1px solid rgba(248, 113, 113, .9);
    background: rgba(220, 38, 38, .12);
    color: #fecaca;
}

.footer-links {
    margin-top: 18px;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--accent);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}