@import url('https://fonts.googleapis.com/css2?family=Gruppo&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
    --primary-color: #4a6fa5;
    --secondary-color: #aaaaaa;
    --accent-color: #00a3d7;
    --text-color: #333333;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --header-bg: #2c3e50;
    --header-text: #ffffff;
    --footer-bg: #2c3e50;
    --primary-dark: #3b5984;
    --secondary-dark: #919191;
    --accent-dark: #008bb7;
    --heading-font: 'Gruppo', cursive;
    --body-font: 'Nunito Sans', sans-serif;
    --nav-font: 'Gruppo', cursive;
    --base-font-size: 16px;
    --heading-scale: 1;
    --radius: 15px;
    --hero-height: 70vh;
    --hero-overlay: 0.6;
    --card-hover-lift: -5px;
    /* Les classes Bootstrap (text-primary, bg-primary, btn-outline-primary…) suivent le thème */
    --bs-primary: #4a6fa5;
    --bs-primary-rgb: 74, 111, 165;
    --bs-link-color: #4a6fa5;
    --bs-link-color-rgb: 74, 111, 165;
    --bs-link-hover-color: #3b5984;
    --bs-link-hover-color-rgb: 59, 89, 132;
    --bs-body-color: #333333;
    --bs-body-bg: #f8f9fa;
}

html {
    font-size: var(--base-font-size);
}

body {
    font-family: var(--body-font);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > main {
    flex: 1 0 auto;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    color: var(--primary-color);
}
h1 { font-size: calc(var(--heading-scale) * (1.375rem + 1.5vw)); }
h2 { font-size: calc(var(--heading-scale) * (1.325rem + .9vw)); }
h3 { font-size: calc(var(--heading-scale) * (1.3rem + .6vw)); }
@media (min-width: 1200px) {
    h1 { font-size: calc(var(--heading-scale) * 2.5rem); }
    h2 { font-size: calc(var(--heading-scale) * 2rem); }
    h3 { font-size: calc(var(--heading-scale) * 1.75rem); }
}

a { color: var(--primary-color); }
a:hover { color: var(--primary-dark); }

.navbar {
    background-color: var(--header-bg) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand, .nav-link {
    font-family: var(--nav-font);
    color: var(--header-text) !important;
    transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--secondary-color) !important;
}

.navbar .dropdown-menu {
    border-radius: calc(var(--radius) / 2);
    border: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.navbar .dropdown-item { font-family: var(--body-font); }
.navbar .dropdown-item:active { background-color: var(--primary-color); }

.hero-section {
    background-size: cover;
    background-position: center;
    height: var(--hero-height);
    min-height: 260px;
    display: flex;
    align-items: center;
    position: relative;
    margin-bottom: 2rem;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0,0,0,var(--hero-overlay));
}

.hero-content {
    position: relative;
    z-index: 1;
    color: white;
    text-align: center;
    padding: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}
.hero-content h1 {
    color: #fff;
    font-size: calc(var(--heading-scale) * 3rem);
    margin-bottom: 1rem;
}
.hero-content .lead {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(var(--card-hover-lift));
}
.card.no-hover:hover, .card:has(form):hover { transform: none; }

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 1rem;
}
.card-header h1, .card-header h2, .card-header h3, .card-header h4, .card-header h5, .card-header h6 {
    color: inherit;
    margin-bottom: 0;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all 0.3s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

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

.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
}

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

.btn-accent:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-outline-primary:hover, .btn-check:checked + .btn-outline-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
    color: var(--primary-color);
}

footer {
    background-color: var(--footer-bg);
    color: var(--header-text);
    padding: 2rem 0;
    margin-top: 3rem;
}
footer h5 { color: var(--header-text); }
footer a.text-white { color: var(--header-text) !important; }

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ddd;
}

.carousel-item img {
    object-fit: cover;
    height: 400px;
    width: 100%;
}

.recipe-category {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.search-container, .login-container {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.login-container {
    max-width: 400px;
    margin: 2rem auto;
}

.alert {
    border-radius: 8px;
}

/* Styles spécifiques aux modules */
.recipe-detail-img, .trip-detail-img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.map-container {
    height: 400px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* --- Carrousel des voyages : respecte le format paysage / portrait --- */
.trip-carousel {
    background: #111;
    border-radius: var(--radius);
    overflow: hidden;
}
.trip-carousel .carousel-item img {
    height: 500px;
    object-fit: contain;
    background: #111;
    cursor: zoom-in;
}
.trip-carousel .carousel-caption {
    background: rgba(0,0,0,.45);
    border-radius: 8px;
    padding: .4rem .8rem;
    bottom: 1rem;
}
.trip-thumbs {
    display: flex;
    gap: .4rem;
    overflow-x: auto;
    padding: .5rem 0;
}
.trip-thumbs button {
    flex: 0 0 auto;
    border: 2px solid transparent;
    padding: 0;
    border-radius: 6px;
    overflow: hidden;
    opacity: .65;
    background: none;
}
.trip-thumbs button.active, .trip-thumbs button:hover {
    border-color: var(--secondary-color);
    opacity: 1;
}
.trip-thumbs img { width: 72px; height: 54px; object-fit: cover; display: block; }
@media (max-width: 576px) {
    .trip-carousel .carousel-item img { height: 320px; }
}

/* Visionneuse plein écran */
#photoViewer .modal-content { background: #000; border: none; }
#photoViewer img { max-height: 88vh; width: auto; max-width: 100%; margin: auto; display: block; }

/* --- Recherche de lieu sur la carte --- */
.place-search { position: relative; }
.place-suggestions {
    position: absolute;
    z-index: 1100;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
    max-height: 280px;
    overflow-y: auto;
}
.place-suggestions button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: none;
    padding: .55rem .9rem;
    color: #333;
}
.place-suggestions button:hover, .place-suggestions button.active { background: #f1f4f9; }
.place-suggestions small { color: #888; display: block; }
.leaflet-container { font-family: var(--body-font); border-radius: 10px; }
.edit-map { height: 340px; border-radius: 10px; }

/* --- Commentaires de la famille --- */
.comment {
    display: flex;
    gap: .75rem;
    margin-bottom: 1rem;
}
.avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
}
.comment-body {
    background: rgba(var(--bs-primary-rgb, 74, 111, 165), .07);
    border-radius: 12px;
    padding: .6rem .9rem;
    flex: 1;
}

/* --- Filtres recettes --- */
.filter-chips .btn { border-radius: 20px; margin: 0 .25rem .5rem 0; }

/* --- Galerie d'édition des photos --- */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 15px;
    margin-top: 10px;
}
.photo-item {
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.photo-item img { width: 100%; height: 130px; object-fit: cover; display: block; }
.photo-item .photo-tools { padding: .4rem; }
.photo-item .badge-cover { position: absolute; top: 6px; left: 6px; }

/* --- Impression d'une recette --- */
@media print {
    header, footer, .no-print, .btn { display: none !important; }
    .card { box-shadow: none; }
    body { background: #fff; color: #000; }
}
