/* Reset léger */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #111827;
}

/* Fond type WeTransfer */
.wtf-bg {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #f9a8d4 0, transparent 55%),
                radial-gradient(circle at bottom right, #93c5fd 0, transparent 55%),
                linear-gradient(135deg, #e0f2fe, #f5f3ff);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* Cartes principales */

.center-card,
.gallery-page {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px 18px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.15);
}

.center-card.large {
    max-width: 900px;
}

.gallery-page {
    max-width: 1100px;
}

/* Titres */

.logo-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.logo-title.small {
    font-size: 1.1rem;
}

.subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 14px;
}

/* Messages */

.error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.info {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.success-box {
    background: #ecfdf3;
    border-radius: 14px;
    padding: 12px 12px 14px;
    margin-bottom: 16px;
}

.success-box h2 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.success-text {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.success-link a {
    word-break: break-all;
    font-size: 0.9rem;
}

/* Formulaires */

.form-grid {
    margin-top: 10px;
}

.form-row {
    margin-bottom: 12px;
}

label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #374151;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

textarea {
    resize: vertical;
    min-height: 70px;
}

small {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Boutons */

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn-primary {
    background: #2563eb;
    color: #f9fafb;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
    background: #f3f4f6;
    color: #111827;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.btn-primary.small,
.btn-secondary.small {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.btn-secondary.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-secondary.danger:hover {
    background: #fecaca;
}

button.btn-primary {
    width: auto;
}

button {
    font-family: inherit;
}

.full {
    width: 100%;
}

/* Textarea email */

#emailTemplate {
    width: 100%;
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.82rem;
}

/* --- PAGE GALERIE --- */

.gallery-header {
    margin-bottom: 16px;
}

.gallery-header-main {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-top: 6px;
}

.gallery-header h2 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.meta {
    font-size: 0.8rem;
    color: #6b7280;
}

.meta.count {
    margin-top: 6px;
}

.note {
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Grille de fichiers */

.grid-photos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.photo-card {
    background: #f9fafb;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.photo-thumb {
    display: block;
    width: 100%;
    background: #111827;
}

.photo-thumb img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

/* Vidéos */

.video-thumb {
    background: #020617;
}

/* Vignette vidéo simplifiée */
.video-fake-thumb {
    width: 100%;
    height: 180px;
    background: #0f172a;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #e5e7eb;
    font-size: 1.4rem;
}

.video-icon {
    font-size: 2.4rem;
    margin-bottom: 4px;
}

.video-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Autres fichiers */

.other-thumb {
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.other-file-label {
    color: #e5e7eb;
    font-size: 0.8rem;
    text-align: center;
    word-break: break-all;
}

.photo-actions {
    padding: 8px;
    display: flex;
    justify-content: center;
}

/* Footer */

.gallery-footer {
    margin-top: 16px;
    font-size: 0.82rem;
    color: #6b7280;
}

/* --- ADMIN : LISTE GALERIES + FORMULAIRE --- */

.admin-shell {
    display: flex;
    flex-direction: column;
}

.admin-header {
    margin-bottom: 10px;
}

.admin-layout {
    margin-top: 8px;
}

.admin-tabs {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 4px;
}

.admin-tab {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #4b5563;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.admin-tab:hover {
    background-color: #eef2ff;
}

.admin-tab.active {
    background-color: #4f46e5;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(79,70,229,0.25);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}


.admin-section {
    margin-top: 12px;
}

.section-title {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

/* Liste des galeries en admin */

.gallery-list-admin {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.gallery-item-admin {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.gallery-item-main {
    flex: 1;
    min-width: 0;
}

.gallery-title-admin {
    font-size: 0.98rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.gallery-client {
    font-size: 0.86rem;
    color: #4b5563;
    margin-bottom: 2px;
}

.gallery-meta-line {
    font-size: 0.78rem;
    color: #6b7280;
}

.gallery-link a {
    font-size: 0.78rem;
    color: #2563eb;
    text-decoration: none;
}

.gallery-link a:hover {
    text-decoration: underline;
}

.gallery-item-actions {
    flex-shrink: 0;
}

/* Text vide */
.empty-text {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 4px;
}

/* Lightbox */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.lightbox-content {
    position: relative;
    max-width: 96vw;
    max-height: 96vh;
}

.lightbox-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: #f9fafb;
    color: #111827;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(15,23,42,0.4);
}

#lightboxInner img,
#lightboxInner video {
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
}

/* Responsive */

@media (min-width: 900px) {
    .center-card.large {
        padding: 20px 20px;
    }

    .admin-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        gap: 16px;
        align-items: flex-start;
    }

    .gallery-list-admin {
        max-height: 420px;
    }
}

@media (max-width: 640px) {
    .center-card.large,
    .gallery-page {
        padding: 18px 14px;
        border-radius: 18px;
    }

    .gallery-header-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .grid-photos {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .photo-thumb img {
        height: 150px;
    }

    .video-fake-thumb {
        height: 150px;
    }
}

.gallery-public-link {
    margin-top: 4px;
    display: flex;
    gap: 6px;
    align-items: center;
}
.gallery-link-input {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
}

.gallery-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.gallery-banner {
    margin-top: 4px;
    margin-bottom: 6px;
}

.gallery-banner img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.brand-preview {
    margin-top: 6px;
}

.brand-logo-preview {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
}

.brand-banner-preview {
    max-width: 100%;
    max-height: 120px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #4b5563;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

@media (max-width: 640px) {
    .brand-logo {
        width: 32px;
        height: 32px;
    }
    .gallery-banner img {
        max-height: 140px;
    }
}

.dashboard-subtitle {
    margin-top: 4px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #6b7280;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 10px 25px rgba(15,23,42,0.06);
    border: 1px solid rgba(148,163,184,0.3);
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}

.stat-hint {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #6b7280;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Badges pour les galeries */
.gallery-badges {
    margin: 4px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #f4f4f4;
}

.badge-lock {
    background: #fff3cd;
    border-color: #ffe58f;
}

.badge-archived {
    background: #f1f1f1;
    border-color: #cccccc;
    color: #777;
}

/* Style pour les galeries archivées */
.gallery-item-admin.is-archived {
    opacity: 0.6;
}

/* Ligne copier le lien */
.gallery-copy-row {
    margin-top: 6px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.copy-input {
    flex: 1;
    font-size: 0.8rem;
    padding: 4px 6px;
}

/* Formulaires inline dans les actions */
.gallery-item-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gallery-item-actions .inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.gallery-item-actions .small-input {
    flex: 1;
    font-size: 0.8rem;
    padding: 4px 6px;
}

@media (max-width: 640px) {
    .gallery-item-actions {
        flex-direction: column;
    }
}

/* Amélioration de la mise en page des galeries en admin :
   - le bloc prend mieux la largeur
   - la liste n'est plus tassée dans une petite hauteur
*/
.center-card.large {
    max-width: 1100px;
}

.gallery-list-admin {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    gap: 12px;
}

/* Mise en page plus large de l'interface admin :
   - la carte prend toute la largeur disponible (avec le padding de la page)
   - meilleur usage de l'espace sur grand écran */
.wtf-bg {
    align-items: flex-start;
}

.center-card.large {
    max-width: none;
}

/* Bloc de prévisualisation du texte d'email dans les galeries */
.gallery-mail-block {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-mail-block label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.copy-textarea {
    width: 100%;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    resize: vertical;
}

/* ===== Mise en page pro de l'interface admin ===== */

/* Le fond garde son gradient, mais la carte est centrée et plus large */
.wtf-bg {
    align-items: center;
}

/* Carte principale plus large mais toujours centrée */
.center-card.large {
    max-width: 1200px;
    width: 100%;
    margin: 32px auto;
}

/* Liste des galeries : plus d'air, pas de hauteur forcée */
.gallery-list-admin {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    gap: 14px;
}

/* Chaque galerie : layout en deux colonnes bien alignées */
.gallery-item-admin {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr);
    align-items: flex-start;
    gap: 16px;
}

/* Colonne des actions : mieux structurée */
.gallery-item-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

/* Formulaires inline : champs et boutons alignés */
.gallery-item-actions .inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.gallery-item-actions .small-input {
    flex: 1;
    font-size: 0.8rem;
    padding: 4px 6px;
}

/* Rangée lien + bouton copier sur une ligne propre */
.gallery-copy-row {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.copy-input {
    flex: 1;
    font-size: 0.8rem;
    padding: 6px 8px;
}

/* Bloc de texte email bien intégré */
.gallery-mail-block {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-mail-block label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.copy-textarea {
    width: 100%;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    resize: vertical;
}

/* Badges sous les infos, alignés à gauche */
.gallery-badges {
    margin: 4px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #f4f4f4;
}

/* Responsive : sur mobile, une seule colonne */
@media (max-width: 768px) {
    .center-card.large {
        margin: 16px auto;
    }

    .gallery-item-admin {
        grid-template-columns: 1fr;
    }

    .gallery-item-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
/* --- Mise en page pro de la liste des galeries --- */

.gallery-list-admin {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Carte d’une galerie */
.gallery-item-admin {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

/* Colonne infos (titre, client, lien, texte mail) */
.gallery-item-main {
    flex: 2 1 60%;
    min-width: 260px;
}

/* Colonne actions (renommer, archiver, supprimer) */
.gallery-item-actions {
    flex: 1 1 230px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

/* Titre / client */
.gallery-title-admin {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.gallery-client {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.gallery-meta-line {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 0.4rem;
}

/* Badges */
.gallery-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
}

/* Lien + bouton copier sur une seule ligne */
.gallery-copy-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.gallery-copy-row input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
}

/* Bloc texte d’email */
.gallery-mail-block {
    margin-top: 0.9rem;
}

.gallery-mail-block label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.gallery-mail-block .copy-textarea {
    width: 100%;
    resize: vertical;
    min-height: 6rem;
}

/* Formulaires d’actions alignés proprement */
.inline-form {
    display: flex;
    gap: 0.4rem;
    width: 100%;
    justify-content: flex-end;
}

.inline-form .small-input {
    flex: 1 1 auto;
    min-width: 0;
}

/* Version mobile : tout passe en colonne */
@media (max-width: 900px) {
    .gallery-item-admin {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-item-actions {
        align-items: stretch;
    }

    .inline-form {
        justify-content: flex-start;
    }
}
