/*
==============================================
Mémoires d'Ovalie - Global Theme Stylesheet
==============================================
*/

/* 1. Variables & Global Styles
---------------------------------------------- */
:root {
    /* Palette de couleurs */
    --primary-color: #4A5D4A;
    --primary-darker: #3A4A3A;
    --secondary-color: #6c757d; /* Gris neutre de Bootstrap */
    --light-color: #f5f1e8;      /* Couleur parchemin de fond */
    --dark-color: #382a1f;       /* Bois foncé pour navbar/footer */
    --text-light: #f8f9fa;
    --text-dark: #212529;

    /* Styles de bordure */
    --border-radius: 15px;
    
    /* Polices */
    --font-title: 'Playfair Display', serif;
}

/* Réduction globale des tailles de police pour tout le site */
h1, .h1 {
    font-size: 1.75rem !important; /* Réduit */
}

h2, .h2 {
    font-size: 1.5rem !important; /* Réduit */
}

h3, .h3 {
    font-size: 1.25rem !important; /* Réduit */
}

h4, .h4 {
    font-size: 1.1rem !important; /* Réduit */
}

h5, .h5 {
    font-size: 1rem !important; /* Réduit */
}

h6, .h6 {
    font-size: 0.9rem !important; /* Réduit */
}

p, .p {
    font-size: 0.9rem !important; /* Réduit */
}

a {
    font-size: 0.9rem !important; /* Réduit */
}

/* Réduction des tailles de police pour les éléments de formulaire */
label, .form-label {
    font-size: 0.9rem !important; /* Réduit */
    font-weight: 500;
}

input, .form-control, .form-select {
    font-size: 0.9rem !important; /* Réduit */
}

textarea, .form-control[type="textarea"] {
    font-size: 0.9rem !important; /* Réduit */
}

/* Amélioration du style des textareas */
textarea.form-control {
    border-radius: 8px !important;
    border: 1px solid #dee2e6 !important;
    padding: 0.75rem 1rem !important;
    line-height: 1.5 !important;
    transition: all 0.2s ease !important;
    resize: vertical !important;
    min-height: 120px !important;
}

textarea.form-control:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(74, 93, 74, 0.15) !important;
    outline: 0 !important;
}

button, .btn {
    font-size: 0.9rem !important; /* Réduit */
}

small, .small, .form-text {
    font-size: 0.8rem !important; /* Réduit */
}

/* Container plus compact */
.container {
    max-width: 1100px !important;
}

@media (min-width: 1400px) {
    .container {
        max-width: 1100px !important;
    }
}

body {
    background-color: var(--light-color);
    background-image: url('../images/background_parchment.png');
    background-attachment: fixed;
    background-size: cover;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: var(--text-dark);
}

main {
    flex: 1;
}

/* Styles globaux pour les liens dans le contenu */
main a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

main a:hover {
    color: var(--primary-darker);
    text-decoration: underline;
}

/* 2. Composants
---------------------------------------------- */

/* ----- Boutons ----- */
.btn {
    border-radius: 0.3rem;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-light);
}

.btn-primary:hover {
    background-color: var(--primary-darker);
    border-color: var(--primary-darker);
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--text-light);
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Bouton spécial avec texture bois */
.btn-wood {
    background-color: var(--dark-color);
    background-image: url('../images/wood_texture_final.png');
    background-size: cover;
    background-position: center;
    color: var(--text-light);
    border: 1px solid #2a1f15;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.btn-wood:hover {
    background-color: #4a3429;
    border: 1px solid #3a2a1f;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ----- Formulaires ----- */
.form-label {
    font-weight: 500;
    font-size: 0.95rem;
    color: #6c757d; /* Gris secondaire de Bootstrap */
}

/* Bouton spécial avec icône et texte alignés */
.btn-icon-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem; /* Espace entre l'icône et le texte */
}

/* ----- Toggle View (Mes groupes / Toutes les histoires) ----- */
.view-toggle .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.view-toggle .btn:hover:not(:disabled) {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.view-toggle .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
}

