/* Custom styles for Rencontres Trans France */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden !important;
    width: 100%;
    position: relative;
    max-width: 100vw;
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
}

/* Custom Button Styles */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-primary:focus, .btn-primary:active {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    color: white;
}

/* Custom Link Styles */
a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.ad-title {
    color: var(--primary-color) !important;
    font-weight: 600;
    transition: color 0.3s ease;
}

.ad-title:hover {
    color: var(--secondary-color) !important;
    text-decoration: none;
}

/* Force ad title colors in all contexts */
.card-title .ad-title,
.card-title a.ad-title {
    color: var(--primary-color) !important;
}

.card-title .ad-title:hover,
.card-title a.ad-title:hover {
    color: var(--secondary-color) !important;
}

/* Department Card Links */
.department-card {
    color: inherit;
    text-decoration: none;
}

.department-card:hover {
    color: inherit;
    text-decoration: none;
}

.department-card:hover .card {
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

/* Department Card Title Colors */
.department-card .card-title {
    color: var(--primary-color) !important;
    font-weight: 600;
}

.department-card:hover .card-title {
    color: var(--secondary-color) !important;
}

/* FontAwesome Icon Colors */
.fas, .fa {
    color: var(--primary-color) !important;
}

/* Specific icon contexts */
.ad-meta .fas,
.ad-detail-header .fas,
.ad-detail-content .fas,
.contact-info .fas,
.alert .fas {
    color: var(--primary-color) !important;
}

/* Icon colors in different contexts */
h3 .fas, h4 .fas, h5 .fas {
    color: var(--primary-color) !important;
    margin-right: 8px;
}

.text-muted .fas {
    color: var(--primary-color) !important;
    opacity: 0.8;
}

/* City and Ad Detail Header Style */
.city-header, .ad-detail-header {
    background: var(--primary-gradient);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.city-header h1, .ad-detail-header h1 {
    color: white !important;
    margin-bottom: 10px;
    font-weight: 600;
}

.city-header .lead, .ad-detail-header .lead {
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: 0;
}

.city-header .fas, .ad-detail-header .fas {
    color: white !important;
}

/* Ad Image Styles */
.ad-image {
    height: 200px;
    object-fit: contain;
    object-position: center;
    width: 100%;
    background-color: #f8f9fa;
}

.ad-detail-image {
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-height: 400px;
    object-fit: contain;
    object-position: center;
    width: 100%;
    background-color: #f8f9fa;
}

.ad-image-container {
    text-align: center;
}

/* City Card Links */
.city-card-link {
    color: inherit;
    text-decoration: none;
}

.city-card-link:hover {
    color: inherit;
    text-decoration: none;
}

.city-card-link:hover .card {
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

/* Custom Header */
.custom-header {
    background: var(--primary-gradient);
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    padding: 15px 0;
}

/* Header margin for non-homepage pages */
.custom-header.with-margin {
    margin-bottom: 30px;
}

.navbar-logo {
    height: 40px;
    width: auto;
    border-radius: 8px;
    vertical-align: middle;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    line-height: 40px;
    vertical-align: middle;
}

.navbar-brand:hover .brand-text {
    color: #f8f9fa;
    text-decoration: none;
}

.hero-section {
    background: var(--primary-gradient);
    color: white;
    padding: 80px 0;
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.1"><polygon points="0,0 1000,0 1000,100 0,80"/></svg>');
    background-size: cover;
    background-position: bottom;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    letter-spacing: -1px;
}

.hero-section .lead {
    font-size: 1.4rem;
    opacity: 0.95;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 1px 5px rgba(0,0,0,0.2);
}

.departments-grid h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #495057;
}

.department-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease-in-out;
}

.department-card:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-5px);
}

.department-card .card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease-in-out;
    height: 100%;
}

.department-card:hover .card {
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.department-card .card-title {
    color: #007bff;
    font-weight: bold;
    font-size: 1.2rem;
}

.department-card .card-text {
    color: #6c757d;
    font-size: 0.9rem;
}

.ad-card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.2s ease-in-out;
    margin-bottom: 20px;
}

.ad-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.ad-title {
    color: #007bff;
    font-weight: bold;
    text-decoration: none;
}

.ad-title:hover {
    color: #0056b3;
    text-decoration: none;
}

.ad-meta {
    color: #6c757d;
    font-size: 0.9rem;
}

.ad-preview {
    color: #495057;
    line-height: 1.5;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.city-header {
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-bottom: 30px;
    border-radius: 10px;
}

.ad-detail-header {
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-bottom: 30px;
    border-radius: 10px;
}

.ad-detail-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.contact-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.city-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease-in-out;
}

