/**
 * Styles personnalisés pour Castings Adultes
 * Complète BeerCSS avec des styles spécifiques au site
 */

/* Variables personnalisées */
:root {
    --castings-primary: #4b155b;
    --castings-secondary: #672162;
    --castings-accent: #9946c3;
    --castings-primary-rgb: 75, 21, 91;
    --castings-secondary-rgb: 103, 33, 98;
    --castings-accent-rgb: 153, 70, 195;
}

/* Corps de la page */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Roboto Slab", serif;
    font-weight: 400;
    font-optical-sizing: auto;
    font-style: normal;
    font-variation-settings: "slnt" 0;
}

main {
    flex: 1;
    padding-top: 1rem;
    padding-bottom: 2rem;
}

/* Navigation responsive */

/* Par défaut (desktop) : masquer le bouton hamburger */
body nav.top button#btn-menu-mobile {
    display: none !important;
    visibility: hidden !important;
}

/* Sur tablette et mobile : afficher hamburger et masquer liens desktop */
@media screen and (max-width: 960px) {

    /* Afficher le bouton hamburger */
    body nav.top button#btn-menu-mobile {
        display: inline-flex !important;
        visibility: visible !important;
    }

    /* Masquer les liens de navigation desktop */
    body nav.top a.nav-desktop,
    body nav.top a.button.nav-desktop,
    body nav.top .nav-desktop {
        display: none !important;
        visibility: hidden !important;
    }
}

/* Footer */
footer.primary {
    margin-top: auto;
    padding: 2rem 1rem 1rem;
    background-color: #212121;
    color: white;
}

footer.primary a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

footer.primary a:hover {
    color: white;
}

footer.primary h6 {
    color: white;
    margin-bottom: 1rem;
    font-weight: 600;
}

footer.primary nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Carte d'annonce */
.annonce-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.annonce-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.annonce-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.annonce-card .badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

.annonce-card .price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--castings-primary);
}

.annonce-card .location {
    color: #666;
    font-size: 0.9rem;
}

/* Section hero */
.hero {
    background: linear-gradient(135deg, var(--castings-primary) 0%, var(--castings-secondary) 100%);
    color: white;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
    border-radius: 14px;
}

