/**
 * Fichier de style global pour Photoraphy Share Drive.
 * Contient tous les styles pour l'accueil (index.php), l'administration (admin.php) et la galerie (share.php).
 */

/* ---------------- 1. VARIABLES & BASES ---------------- */

:root {
    --color-primary-light: #D81B60; /* Rose/Magenta */
    --color-secondary-dark: #4A148C; /* Violet/Indigo */
    --color-text-dark: #2c3e50; /* Presque noir pour le texte principal */
    --color-background-light: #F8F8F8;
    --color-danger: #e74c3c; /* Rouge pour la suppression/erreur */
    --color-success: #38703c; /* Vert pour le succès */
    --color-accent-gradient: linear-gradient(90deg, var(--color-primary-light), var(--color-secondary-dark));
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--color-background-light); 
    font-family: 'Roboto', sans-serif;
    color: var(--color-text-dark);
    line-height: 1.6;
}

body {
    padding: 0;
}

.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
}

/* ---------------- 2. HEADER & NAVIGATION ---------------- */

#header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 10px 20px;
    border-radius: 0 0 10px 10px; /* Bord arrondi en bas seulement */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    position: sticky; /* Reste en haut */
    top: 0;
    z-index: 1000;
}

#logo-link {
    display: flex;
    justify-content: center;
    flex-grow: 1; 
    text-decoration: none;
}

/* Style de l'image du logo (pour corriger la taille) */
#header-logo {
    max-width: 150px; /* Taille réduite */
    height: auto;
    display: block;
}

/* Texte en dégradé - Utilisé pour le logo principal et les titres */
.gradient-text {
    background: var(--color-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    font-weight: 900;
}

/* Menu de Navigation (Desktop) */
#nav-menu {
    display: none; 
    align-items: center;
    gap: 15px;
}

#nav-menu a {
    text-decoration: none;
    color: var(--color-text-dark);
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}

#nav-menu a:hover {
    color: var(--color-primary-light);
}

#nav-menu a i {
    margin-right: 6px;
}

/* Menu Hamburger (Mobile) */
.menu-icon {
    width: 30px;
    height: 20px;
    position: absolute;
    right: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 1000;
}

.menu-icon div {
    width: 100%;
    height: 3px;
    background-color: var(--color-secondary-dark);
    border-radius: 2px;
}

@media (max-width: 768px) {
    #header-container {
        padding-right: 60px;
    }
    
    #logo-link {
        justify-content: flex-start;
        flex-grow: 0;
    }

    #nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: 70%;
        max-width: 300px;
        height: 100vh;
        background-color: white;
        box-shadow: -4px 0 8px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        padding: 80px 20px 20px;
        z-index: 999;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        display: flex;
    }

    #nav-menu.open {
        transform: translateX(0);
    }
    
    #nav-menu a {
        margin: 15px 0;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }
    
    /* Cache les liens sociaux sur Desktop et les affiche sur Mobile */
    .social-link.instagram-menu, .social-link.email-menu, .admin-link-mobile {
        display: block !important; 
    }
    
    .menu-contact-separator {
        height: 1px;
        background-color: #ddd;
        margin: 20px 0;
    }
}

/* Affichage du Menu Desktop */
@media (min-width: 769px) {
    .menu-icon {
        display: none;
    }
    
    #nav-menu {
        display: flex;
        flex-grow: 0;
    }
    /* Cache les éléments mobiles sur Desktop */
    .social-link.instagram-menu, .social-link.email-menu, .menu-contact-separator, .admin-link-mobile {
        display: none !important;
    }
}


/* ---------------- 3. ELEMENTS GÉNÉRAUX & ADMIN ---------------- */

/* Conteneur principal pour l'Admin et l'Accueil */
.admin-container, .welcome-container, .album-header {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 30px;
}

h1 {
    color: var(--color-text-dark);
    font-size: 2em;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

/* Messages d'alerte */
.alert {
    padding: 15px;
    margin: 15px 0;
    border-radius: 6px;
    font-weight: 500;
}
.alert.success {
    background-color: #e6ffed;
    color: var(--color-success);
    border: 1px solid #c8e6c9;
}
.alert.error {
    background-color: #ffe6e6;
    color: var(--color-danger);
    border: 1px solid #e6c8c8;
}
.error-fatal-bdd {
    background-color: #ffcccc !important; 
    color: #cc0000 !important; 
    padding: 20px;
    border-radius: 8px;
}


/* Formulaires Admin */
form label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 500;
}
form input[type="text"], 
form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box; 
    font-family: 'Roboto', sans-serif;
}
form textarea {
    min-height: 80px;
    resize: vertical;
}