.city-card:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-5px);
}

.city-card .card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease-in-out;
    height: 100%;
}

.city-card:hover .card {
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.city-card .card-title {
    color: #007bff;
    font-size: 2rem;
    margin-bottom: 15px;
}

.city-card .card-text {
    color: #495057;
    font-weight: 500;
    margin-bottom: 10px;
}

.random-ads-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
}

.cities-grid-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

/* Image Carousel Styles */
.ad-image-container .carousel {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.ad-image-container .carousel-item img {
    height: 400px;
    object-fit: contain;
    object-position: center;
    background-color: #f8f9fa;
}

.ad-image-container .carousel-indicators {
    margin-bottom: 10px;
}

.ad-image-container .carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 4px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.ad-image-container .carousel-indicators button.active {
    background-color: white;
    border-color: var(--primary-color);
}

.ad-image-container .carousel-control-prev,
.ad-image-container .carousel-control-next {
    width: 8%;
    color: var(--primary-color);
}

.ad-image-container .carousel-control-prev-icon,
.ad-image-container .carousel-control-next-icon {
    background-color: rgba(102, 126, 234, 0.8);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    background-size: 20px 20px;
}

.ad-image-container .carousel-control-prev:hover .carousel-control-prev-icon,
.ad-image-container .carousel-control-next:hover .carousel-control-next-icon {
    background-color: var(--primary-color);
}

/* Ensure single images maintain consistent styling */
.ad-image-container .ad-detail-image {
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-height: 400px;
    object-fit: contain;
    object-position: center;
    width: 100%;
    background-color: #f8f9fa;
}

/* Department CTA Section */
.department-cta-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 3rem 2rem;
    border-radius: 15px;
    margin-bottom: 3rem;
}

.department-info-content {
    padding: 2rem 1.5rem;
}

.department-info-content h2 {
    color: #2c3e50;
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.department-info-content p {
    color: #5a6c7d;
    font-size: 1.1rem;
    line-height: 1.7;
}

.features-list {
    margin-top: 2rem;
}

.feature-item {
    display: flex;
    align-items: center;
    color: #495057;
    font-size: 1rem;
    font-weight: 500;
}

.feature-item i {
    color: var(--primary-color) !important;
    width: 20px;
    flex-shrink: 0;
}

.department-cta-content {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    height: 100%;
}

.cta-box {
    background: white;
    border-radius: 15px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    width: 100%;
    transition: all 0.3s ease;
}

.cta-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.15);
}

.cta-box h3 {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.5rem;
}

.cta-box .btn-lg {
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    padding: 15px 30px;
    transition: all 0.3s ease;
}

.cta-box .btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.cta-box .fa-search {
    color: var(--primary-color) !important;
}

.cta-box .text-muted {
    color: #6c757d !important;
    font-size: 0.9rem;
}

/* Big Cities Section */
.big-cities-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 3rem 2rem;
    border-radius: 15px;
    margin-bottom: 3rem;
}

.big-cities-section h2 {
    color: #2c3e50;
    font-weight: 700;
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.big-cities-section .lead {
    color: #5a6c7d;
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 800px;
    margin: 0 auto;
}

.cities-grid-full {
    margin-top: 2rem;
}

.big-city-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.big-city-link:hover {
    text-decoration: none;
    color: inherit;
}

.big-city-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
}

.big-city-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.city-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #2c3e50;
    margin-bottom: 0.3rem;
}

.city-dept {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.city-population {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 500;
}

.city-population i {
    color: var(--primary-color) !important;
    margin-right: 0.3rem;
}


/* Page header styles for departments.php */
.page-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 3rem 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
}

.search-department {
    position: relative;
}

/* Barre de recherche du header prend tout l'espace disponible */
.search-container {
    flex: 1;
}

.search-input {
    width: 100% !important;
}

