/* ============================================
   Bladas et Dalons — Style partagé
   Fond ocre clair semi-transparent
   Sans barre de navigation (défilement horizontal)
   ============================================ */

/* --- Fond de page --- */
html {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}
html::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: url('/img/fond-reunion-guyane.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* --- Base --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    color: #1a1a1a;
    background: transparent;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}
img, table, pre, code, iframe { max-width: 100% !important; height: auto; }

/* Barre de navigation — masquée sur mobile (swipe), visible sur desktop */
.site-nav { display: none !important; }
body.has-site-nav { padding-top: 0 !important; }
body:not(.has-site-nav) { padding-top: 0; }

/* --- Contenu principal --- */
@keyframes slideInRight {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}
.main-container {
    position: relative; z-index: 1;
    max-width: 1200px; margin: 0 auto; padding: 14px 10px;
    min-height: 70vh;
    animation: slideInRight 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Cartes (ocre clair transparent) --- */
.card {
    background: #d2b48c;
    border-radius: 14px;
    border: 1px solid rgba(139, 115, 85, 0.25);
    padding: 20px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 16px;
}

/* --- Titres --- */
h1, h2, h3 { color: #1f1810; }
h1 { font-size: 1.4em; margin-bottom: 14px; }
h2 { font-size: 1.15em; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid rgba(139,115,85,0.15); }

/* --- Formulaires --- */
label {
    display: block; color: #2a1f10; font-size: 0.88em;
    font-weight: 500; margin-bottom: 4px; margin-top: 12px;
}
label .required { color: #c0392b; }
input, textarea, select {
    width: 100%; padding: 12px; box-sizing: border-box;
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(139,115,85,0.3);
    border-radius: 10px; color: #111; font-size: 16px; outline: none;
    -webkit-appearance: none;
}
input:focus, textarea:focus { border-color: #1a5c2a; box-shadow: 0 0 0 3px rgba(26,92,42,0.08); }
input:disabled { background: rgba(240,237,229,0.8); color: #5a4e3e; }

/* --- Boutons --- */
.btn {
    display: inline-block; padding: 12px 22px; font-size: 15px;
    background: #1a5c2a; color: white; border: none; border-radius: 10px;
    cursor: pointer; font-weight: 500; transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent; min-height: 44px;
}
.btn:hover { background: #2a7c3a; }
.btn:active { transform: scale(0.97); }
.btn-cancel { background: rgba(200,180,160,0.7); color: #3d2b1a; }
.btn-cancel:hover { background: rgba(180,160,140,0.8); }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #e74c3c; }
.btn-sm { padding: 6px 12px; font-size: 0.85em; min-height: 32px; }

/* --- Messages --- */
.msg { margin: 10px 0; font-size: 0.9em; padding: 10px 14px; border-radius: 10px; display: none; }
.msg.show { display: block; }
.msg-success { background: rgba(26,92,42,0.10); color: #1a5c2a; }
.msg-error { background: rgba(192,57,43,0.10); color: #c0392b; }

/* --- Tableaux --- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid rgba(139,115,85,0.2); }
table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
th {
    background: rgba(139,115,85,0.10); color: #2a1f10; font-weight: 600;
    text-align: left; padding: 12px 10px; border-bottom: 1px solid rgba(139,115,85,0.15); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid rgba(139,115,85,0.08); vertical-align: middle; }
tr:hover td { background: rgba(139,115,85,0.06); }
tr:last-child td { border-bottom: none; }
td.empty { color: #6b5d4a; font-style: italic; }
td a { color: #1a5c2a; text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

/* --- Badges --- */
.badge {
    display: inline-block; font-size: 0.72em; padding: 2px 7px; border-radius: 4px;
    margin-left: 5px; font-weight: 500;
}
.badge-profil { background: rgba(26,92,42,0.12); color: #1a5c2a; }
.badge-extra { background: rgba(193,122,78,0.12); color: #7a4a2a; }
.badge-admin { background: rgba(180,40,40,0.10); color: #8b1a1a; font-weight: 600; }

/* --- Modales --- */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 100; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal {
    border: 1px solid rgba(139,115,85,0.3); border-radius: 16px;
    padding: 22px 18px; width: 100%; max-width: 500px; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.modal h2 { color: #3d2b1a; margin-bottom: 16px; font-size: 1.2em; border: none; padding: 0; }
.modal-buttons { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; flex-wrap: wrap; }

/* --- Galerie --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 100%;
}
.gallery-item {
    position: relative; border-radius: 10px; overflow: hidden;
    background: rgba(255,255,255,0.35);
    border: 1px solid rgba(139,115,85,0.15);
    transition: transform 0.2s; aspect-ratio: 1;
    max-width: 100%;
}
.gallery-item:active { transform: scale(0.98); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item .info {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.7));
    color: white; padding: 12px 10px 8px; font-size: 0.8em;
    opacity: 0; transition: opacity 0.2s;
}
.gallery-item .delete-btn {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,0.55); color: white; border: none;
    border-radius: 50%; width: 32px; height: 32px; cursor: pointer;
    font-size: 17px; display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.gallery-item .delete-btn:active { background: #c0392b; }
@media (hover: hover) {
    .gallery-item:hover { transform: scale(1.02); }
    .gallery-item:hover .info { opacity: 1; }
    .gallery-item:hover .delete-btn { opacity: 1; }
}

.upload-area {
    border: 2px dashed rgba(139,115,85,0.3); border-radius: 12px;
    padding: 24px; text-align: center; margin-bottom: 20px;
    transition: border-color 0.2s; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.upload-area:active { border-color: #1a5c2a; background: rgba(139,115,85,0.06); }
.upload-area.dragover { border-color: #1a5c2a; background: rgba(139,115,85,0.10); border-style: solid; }
.upload-area p { color: #4a3520; margin-top: 8px; font-size: 0.9em; }
.upload-area input { display: none; }

/* --- Lightbox --- */
.lightbox {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.92);
    z-index: 200; align-items: center; justify-content: center; cursor: pointer;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 96%; max-height: 85vh; border-radius: 8px; }

/* --- Actions inline --- */
.actions { white-space: nowrap; }
.edit-btn, .delete-btn {
    background: none; border: 1px solid rgba(139,115,85,0.2); cursor: pointer;
    padding: 6px 12px; border-radius: 7px; font-size: 0.9em; transition: all 0.2s;
    color: #4a3520; -webkit-tap-highlight-color: transparent;
}
.edit-btn:active { border-color: #1a5c2a; color: #1a5c2a; background: rgba(26,92,42,0.06); }
.delete-btn { margin-left: 4px; }
.delete-btn:active { border-color: #c0392b; color: #c0392b; background: rgba(192,57,43,0.06); }

/* --- Liens --- */
.back-link {
    display: inline-block; color: #2a1f10; font-size: 0.88em;
    margin-bottom: 14px; text-decoration: none; font-weight: 500;
}
.back-link:hover { color: #1a5c2a; }

/* --- Pied de page --- */
footer {
    text-align: center; margin-top: 40px; color: #2a1f10; font-size: 0.85em;
}

/* ═══════════════════════════════════════════
   TABLETTE (768px+)
   ═══════════════════════════════════════════ */
@media (min-width: 768px) {
    body.has-site-nav { padding-top: 0 !important; font-size: 17px; }
    .main-container { padding: 20px 20px; }
    .card { padding: 26px 28px; border-radius: 16px; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
    .gallery-item .delete-btn { opacity: 0; }
    .modal { padding: 28px; }
    h1 { font-size: 1.5em; }
    h2 { font-size: 1.2em; }
    td, th { padding: 10px 14px; }
    input, textarea, select { padding: 10px 12px; font-size: 15px; }

    /* --- Barre nav tablette (onglets + logo compact) --- */
    .site-nav {
        display: flex !important;
        position: fixed; top: 0; left: 0; right: 0; z-index: 50;
        background: #d2b48c;
        border-bottom: 1px solid rgba(139,115,85,0.10);
        height: 44px;
    }
    .site-nav-inner {
        display: flex; align-items: center; justify-content: flex-end;
        max-width: 1200px; width: 100%; margin: 0 auto; padding: 0 16px;
        height: 100%;
    }
    .site-nav .logo {
        position: absolute; left: 0; top: 0; bottom: 0;
        display: flex !important; align-items: center;
        padding-left: 8px;
    }
    .site-nav .logo img {
        height: 100%; width: auto; max-width: 50vw; display: block;
    }
    .site-nav .nav-links { display: flex; gap: 2px; position: relative; z-index: 2; }
    .site-nav .nav-links a {
        padding: 6px 12px; border-radius: 6px;
        color: #2c2418; text-decoration: none; font-size: 0.85em; font-weight: 500;
        transition: background 0.15s;
        text-shadow: 0 1px 2px rgba(210,180,140,0.4);
    }
    .site-nav .nav-links a:hover { background: rgba(26,92,42,0.08); color: #1a5c2a; }
    .site-nav .nav-links a.active { background: rgba(26,92,42,0.12); color: #1a5c2a; font-weight: 600; }
    body.has-site-nav { padding-top: 44px !important; }
    .nav-toggle { display: none !important; }
}

/* ═══════════════════════════════════════════
   BUREAU (1024px+)
   ═══════════════════════════════════════════ */
@media (min-width: 1024px) {
    .main-container { padding: 24px 20px; }
    .card { padding: 30px 34px; }
    .gallery-grid { gap: 16px; }
    body { font-size: 17px; }

    /* --- Barre de navigation desktop --- */
    .site-nav {
        display: flex !important;
        position: fixed; top: 0; left: 0; right: 0; z-index: 50;
        background: #d2b48c;
        border-bottom: 1px solid rgba(139,115,85,0.12);
        height: 56px;
    }
    .site-nav-inner {
        display: flex; align-items: center; justify-content: flex-end;
        max-width: 1200px; width: 100%; margin: 0 auto; padding: 0 24px;
        height: 100%;
    }
    .site-nav .logo {
        position: absolute; left: 0; top: 0; bottom: 0;
        display: flex !important; align-items: center;
        padding-left: 10px;
    }
    .site-nav .logo img {
        height: 100%; width: auto; max-width: 85vw; display: block;
    }
    .site-nav .nav-links {
        display: flex; gap: 4px; position: relative; z-index: 2;
        padding-right: 0;
    }
    .site-nav .nav-links a {
        padding: 7px 14px; border-radius: 7px;
        color: #2c2418; text-decoration: none; font-size: 0.9em; font-weight: 500;
        transition: background 0.15s;
        text-shadow: 0 1px 2px rgba(210,180,140,0.5);
    }
    .site-nav .nav-links a:hover { background: rgba(26,92,42,0.08); color: #1a5c2a; }
    .site-nav .nav-links a.active { background: rgba(26,92,42,0.12); color: #1a5c2a; font-weight: 600; }

    body.has-site-nav { padding-top: 56px !important; }
    body:not(.has-site-nav) { padding-top: 0; }

    /* Masquer le burger desktop */
    .nav-toggle { display: none !important; }
}