.button-submit, .download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    margin-top: 20px;
    cursor: pointer;
    background: var(--color-accent-gradient);
    color: white;
    transition: opacity 0.2s, transform 0.1s;
}

.button-submit:hover, .download-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.button-submit i, .download-btn i {
    margin-right: 8px;
}

.admin-help-text {
    font-size: 0.8em;
    color: #999;
    margin-top: 5px;
}


/* Tableau Admin */
.album-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
}
.album-table th, .album-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 0.9em;
}
.album-table th {
    background-color: #f7f7f7;
    font-weight: 700;
    color: var(--color-text-dark);
}
.album-table tr:hover {
    background-color: #fdfdfd;
}
.token-cell {
    font-family: monospace;
    word-break: break-all;
    font-size: 0.8em;
    color: #888;
}

.table-actions button, .table-actions a {
    background-color: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-secondary-dark);
    margin-right: 10px;
    transition: color 0.2s;
    text-decoration: none; 
    display: inline-block;
}
.table-actions button:hover, .table-actions a:hover {
    color: var(--color-primary-light);
}
.table-actions .fa-trash-alt {
    color: var(--color-danger);
}

/* Responsive Tableau Admin */
@media (max-width: 768px) {
    .album-table thead { display: none; }
    .album-table, .album-table tbody, .album-table tr, .album-table td { display: block; width: 100%; }
    .album-table tr { margin-bottom: 15px; border: 1px solid #ddd; border-left: 4px solid var(--color-primary-light); }
    .album-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: calc(50% - 30px);
        white-space: nowrap;
        text-align: left;
        font-weight: 700;
        color: var(--color-secondary-dark);
    }
}


/* ---------------- 4. PAGE ACCUEIL (INDEX.PHP) ---------------- */
.welcome-container {
    max-width: 800px;
    text-align: center;
}

.welcome-intro {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 30px;
}

.welcome-actions {
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 20px;
}

.welcome-callout {
    font-size: 0.9em;
    color: var(--color-secondary-dark);
    font-family: monospace;
    word-break: break-all;
    background-color: #f0f4f7;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

.welcome-admin {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.admin-login-btn {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-secondary-dark);
    color: white;
    font-weight: 700;
    padding: 12px 25px;
    border-radius: 6px;
    text-decoration: none;
    transition: opacity 0.2s;
}
.admin-login-btn:hover {
    opacity: 0.8;
}

/* ---------------- 5. GALERIE DE PHOTOS (SHARE.PHP) ---------------- */

.album-header {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}
.album-header h1 {
    font-size: 2.2em;
    margin: 0 0 10px 0;
    padding-bottom: 0;
    border-bottom: none;
    text-align: center;
}

/* Style de la note de crédit bénévole */
.credit-note {
    font-size: 0.9em;
    color: #777;
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #eee;
    border-left: 5px solid var(--color-primary-light);
    border-radius: 6px;
}
.credit-note p {
    margin: 0;
}
.credit-note i {
    margin-right: 5px;
}

.message-artist-box {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #f7f7f7;
    border-left: 4px solid var(--color-secondary-dark);
}
.message-artist-box p {
    margin: 5px 0;
    font-size: 1em;
}

.file-count-text {
    font-size: 0.9em;
    color: #aaa;
    margin: 0; 
    padding-top: 10px; 
    border-top: 1px dashed #eee;
    text-align: center;
}
.action-bar {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

/* Grille de photos */
.photo-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.photo-item {
    position: relative;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.photo-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.photo-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1; 
    object-fit: cover;
    display: block;
    opacity: 0.9;
    transition: opacity 0.3s;
}
.photo-item:hover .photo-thumbnail {
    opacity: 1;
}

.item-info {
    padding: 10px;
}
.item-info strong {
    font-size: 0.9em;
    color: var(--color-text-dark);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-info span {
    font-size: 0.75em;
    color: #888;
}

.download-single-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    text-decoration: none;
    transition: background-color 0.2s;
    z-index: 10;
}
.download-single-btn:hover {
    background-color: var(--color-primary-light);
}

.file-icon-placeholder {
    height: 250px; /* Assure la hauteur carrée si pas d'image */
    width: 100%;
    background-color: #eee !important;
}


/* ---------------- 6. LIGHTBOX ---------------- */
.lightbox-modal {
    display: none; 
    position: fixed;
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9); 
    animation: fadeIn 0.3s;
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 1000px;
    max-height: 80vh; 
    object-fit: contain;
    user-select: none;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
}
.prev, .next {
    cursor: pointer;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.5);
}