.hero h1 {
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Compteur de catégorie */
.category-count {
    display: inline-block;
    background-color: #d6c0e1;
    color: #000;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* Grille d'annonces */
.annonces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Images des annonces - Taille uniforme */
.annonces-grid article img.responsive {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Conteneur de l'image dans les cards d'annonces */
.annonces-grid article .grid .s6 a {
    display: block;
    overflow: hidden;
}

.annonces-grid article .grid .s6 a img {
    transition: transform 0.3s ease;
}

.annonces-grid article .grid .s6 a:hover img {
    transform: scale(1.05);
}

/* Filtres */
.filters-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Galerie photos */
.photo-gallery {
    margin: 2rem 0;
}

.photo-gallery img {
    border-radius: 8px;
}

/* Messages HTMX en cours de chargement */
.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-indicator {
    display: none;
}

/* Badge de statut */
.badge-featured {
    background-color: var(--castings-accent);
    color: #000;
}

.badge-new {
    background-color: #4caf50;
    color: white;
}

/* Video background styles */
.video-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.video-bg video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    object-fit: cover;
    opacity: 0.6;
    /* 70% opacity */
    pointer-events: none;
}

/* Ensure navigation and content stay above the video */
nav,
header,
main,
footer,
.snackbar {
    position: relative;
    z-index: 1;
}

/* Make the primary nav obscure the video (similar to footer) */
nav.primary {
    position: relative;
    z-index: 2;
    /* above video */
    background-color: rgba(255, 255, 255, 0.92);
    /* light opaque background to hide video */
    backdrop-filter: blur(4px);
}

/*  Background image for registration page --> */

.inscription-bg {
    position: fixed;
    inset: 0;
    background-image: url('/assets/images/image_illustration2.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
    /* 60% opacity */
}

/* Ensure content stays above the background */
nav.primary,
header,
main,
footer,
.snackbar {
    position: relative;
    z-index: 1;
}

/* Ensure primary nav is above the background (like footer) */
nav.primary {
    z-index: 2;
}

/*  Background image for login page --> */
.connexion-bg {
    position: fixed;
    inset: 0;
    background-image: url('/assets/images/image_backgroud1.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
    /* 60% opacity like inscription */
}

/* Ensure content stays above the background and nav is above */
nav.primary,
header,
main,
footer,
.snackbar {
    position: relative;
    z-index: 1;
}

nav.primary {
    z-index: 2;
}

/*  Background image for contact page --> */
.contact-bg {
    position: fixed;
    inset: 0;
    background-image: url('/assets/images/image_illustration4.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
    /* 60% opacity like inscription */
}

/*  Background image for FAQ --> */
.faq-bg {
    position: fixed;
    inset: 0;
    background-image: url('/assets/images/image_illustration5.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
    /* 60% opacity like inscription */
}

/*  Background image for categories page --> */
.categories-bg {
    position: fixed;
    inset: 0;
    background-image: url('/assets/images/image_illustration6.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
    /* 60% opacity like inscription */
}

/*  Background image for categories page --> */
.annonce-bg {
    position: fixed;
    inset: 0;
    background-image: url('/assets/images/image_illustration7.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
    /* 60% opacity like inscription */
}

/*  Background image for 404 error--> */
.page-404-bg {
    position: fixed;
    inset: 0;
    background-image: url('/assets/images/image_photo_annonce_non_trouvee.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}




#zone-upload-photo.drag-over {
    background-color: var(--surface-variant);
    border-color: var(--primary);
    transform: scale(1.02);
}

/* Styles pour les tags */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    background: var(--primary);
    color: var(--on-primary);
}

.chip button {
    margin: 0;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
}

.chip button i {
    font-size: 1rem;
}

/* Styles pour l'autocomplete */
#autoComplete_list_1 {
    z-index: 9999 !important;
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    margin-top: 4px;
    max-height: 280px;
    overflow-y: auto;
}

#autoComplete_list_1 .autoComplete_result {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--on-surface);
}

#autoComplete_list_1 .autoComplete_result:hover,
#autoComplete_list_1 .autoComplete_result[aria-selected="true"] {
    background-color: var(--surface-variant);
}

#autoComplete_list_1 .autoComplete_highlighted {
    color: var(--primary);
    font-weight: 500;
}

#autoComplete_list_1 .no_result {
    padding: 12px 16px;
    color: var(--on-surface-variant);
    text-align: center;
}



/* Responsive */

/* Amélioration mobile - éviter les débordements */
@media (max-width: 960px) {

    /* Conteneurs responsive */
    .medium-width,
    .small-width {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
    }

    /* Articles et cards - responsive padding */
    article.border.padding {
        padding: 1rem;
    }

    /* Filtres sur mobile - full width */
    .filters-panel {
        width: 100%;
        margin-bottom: 1rem;
    }

    /* Grille d'annonces - ajuster spacing */
    .annonces-grid {
        gap: 1rem;
    }

    /* Photo gallery - mieux adapter */
    .photo-gallery img.large {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .annonces-grid {
        grid-template-columns: 1fr;
    }

    /* Forcer les boutons à s'adapter */
    button,
    .button,
    a.button {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }

    /* Articles et conteneurs - padding réduit */
    article.border,
    .border.padding {
        padding: 0.75rem !important;
    }

    /* Images responsive - éviter débordements */
    img.responsive,
    img.large {
        max-width: 100%;
        height: auto;
    }

    /* Grilles - spacing réduit sur mobile */
    .grid {
        gap: 0.5rem;
    }

    /* Fields responsive */
    .field {
        margin-bottom: 0.75rem;
    }

    /* Thumbnails gallery - adapter taille */
    .thumbnail {
        max-width: 100%;
    }
}

/* Adapter le bouton déposer une annonce pour les petits écrans */
@media screen and (max-width: 500px) {
    body nav.top a[href="/deposer-annonce"] {
        border-radius: 50% !important;
        width: 48px !important;
        height: 48px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    body nav.top a[href="/deposer-annonce"] span {
        display: none !important;
    }

    body nav.top a[href="/deposer-annonce"] i {
        margin: 0 !important;
    }
}

/* Forcer la couleur des messages d'erreur (évite l'override par .fill) */
.fill.error,
.error.fill,
.padding.fill.error,
.error {
    background-color: var(--error) !important;
    color: var(--on-error) !important;
}

/* Utility classes */
.small-width {
    max-width: 500px;
    margin: 0 auto;
}

.medium-width {
    max-width: 700px;
    margin: 0 auto;
}

.small-text {
    font-size: 0.9rem;
}

/* Classe utilitaire pour la police Gluten (poids 500) */
.gluten-500 {
    font-family: "Gluten", cursive;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    font-variation-settings: "slnt" 0;
}

/* Thumbnails for gallery */
.thumbnail {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.thumbnail:hover {
    opacity: 1;
}

/* Category badge */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #cea6e0;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Details styling for FAQ */
details {
    margin-bottom: 1rem;
    padding: 1rem;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 0;
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s;
}

details[open] summary::before {
    transform: rotate(90deg);
}

details p {
    margin-top: 1rem;
    padding-left: 1.5rem;
}

/* Photo de profil - Format carré avec object-fit */
.photo-profil-square {
    width: 200px;
    height: 200px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    display: inline-block;
}

/* Image carrée générique - Format carré avec object-fit */
.image-square {
    width: 150px;
    height: 150px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    display: block;
}

/* Responsive layout pour le profil utilisateur - Empiler sur mobile */
@media screen and (max-width: 640px) {
    main.responsive .grid>[class*="s12"] {
        width: 100%;
        max-width: 100%;
    }

    main.responsive>.grid>div {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}