:root {
    --noir: #111214;
    --noir-doux: #1a1b1e;
    --carte: #202226;
    --texte: #f2f1ee;
    --texte-doux: #a6a8ad;
    --accent: #d8b46a;
    --accent-doux: #3a3220;
    --erreur: #e46a6a;
    --succes: #6ac292;
    --rayon: 10px;
    --ombre: 0 10px 30px rgba(0, 0, 0, 0.35);
    --font: 'Helvetica Neue', Arial, sans-serif;
}

/* =========================
   RESET
   ========================= */

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    background: var(--noir);
    color: var(--texte);
    font-family: var(--font);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

img {
    max-width: 100%;
}

button,
input {
    font: inherit;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: var(--accent);
    margin: 0;
}

/* =========================
   BOUTONS
   ========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.55rem 1.1rem;
    border-radius: var(--rayon);
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--noir);
    font-weight: 600;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-outline {
    background: transparent;
    border-color: var(--texte-doux);
    color: var(--texte);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--texte-doux);
}

.btn-ghost:hover {
    color: var(--texte);
}

.btn-danger {
    background: transparent;
    border-color: var(--erreur);
    color: var(--erreur);
}

.btn-small {
    min-height: 36px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

/* =========================
   PAGE LOGIN
   ========================= */

.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem;
}

.login-box {
    background: var(--noir-doux);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 2.5rem;
    max-width: 380px;
    width: 100%;
}

.login-box h1 {
    font-size: 1.4rem;
    margin: 0.4rem 0 1.5rem;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-box label {
    font-size: 0.8rem;
    color: var(--texte-doux);
    margin-top: 0.6rem;
}

.login-box input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    background: var(--carte);
    border: 1px solid #34363b;
    border-radius: var(--rayon);
    padding: 0.65rem 0.8rem;
    color: var(--texte);
    font-size: 16px;
    appearance: none;
    -webkit-appearance: none;
}

.login-box input::placeholder {
    color: #777a80;
    opacity: 1;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(216, 180, 106, 0.1);
}

.login-box button {
    width: 100%;
    min-height: 48px;
    margin-top: 1.5rem;
    padding: 0.9rem 1.2rem;

    background: linear-gradient(
        135deg,
        #e5c477 0%,
        #d8b46a 50%,
        #c49b4f 100%
    );

    border: none;
    border-radius: 14px;

    color: #111214;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;

    cursor: pointer;

    box-shadow:
        0 8px 20px rgba(216, 180, 106, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;

    -webkit-tap-highlight-color: transparent;
}

.login-box button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 12px 28px rgba(216, 180, 106, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);

    filter: brightness(1.06);
}

.login-box button:active {
    transform: translateY(0);

    box-shadow:
        0 5px 12px rgba(216, 180, 106, 0.18);
}

.login-box button:focus-visible {
    outline: 2px solid #e5c477;
    outline-offset: 4px;
}

.login-box .aide {
    margin-top: 1.4rem;
    font-size: 0.8rem;
    color: var(--texte-doux);
}

.erreur {
    color: var(--erreur);
    font-size: 0.9rem;
}

/* =========================
   BARRE DU HAUT
   ========================= */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #26282c;
    width: 100%;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.9rem;
    min-width: 0;
}