.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.img-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 60px;
}

.lightbox-caption {
    margin: auto;
    width: 80%;
    max-width: 1000px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
}

@media (max-width: 768px) {
    .close-btn { top: 5px; right: 20px; font-size: 30px; }
    .prev, .next { padding: 10px; font-size: 16px; margin-top: -20px; }
    .modal-content { max-height: 75vh; }
}


/* ---------------- 7. FOOTER ---------------- */

#footer {
    text-align: center;
    padding: 30px 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 30px;
}

#footertxt {
    margin-bottom: 25px;
    color: #777;
}

.social-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
}

.social-link {
    text-decoration: none;
    font-size: 1em;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.social-link i {
    margin-right: 8px;
    border-radius: 50%;
    padding: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    transition: transform 0.2s;
}

.social-link:hover i {
    transform: scale(1.1);
}

.social-link.instagram i {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}
.social-link.instagram {
    color: #d6249f;
}

.social-link.facebook i {
    background-color: #1877f2;
}
.social-link.facebook {
    color: #1877f2;
}

        /* Styles spécifiques à l'interface de partage */
        .container {
            max-width: 1200px;
            margin: 20px auto;
            padding: 20px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        }
        
        .header-share {
            text-align: center;
            padding-bottom: 20px;
            margin-bottom: 20px;
            border-bottom: 2px solid #eee;
        }

        .header-share h1 {
            font-size: 2.2em;
            margin: 0;
        }

        .header-share p {
            font-size: 1.1em;
            color: var(--color-text-dark);
            font-weight: 500;
        }
        
        .message-box {
            background-color: #f7f7f7;
            border-left: 5px solid var(--color-primary-light);
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 6px;
            font-style: italic;
            color: #555;
            font-size: 0.95em;
            text-align: left;
        }
        
        /* Styles des messages d'erreur */
        .alert.error {
            background-color: #ffe6e6;
            color: #cc0000;
            border: 1px solid #e6c8c8;
        }

        /* ---------------- GALLERY GRID (Responsive) ---------------- */
        .gallery-grid {
            display: grid;
            gap: 15px;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Responsive avec min-width */
            margin-top: 20px;
        }
        
        .gallery-item {
            background-color: #fff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            position: relative;
            transition: transform 0.2s;
            cursor: pointer;
            border: 1px solid #eee;
        }
        
        .gallery-item:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .gallery-item-content {
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        /* Conteneur pour maintenir l'aspect ratio de l'image (si on utilise une image background) */
        .image-container {
            position: relative;
            width: 100%;
            padding-top: 66.66%; /* Ratio 3:2 pour les aperçus (ajuster si besoin) */
            overflow: hidden;
            background-color: #f0f0f0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .item-thumbnail {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: opacity 0.3s;
        }
        
        .item-info {
            padding: 10px 15px;
            font-size: 0.9em;
            color: #555;
            flex-grow: 1;
        }
        
        .item-info strong {
            display: block;
            margin-bottom: 5px;
            color: var(--color-text-dark);
            font-weight: 700;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .item-download {
            position: absolute;
            top: 0;
            right: 0;
            background: var(--color-accent-gradient);
            color: white;
            padding: 8px 12px;
            border-bottom-left-radius: 8px;
            text-decoration: none;
            font-size: 1.1em;
            transition: opacity 0.2s;
            z-index: 10;
        }
        .item-download:hover {
            opacity: 0.9;
        }
        
        /* ---------------- LIGHTBOX ---------------- */
        .lightbox-modal {
            display: none; /* Caché par défaut */
            position: fixed;
            z-index: 9999; 
            padding-top: 60px;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.9);
            box-sizing: border-box;
        }

        .lightbox-content {
            margin: auto;
            display: block;
            width: 80%;
            max-width: 1200px;
            max-height: 90vh;
            text-align: center;
        }

        .lightbox-image {
            max-width: 100%;
            max-height: 80vh; /* Limite la hauteur pour laisser de la place au header/footer */
            display: block;
            margin: 0 auto;
        }
        
        .lightbox-caption {
            color: #ccc;
            padding: 10px 0;
            font-size: 16px;
        }

        .lightbox-close {
            position: absolute;
            top: 15px;
            right: 35px;
            color: #fff;
            font-size: 40px;
            font-weight: bold;
            transition: 0.3s;
            cursor: pointer;
        }

        .lightbox-close:hover,
        .lightbox-close:focus {
            color: var(--color-primary-light);
            text-decoration: none;
            cursor: pointer;
        }
        
        /* Flèches de navigation */
        .lightbox-prev, .lightbox-next {
            cursor: pointer;
            position: absolute;
            top: 50%;
            width: auto;
            padding: 16px;
            margin-top: -50px;
            color: white;
            font-weight: bold;
            font-size: 20px;
            transition: 0.6s ease;
            border-radius: 0 3px 3px 0;
            user-select: none;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 10000;
        }
        
        .lightbox-next {
            right: 0;
            border-radius: 3px 0 0 3px;
        }
        
        .lightbox-prev:hover, .lightbox-next:hover {
            background-color: rgba(0, 0, 0, 0.8);
        }
        
        /* Responsive pour la lightbox */
        @media only screen and (max-width: 768px){
          .lightbox-content{
            width: 95%;
          }
          .lightbox-image {
             max-height: 70vh;
          }
          .lightbox-prev, .lightbox-next {
            padding: 10px;
            margin-top: -30px;
            font-size: 16px;
          }
          .lightbox-close {
              top: 10px;
              right: 15px;
          }
        }
        
        /* Style du bouton Télécharger tout */
        .download-all-button {
             text-align: right; 
             margin-bottom: 20px;
        }
        .download-all-link {
            text-decoration: none;
            font-weight: 700;
            color: white;
            padding: 10px 20px;
            border-radius: 6px;
            background-color: #38703c; /* Vert foncé pour le téléchargement principal */
            transition: opacity 0.2s;
        }
        .download-all-link:hover {
            opacity: 0.9;
        }

/* ---------------- NOUVEAUX STYLES DE PAGINATION ---------------- */

/* Correction du positionnement des éléments de pagination pour assurer le centrage */
.pagination-controls {
    clear: both; /* TRÈS IMPORTANT : S'assurer que le bloc vient bien après tout float précédent */
    display: flex;
    justify-content: center; /* Centre les éléments au milieu */
    align-items: center;
    margin-top: 30px;
    gap: 20px;
}

/* Neutralise tout float ou alignement qui pourrait déporter les éléments *à l'intérieur* */
.pagination-controls > * {
    float: none !important;
    text-align: center !important;
    margin: 0 5px; /* Petit espace entre les éléments */
}

.page-link {
    /* Styles spécifiques */
    text-decoration: none;
    font-weight: 700;
    
    /* Couleur par défaut (texte violet, bordure violette) */
    color: var(--color-secondary-dark); 
    border: 1px solid var(--color-secondary-dark);
    border-radius: 6px;
    transition: all 0.2s;
    
    /* Correction pour alignement des éléments flex */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 8px 15px; /* Taille uniforme */
    background-color: transparent; /* Pas de couleur de fond au départ */
}

/* Le bouton actif (au survol ou cliquable) DOIT prendre le dégradé et le texte blanc */
.page-link:hover:not(.disabled),
.pagination-controls a.page-link:not(.disabled) {
    background: var(--color-accent-gradient); /* Utiliser le dégradé */
    color: white !important; /* Rendre le texte blanc */
    border: 1px solid var(--color-secondary-dark); /* Garder la bordure nette */
}

.page-link.disabled {
    color: #bbb;
    border-color: #ddd;
    cursor: default;
    pointer-events: none; /* Rendre in-cliquable */
    background: none; 
}

.page-info {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    /* Aligner le numéro de page au centre des boutons */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px; /* Ajouter le même padding que les boutons pour l'alignement vertical */
    height: 100%;
}