/* Department cards specific styles for departments.php */
.departments-grid .department-card .card-title {
    background: var(--primary-gradient);
    color: white !important;
    padding: 0.4rem 0.8rem;
    margin: 0 auto 1rem auto;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border-radius: 20px;
    display: inline-block;
    min-width: 60px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.departments-grid .department-card:hover .card-title {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Corrections pour éviter le défilement horizontal avec des largeurs plus généreuses */
.container {
    /* Largeurs maximales plus larges pour plus d'espace */
    max-width: 1320px; /* Plus large que Bootstrap xl */
}

@media (max-width: 1399.98px) {
    .container {
        max-width: 1140px; /* Bootstrap xl standard */
    }
}

@media (max-width: 1199.98px) {
    .container {
        max-width: 1020px; /* Plus large que Bootstrap lg */
    }
}

@media (max-width: 991.98px) {
    .container {
        max-width: 800px; /* Plus large que Bootstrap md */
    }
}

@media (max-width: 767.98px) {
    .container {
        max-width: 600px; /* Plus large que Bootstrap sm */
    }
}

@media (max-width: 575.98px) {
    .container {
        max-width: 100%; /* Bootstrap xs - pleine largeur sur mobile */
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Empêcher les images de dépasser */
img {
    max-width: 100%;
    height: auto;
}

/* Empêcher les éléments de dépasser */
.card, .ad-card, .department-card, .city-card {
    max-width: 100%;
    word-wrap: break-word;
}

/* Empêcher seulement les éléments problématiques de créer un défilement horizontal */
.card-title, .card-text, .ad-preview {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    /* Les règles container sont déjà définies plus haut */
    
    /* Corriger le centrage des rows sur mobile */
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    [class*="col-"] {
        padding-left: 7.5px;
        padding-right: 7.5px;
    }
    
    .hero-section {
        padding: 40px 0;
        margin-bottom: 30px;
    }
    
    .hero-section h1 {
        font-size: 2rem;
        padding: 0 10px;
    }
    
    .hero-section .lead {
        font-size: 1.1rem;
        padding: 0 10px;
    }
    
    .ad-image-container .carousel-item img,
    .ad-image-container .ad-detail-image {
        height: 250px;
    }
    
    .ad-image-container .carousel-control-prev-icon,
    .ad-image-container .carousel-control-next-icon {
        width: 30px;
        height: 30px;
        background-size: 15px 15px;
    }
    
    .department-cta-section {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
        margin-left: 0;
        margin-right: 0;
    }
    
    .department-info-content {
        padding: 1rem 0.5rem;
        margin-bottom: 2rem;
    }
    
    .department-info-content h2 {
        font-size: 1.6rem;
    }
    
    .department-info-content p {
        font-size: 1rem;
    }
    
    .department-cta-content {
        padding: 1rem 0.5rem;
    }
    
    .cta-box {
        padding: 1.5rem 1rem;
        margin: 0;
    }
    
    .cta-box h3 {
        font-size: 1.3rem;
    }
    
    .cta-box .btn-lg {
        padding: 12px 25px;
        font-size: 1rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Page header mobile styles */
    .page-header {
        padding: 1.5rem 1rem;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Big cities section mobile styles */
    .big-cities-section {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
        margin-left: 0;
        margin-right: 0;
    }
    
    
    .big-cities-section h2 {
        font-size: 1.8rem;
    }
    
    .big-cities-section .lead {
        font-size: 1rem;
    }
    
    .big-city-card {
        padding: 0.8rem;
        margin: 0.5rem 0;
    }
    
    .city-name {
        font-size: 0.9rem;
    }
    
    .city-dept {
        font-size: 0.75rem;
    }
    
    .city-population {
        font-size: 0.7rem;
    }
    
    /* Department cards mobile styles */
    .departments-grid .department-card .card-title {
        font-size: 1.3rem;
        padding: 0.3rem 0.6rem;
        margin: 0 auto 0.8rem auto;
        min-width: 50px;
        border-radius: 15px;
    }
    
    /* Ajustements pour les sections sur mobile */
    .random-ads-section,
    .cities-grid-section {
        padding: 20px 15px;
    }
    
    /* Texte qui ne dépasse pas */
    .card-title, .card-text, .ad-preview {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

/* Styles pour les descriptions de villes générées */
.highlight {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.info-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-box h4 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.info-box ul {
    margin-bottom: 0;
}

.info-box li {
    margin-bottom: 8px;
    color: #495057;
}

blockquote {
    background: rgba(102, 126, 234, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #495057;
    position: relative;
}

blockquote::before {
    content: '"';
    font-size: 2rem;
    color: var(--primary-color);
    position: absolute;
    left: 10px;
    top: 5px;
    font-family: serif;
}

blockquote p {
    margin: 0;
    padding-left: 20px;
}

/* Styles pour les descriptions de villes dans le contenu */
.city-description h3 {
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    padding-bottom: 8px;
}

.city-description h4 {
    color: var(--secondary-color);
    font-weight: 500;
    margin-top: 20px;
    margin-bottom: 12px;
}

.city-description ul {
    padding-left: 20px;
}

.city-description li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.city-description em {
    color: var(--primary-color);
    font-style: italic;
    font-weight: 500;
}

.city-description p {
    line-height: 1.7;
    margin-bottom: 15px;
    color: #495057;
}