.nom-client {
    color: var(--texte-doux);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   GALERIE CLIENT
   ========================= */

.galerie-container {
    width: 100%;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.galerie-vide {
    color: var(--texte-doux);
    text-align: center;
    margin-top: 4rem;
}

.grille-photos {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
}

.vignette {
    position: relative;
    width: 100%;
    min-width: 0;
    margin: 0;
    border-radius: var(--rayon);
    overflow: hidden;
    background: var(--carte);
    aspect-ratio: 1 / 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.vignette img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.vignette:hover img {
    transform: scale(1.04);
}

.btn-dl {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;

    background: rgba(17, 18, 20, 0.8);
    color: var(--texte);

    width: 34px;
    height: 34px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 1rem;
    text-decoration: none;

    z-index: 2;

    -webkit-tap-highlight-color: transparent;
}

.btn-dl:hover {
    background: var(--accent);
    color: var(--noir);
    text-decoration: none;
}

/* =========================
   LIGHTBOX
   ========================= */

.lightbox {
    position: fixed;
    inset: 0;

    width: 100vw;
    height: 100vh;
    height: 100dvh;

    background: rgba(10, 10, 11, 0.96);

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 100;

    padding: 1rem;

    overscroll-behavior: contain;
}

.lightbox[hidden] {
    display: none !important;
}

.lightbox.lightbox-ferme {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.lightbox:not([hidden]):not(.lightbox-ferme) {
    display: flex;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 85vh;
    max-height: 85dvh;
    object-fit: contain;
    border-radius: 6px;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-btn {
    position: absolute;

    background: rgba(255, 255, 255, 0.08);
    border: none;

    color: var(--texte);

    font-size: 1.6rem;
    cursor: pointer;

    border-radius: 50%;

    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 5;

    -webkit-tap-highlight-color: transparent;
}

.lightbox-btn:hover {
    background: var(--accent);
    color: var(--noir);
}

.lightbox-close {
    top: 1.2rem;
    right: 1.2rem;
}

.lightbox-prev {
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-dl {
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);

    width: auto;
    min-width: 140px;

    padding: 0 1.2rem;

    border-radius: 24px;
    font-size: 0.9rem;
}

/* =========================
   ADMIN
   ========================= */

.admin-container {
    width: 100%;
    padding: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;

    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.carte {
    background: var(--noir-doux);
    border-radius: var(--rayon);
    padding: 1.5rem;
    box-shadow: var(--ombre);
}

.carte h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.carte-succes {
    border: 1px solid var(--succes);
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: end;
}

.form-inline label {
    display: block;
    font-size: 0.78rem;
    color: var(--texte-doux);
    margin-bottom: 0.25rem;
}

.form-inline input[type="text"],
.form-inline input[type="email"],
.form-inline input[type="date"] {
    max-width: 100%;
    background: var(--carte);
    border: 1px solid #34363b;
    border-radius: var(--rayon);
    padding: 0.55rem 0.7rem;
    color: var(--texte);
}

.label-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--texte);
}

.table-casiers {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.8rem;
}

.table-casiers th,
.table-casiers td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #2a2c30;
    font-size: 0.9rem;
}

.table-casiers th {
    color: var(--texte-doux);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge {
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.badge-ok {
    background: var(--accent-doux);
    color: var(--succes);
}

.badge-off {
    background: #322020;
    color: var(--erreur);
}

.grille-admin {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.8rem;
}

.vignette-admin {
    margin: 0;
    background: var(--carte);
    border-radius: var(--rayon);
    overflow: hidden;
}

.vignette-admin img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.vignette-admin figcaption {
    font-size: 0.72rem;
    color: var(--texte-doux);
    padding: 0.4rem 0.5rem 0;
    word-break: break-all;
}

.vignette-admin form {
    padding: 0.5rem;
}

/* =========================
   TABLETTE
   ========================= */

@media (max-width: 900px) {

    .topbar {
        padding: 1rem;
    }

    .galerie-container {
        padding: 1rem;
    }

    .grille-photos {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .grille-admin {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 600px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .topbar {
        width: 100%;
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        gap: 0.8rem;
    }

    .topbar .eyebrow {
        text-align: center;
    }

    .topbar-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        gap: 0.5rem;
    }

    .nom-client {
        width: 100%;
        text-align: center;
        font-size: 0.85rem;
    }

    .topbar-actions .btn {
        width: 100%;
        min-height: 44px;
        text-align: center;
    }

    .galerie-container {
        width: 100%;
        padding: 0.6rem;
    }

    .grille-photos {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .vignette {
        width: 100%;
        min-width: 0;
        border-radius: 8px;
    }

    .vignette img {
        width: 100%;
        height: 100%;
    }

    .btn-dl {
        width: 34px;
        height: 34px;
        bottom: 0.35rem;
        right: 0.35rem;
        font-size: 0.95rem;
    }

    .galerie-vide {
        padding: 0 1rem;
        margin-top: 3rem;
        font-size: 0.9rem;
    }

    .page-login {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 1rem;
    }

    .login-box {
        width: 100%;
        max-width: 420px;
        padding: 1.5rem;
        border-radius: 12px;
    }

    .login-box h1 {
        font-size: 1.3rem;
        line-height: 1.3;
        margin-bottom: 1.3rem;
    }

    .login-box input {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    .login-box button {
        width: 100%;
        min-height: 50px;
        margin-top: 1.3rem;
        font-size: 1rem;
    }

    .login-box .aide {
        line-height: 1.5;
    }

    .lightbox {
        padding: 0.5rem;
    }

    .lightbox img {
        max-width: 94vw;
        max-height: 78vh;
        max-height: 78dvh;
        border-radius: 4px;
    }

    .lightbox-btn {
        width: 42px;
        height: 42px;
        font-size: 1.35rem;
    }

    .lightbox-close {
        top: 0.7rem;
        right: 0.7rem;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    .lightbox-dl {
        bottom: 0.8rem;
        min-width: 140px;
        min-height: 44px;
        padding: 0 1rem;
        font-size: 0.85rem;
    }

    .admin-container {
        width: 100%;
        padding: 0.8rem;
    }

    .carte {
        padding: 1rem;
    }

    .form-inline {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline > * {
        width: 100%;
        max-width: 100%;
    }

    .table-casiers {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .grille-admin {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }
}

/* =========================
   PETITS TELEPHONES
   ========================= */

@media (max-width: 380px) {

    .topbar {
        padding: 0.8rem;
    }

    .galerie-container {
        padding: 0.4rem;
    }

    .grille-photos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.3rem;
    }

    .vignette {
        border-radius: 6px;
    }

    .btn-dl {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .login-box {
        padding: 1.2rem;
    }

    .login-box h1 {
        font-size: 1.2rem;
    }

    .lightbox-btn {
        width: 38px;
        height: 38px;
    }

    .lightbox-prev {
        left: 0.25rem;
    }

    .lightbox-next {
        right: 0.25rem;
    }
}

/* =========================
   PETITE HAUTEUR
   ========================= */

@media (max-height: 600px) and (max-width: 600px) {

    .page-login {
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .login-box {
        margin-top: 0;
    }

    .lightbox img {
        max-height: 70vh;
        max-height: 70dvh;
    }
}

/* =========================
   ECRANS TACTILES
   ========================= */

@media (hover: none) and (pointer: coarse) {

    .vignette:hover img {
        transform: none;
    }

    .btn:hover {
        filter: none;
    }

    .login-box button:hover {
        transform: none;
    }

    .lightbox-btn:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--texte);
    }
}