:root {
    --bg: #f7f3ef;
    --card: #ffffff;
    --text: #3a3230;
    --muted: #9a8f88;
    --accent: #c8907e;
    --accent-dark: #a86f5d;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

h1 {
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.9em;
}

/* ---------- Boutons ---------- */
.btn-primary,
.btn-ghost {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ---------- Connexion ---------- */
.page-login {
    background: linear-gradient(135deg, #eaddd4, #f7f3ef 60%, #e7d3cb);
    min-height: 100vh;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--card);
    padding: 44px 36px;
    border-radius: 22px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-hearts {
    font-size: 2.6rem;
    color: var(--accent);
    margin-bottom: 6px;
}

.login-card h1 {
    margin: 0 0 6px;
    font-size: 1.6rem;
}

.login-subtitle {
    color: var(--muted);
    margin: 0 0 24px;
    font-size: 0.95rem;
}

.login-card input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 14px;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-card button {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.login-card button:hover {
    background: var(--accent-dark);
}

.login-error {
    background: #fdecea;
    color: #c0392b;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* ---------- Barre supérieure ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    background: var(--card);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}

.topbar h1 {
    font-size: 1.25rem;
    margin: 0;
    flex: 1;
    text-align: center;
    min-width: 160px;
}

/* ---------- Conteneur ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.section-intro {
    color: var(--muted);
    margin: 0 0 24px;
}

/* ---------- Grille des galeries ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
}

.gallery-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.18s, box-shadow 0.18s;
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
}

.gallery-card__img {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eee;
}

.gallery-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-card__info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gallery-card__name {
    font-weight: 600;
}

.gallery-card__count {
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---------- Barre d'outils galerie ---------- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.toolbar__count {
    color: var(--muted);
}

/* ---------- Grille de miniatures ---------- */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.thumb {
    padding: 0;
    border: none;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    transition: transform 0.15s, box-shadow 0.15s;
}

.thumb:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- État vide ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.empty-state .hint {
    font-size: 0.9rem;
    margin-top: 8px;
}

/* ---------- Visionneuse / diaporama ---------- */
.viewer {
    position: fixed;
    inset: 0;
    background: rgba(20, 16, 14, 0.96);
    display: none;
    z-index: 100;
}

.viewer.is-open {
    display: block;
}

.viewer__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 70px 120px;
}

.viewer__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.viewer__topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    color: #fff;
}

.viewer__counter {
    font-size: 0.95rem;
    opacity: 0.85;
}

.viewer__actions {
    display: flex;
    gap: 10px;
}

.viewer__btn {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.viewer__btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.viewer__nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.viewer__nav--prev {
    left: 16px;
}

.viewer__nav--next {
    right: 16px;
}

.viewer__controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 18px 20px 22px;
    color: #fff;
    flex-wrap: wrap;
}

.viewer__speed {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.viewer__speed select {
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.viewer__speed select option {
    color: #000;
}

.viewer__progress {
    flex: 1;
    max-width: 320px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.viewer__progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.1s linear;
}

@media (max-width: 640px) {
    .viewer__stage {
        padding: 60px 12px 130px;
    }

    .viewer__nav {
        width: 42px;
        height: 42px;
        font-size: 1.5rem;
    }

    .topbar h1 {
        order: 3;
        flex-basis: 100%;
    }
}