.view-toggle .btn-check:checked + .btn {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.view-toggle .btn-check:checked:disabled + .btn {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    opacity: 0.6;
}


/* ----- Badges ----- */
.badge {
    padding: 0.5em 0.8em;
    font-size: 0.9rem;
    font-weight: 500;
    vertical-align: middle;
}

/* Personnalisation de la couleur warning (moins criarde) */
.badge.bg-warning {
    background-color: #e67e22 !important; /* Orange plus doux */
    color: white !important;
}


/* ----- Cartes ----- */
.card {
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* En-tête de carte avec couleur d'accent */
.card-header-accent {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-bottom: 1px solid var(--primary-darker);
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

.card-header-accent h5,
.card-header-accent h6 {
    color: var(--text-light);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* ----- Header avec Jumbotron intégré ----- */
/* UNE SEULE image de fond pour toute la zone site-header (header + navbar) */
.site-header {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    background-color: var(--dark-color);
    background-image: url('../images/wood_texture_final.png');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    /* L'image de fond s'applique à tout le conteneur, les enfants sont transparents */
}

.header-top-bar {
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa !important;
    color: #666;
}

.header-main.jumbotron-ovalie {
    box-shadow: none;
    width: 100%;
    background-color: transparent !important;
    background-image: none !important;
    /* Surcharger les styles de .jumbotron-ovalie */
    padding: 2rem 0 !important; /* Augmenter le padding vertical pour plus d'espace */
    min-height: 120px; /* Hauteur minimale pour s'assurer que le contenu a assez d'espace */
    border-radius: 0 !important;
    display: flex;
    align-items: center; /* Centrer verticalement le contenu */
}

/* Style pour le titre "Mémoires d'Ovalie" */
.header-main.jumbotron-ovalie h1,
.header-main.jumbotron-ovalie .h2 {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 2.2rem; /* Augmenté de 2rem à 2.5rem */
    letter-spacing: 0.5px;
}

/* Style spécifique pour le titre "Mémoires d'Ovalie" centré */
.header-title-center h1,
.header-title-center .h2 {
    font-size: 2.2rem !important; /* Taille plus grande pour le titre principal */
}

/* Style pour le sous-titre du jumbotron */
.header-main.jumbotron-ovalie p {
    font-size: 0.85rem; /* Réduit de 0.9rem à 0.85rem */
}

/* Style pour les actions utilisateur dans le jumbotron */
.header-main.jumbotron-ovalie a,
.header-main.jumbotron-ovalie button,
.header-main.jumbotron-ovalie span {
    font-size: 0.85rem; /* Réduire la taille des textes des actions */
}

/* Centrer le titre sur l'écran entier */
.header-title-center {
    position: absolute;
    left: 50%; /* 50% du conteneur parent (.header-main) qui fait 100% de la largeur */
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: auto;
    z-index: 1;
    pointer-events: auto; /* Permet les clics sur le lien */
}

/* Navigation principale sous le header - doit être transparente pour voir le fond du site-header */
/* Cette règle doit surcharger la règle générale .navbar */
.site-header > .navbar,
.site-header nav.navbar,
header.site-header .navbar,
.site-header .navbar.navbar {
    background-color: transparent !important;
    background-image: none !important;
    background: transparent !important; /* Force la suppression de tous les styles de fond */
    border-bottom: none;
    box-shadow: none !important;
    width: 100%;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.site-header .navbar-nav .nav-link {
    color: var(--text-light) !important;
    font-size: 0.85rem; /* Réduit de 0.9rem à 0.85rem */
    padding: 0.5rem 1rem;
    transition: opacity 0.2s;
}

.site-header .navbar-nav .nav-link:hover {
    opacity: 0.8;
    color: var(--text-light) !important;
}

.site-header .navbar-nav .nav-link i {
    margin-right: 0.5rem;
    color: var(--text-light);
}

.site-header .navbar-toggler {
    border-color: rgba(255,255,255,0.3);
}

.site-header .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ----- Navbar classique (pour compatibilité) ----- */
/* Note: Cette règle s'applique aux navbars en général */
/* IMPORTANT: La navbar dans .site-header sera surchargée par la règle .site-header .navbar ci-dessus */
.navbar {
    background-color: var(--dark-color);
    background-image: url('../images/wood_texture_final.png');
    background-size: cover;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.navbar-nav .nav-link {
    color: var(--text-light) !important;
    font-size: 0.9rem;
}

.navbar-nav .nav-link:hover {
    opacity: 0.8;
}

/* Augmenter l'espacement horizontal des éléments de la navbar */
.navbar-nav .nav-link,
.navbar-nav .nav-item > form {
    padding-right: 1rem !important;
    padding-left: 1rem !important;
}

/* Assurer l'alignement vertical de tous les éléments de la navbar */
.navbar-nav {
    align-items: center;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

/* ----- Footer ----- */
.footer {
    background-color: var(--dark-color);
    background-image: url('../images/wood_texture_final.png');
    background-size: cover;
    color: var(--text-light);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    padding: 1rem 0;
    margin-top: auto;
}

/* 3. Tables Responsives
---------------------------------------------- */

/* Amélioration des tableaux du dashboard */
.table-responsive {
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    background-color: #fff;
}

.table {
    margin-bottom: 0;
    background-color: #fff;
}

.table th {
    border-top: none;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.9rem;
    background-color: var(--light-color);
    color: var(--dark-color);
    padding: 0.75rem 1rem;
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid var(--primary-color);
}

.table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(74, 93, 74, 0.05);
}

.table tbody tr:last-child {
    border-bottom: none;
}

/* Contrôle de la largeur des colonnes pour éviter le débordement */
.table td {
    vertical-align: middle;
    max-width: 200px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    color: var(--text-dark);
}

/* Colonnes spécifiques pour le tableau des stories */
.table-stories td:nth-child(1) { width: 20%; } /* Titre */
.table-stories td:nth-child(2) { width: 15%; } /* Groupe */
.table-stories td:nth-child(3) { width: 12%; } /* Type */
.table-stories td:nth-child(4) { width: 30%; } /* Résumé */
.table-stories td:nth-child(5), /* Statut */
.table-stories td:nth-child(6) { width: 10%; } /* Accès */
.table-stories td:nth-child(7) { white-space: nowrap; } /* Date */


/* Colonnes spécifiques pour le tableau des groupes */
.table-groups td:nth-child(1) { /* Nom */
    width: 20%;
}

.table-groups td:nth-child(3) { /* Description */
    width: 40%;
}

/* Styles pour les badges dans les tableaux */
.table .badge {
    font-size: 0.75rem;
    padding: 0.4em 0.6em;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}

/* Styles pour les boutons dans les tableaux */
.table .btn {
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    white-space: nowrap;
}

.table .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Styles pour les titres de section du dashboard */
.dashboard-section-title {
    color: var(--dark-color);
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

.dashboard-section-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Fond doux pour les cartes vides du dashboard */
.dashboard-empty-card {
    background-color: #f8f6f2 !important; /* Beige doux, légèrement plus chaud que le parchemin */
    border: 1px solid rgba(74, 93, 74, 0.1); /* Bordure très subtile avec la couleur primaire */
}

/* Style pour les listes de demandes en attente */
.list-group-item {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px !important;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    background-color: #fff;
}

.list-group-item:hover {
    background-color: rgba(74, 93, 74, 0.03);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateX(2px);
}

/* 4. Styles Spécifiques aux Pages
---------------------------------------------- */

/* ----- Page d'accueil (home.html) ----- */
.jumbotron-ovalie {
    background-color: var(--dark-color);
    background-image: url('../images/wood_texture_final.png');
    background-size: cover;
    color: var(--text-light);
    padding: 2rem 2.5rem;
    border-radius: var(--border-radius);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
}

/* Exception : quand jumbotron-ovalie est dans header-main, pas de fond */
/* Cette règle doit venir APRÈS la règle générale .jumbotron-ovalie pour la surcharger */
.site-header .header-main.jumbotron-ovalie,
.site-header .jumbotron-ovalie {
    background-color: transparent !important;
    background-image: none !important;
    background: transparent !important; /* Force la suppression de tous les styles de fond */
}

.filters-section {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border: 1px solid var(--primary-darker);
    border-bottom: none;
}

.filters-body {
    background-color: #fff;
    padding: 1.5rem 1.25rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    border: 1px solid #ddd;
    border-top: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* 5. Utilitaires & Fonds
---------------------------------------------- */

.rugby-ball-background, .old-shoes-background {
    position: fixed;
    width: 30vw;
    height: 100vh;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.rugby-ball-background {
    background-image: url('../images/rugby_ball_vintage_transparent.png');
    right: -2vw;
    top: 70%;
    transform: translateY(-50%) rotate(15deg);
}

.old-shoes-background {
    background-image: url('../images/old_shoes_transparent.png');
    left: -2vw;
    bottom: -40vh;
    transform: rotate(-15deg);
}

/* 6. Style Polaroid pour les photos
---------------------------------------------- */
/* Exception pour les liens contenant des polaroids - surcharger les styles de main a */
main a .polaroid-photo,
main a.polaroid-photo {
    color: inherit !important;
    text-decoration: none !important;
    font-weight: normal !important;
}

main a:hover .polaroid-photo,
main a.polaroid-photo:hover {
    color: inherit !important;
    text-decoration: none !important;
}

/* S'assurer que tous les éléments à l'intérieur d'un polaroid dans un lien héritent correctement */
main a .polaroid-photo *,
main a.polaroid-photo * {
    color: inherit;
    text-decoration: none;
}

.polaroid-photo {
    background: white;
    padding: 15px 15px 70px 15px; /* Bordure blanche, plus épaisse en bas pour le commentaire */
    border: 1px solid rgba(0, 0, 0, 0.08); /* Bordure fine et claire */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    width: 100%;
    position: relative;
    border-radius: 2px;
    color: inherit;
    text-decoration: none;
}

.polaroid-photo:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Effet d'empilement avec vraies photos pour la page d'accueil */
.polaroid-stack-container {
    position: relative;
    width: 100%;
    margin: 0 20px; /* Espace entre les paquets de photos */
}

.polaroid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0.95;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none; /* Les photos en arrière-plan ne bloquent pas les clics */
}

/* Empilement de gauche à droite comme un jeu de cartes */
.polaroid-background:nth-child(1) {
    transform: translateX(-25px) rotate(-2deg);
    z-index: 1;
}

.polaroid-background:nth-child(2) {
    transform: translateX(-12px) rotate(-1deg);
    z-index: 2;
}

.polaroid-front {
    position: relative;
    z-index: 3;
}

.polaroid-stack-container:hover .polaroid-background {
    opacity: 1;
}

/* Au survol, les cartes s'écartent légèrement plus */
.polaroid-stack-container:hover .polaroid-background:nth-child(1) {
    transform: translateX(-30px) rotate(-3deg);
}

.polaroid-stack-container:hover .polaroid-background:nth-child(2) {
    transform: translateX(-15px) rotate(-1.5deg);
}

.polaroid-photo img {
    width: 100%;
    height: 250px;
    display: block;
    object-fit: cover;
    border-radius: 1px;
}

.polaroid-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px; /* Correspond au padding-bottom de .polaroid-photo */
    padding: 10px 15px 10px 15px;
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: #333 !important;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-decoration: none !important;
    font-weight: normal !important;
    overflow: hidden;
}

.polaroid-caption.empty {
    color: #999;
    font-style: italic;
    font-size: 0.85rem;
    visibility: hidden; /* Masquer les légendes vides des photos en arrière-plan */
}

.polaroid-persons {
    font-size: 0.75rem;
    color: #666 !important;
    margin-top: 5px;
    font-style: italic;
    font-weight: normal !important;
    text-decoration: none !important;
}

/* Badge zoom pour les photos Polaroid */
.polaroid-photo .position-absolute {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.polaroid-photo:hover .position-absolute {
    opacity: 1;
}

/* Modale photo - s'assurer que l'image s'affiche correctement */
#photoModal #modalImage {
    max-height: 550px !important;
    max-width: 100% !important;
    object-fit: contain !important;
    transition: transform 0.2s ease;
    display: block !important;
    width: auto !important;
    height: auto !important;
}

#photoModal .modal-body {
    min-height: 600px;
}

#photoModal #imageContainer {
    overflow: hidden;
    cursor: grab;
}

/* ========================================
   Styles pour la zone d'upload améliorée
   ======================================== */

.upload-zone {
    border: 3px dashed #6c757d;
    border-radius: 15px;
    padding: 60px 40px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover {
    border-color: #0d6efd;
    background: #e7f1ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.upload-zone h4 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
}

.preview-card {
    transition: transform 0.2s ease;
}

.preview-card:hover {
    transform: scale(1.05);
}

.preview-card img {
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-card .btn-danger {
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.preview-card .btn-danger:hover {
    opacity: 1;
}
