/* Fix overflow-x causé par les marges négatives de Bootstrap .row sur mobile */
@media (max-width: 767px) {
    .row {
        margin-left: 0;
        margin-right: 0;
    }

    /* Padding pour que le menu mobile ne soit pas caché par la barre d'actions */
    .offcanvas-body {
        padding-bottom: 80px;
    }
}

/* Amélioration du menu mobile offcanvas */
.offcanvas {
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
}

.offcanvas-header {
    background: white;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-bottom: none !important;
}

.offcanvas-title {
    letter-spacing: -0.02em;
}

.offcanvas-body {
    padding: 1.5rem 0.5rem;
}

.offcanvas .navbar-nav {
    gap: 0;
}

.offcanvas .nav-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.offcanvas .nav-item:last-child {
    border-bottom: none;
}

.offcanvas .nav-link {
    padding: 1rem 1rem;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--bs-primary);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.offcanvas .nav-link:hover,
.offcanvas .nav-link:focus {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: var(--bs-accent);
    padding-left: 1.25rem;
    color: var(--bs-primary);
}

/* Amélioration de l'indicateur dropdown */
.offcanvas .dropdown-toggle::after {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    content: "\203A";
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--bs-accent);
    transition: all 0.3s ease;
}

.offcanvas .dropdown-toggle[aria-expanded="true"]::after {
    transform: translateY(-50%) rotate(90deg);
    color: var(--bs-primary);
}

.offcanvas .dropdown-toggle:hover::after {
    right: 0.75rem;
}

.offcanvas .has-submenu .has-submenu .dropdown-toggle::after{
    top: 20px;
}

/* Suppression de background gris */
.offcanvas .dropdown-menu {
    background: transparent;
    border: none;
    margin-top: 0;
    box-shadow: none;
}

/* Uniformisation hauteur : même padding vertical que .nav-link (1rem) */
.offcanvas .dropdown-item {
    padding: 1rem 0.5rem 1rem 2rem;
    font-size: 0.95rem;
    color: var(--bs-primary);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.offcanvas .dropdown-item:hover {
    background: rgba(245, 158, 11, 0.06);
    border-left-color: var(--bs-accent);
    padding-left: 2.25rem;
    color: var(--bs-primary);
}

.btn-close {
    opacity: 0.6;
    transition: all 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Liens */
a {
    color: var(--bs-accent);
    text-decoration: none;
    font-weight:700;
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: #e21818;
}

/* Exception : liens dans la navigation */
.nav-link {
    color: inherit;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--bs-accent);
}

/* Couleur accent */
.bg-accent {
    background-color: #270000 !important;
}

.text-accent {
    color: var(--bs-accent) !important;
}

.btn-accent {
    background-color: var(--bs-accent);
    border-color: var(--bs-accent);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-accent:hover {
    background-color: #e21818;
    border-color: #e21818;
    color: white;
}

/* Couleur primary */
.bg-primary {
    background-color: var(--bs-primary) !important;
}

.text-primary {
    color: var(--bs-primary) !important;
}

/* Couleur secondary */
.bg-secondary {
    background-color: var(--bs-secondary) !important;
}

/* Gradients */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-secondary)) !important;
}

/* Navbar */
.navbar {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

@media (min-width: 768px) {
    .navbar {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .navbar-nav {
        gap: 1.5rem;
    }
}

.nav-link {
    font-weight: 500;
}

/* Toggler sans bordure */
.navbar-toggler {
    border: none;
    box-shadow: none;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Service card image */
.card-img-top {
    object-fit: cover;
    height: 200px;
}

/* Images dans le contenu (pas les card-img-top) */
.card img:not(.card-img-top) {
    width: 100%;
    height: auto;
    border-radius: 20px;
    margin-bottom: 20px;
}

/* Hero image styling */
.hero-image {
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* Icon containers */
.icon-circle {
    width: 4rem;
    height: 4rem;
    background: rgba(245, 11, 11, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-circle svg {
    width: 2rem;
    height: 2rem;
    color: var(--bs-accent);
}

.step-number {
    width: 3rem;
    height: 3rem;
    background: var(--bs-accent);
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover effect for cards */
.card-hover:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    transition: box-shadow 0.3s ease;
}

/* Dropdown au survol sur desktop */
@media (min-width: 768px) {
    .navbar-nav .dropdown:hover > .dropdown-menu {
        display: block;
        margin-top: 0;
    }

    .navbar-nav .dropdown-menu {
        margin-top: 0.5rem;
    }
}

/* Amélioration des sous-menus */
.dropdown-menu {
    border: none;
    padding-top: 0;
    padding-bottom: 0;
    width: 100%;
}

@media (min-width: 768px) {
    .dropdown-menu {
        width: 250px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    /* Sous-sous-menus (niveau 3) - affichage à droite avec dropend */
    .dropdown-menu .dropdown-menu {
        top: 0;
        left: 100%;
        margin-top: 0;
        margin-left: 0;
    }


    /* Hover effect pour afficher les sous-sous-menus */
    .dropend:hover > .dropdown-menu {
        display: block;
    }
}

/* Indentation mobile pour les sous-sous-menus */
@media (max-width: 767px) {
    .offcanvas .dropdown-menu .dropdown-menu {
        /* Reset dropend positioning for mobile */
        position: static !important;
        left: auto !important;
        top: auto !important;
        margin-left: 0 !important;
        display: none; /* Hidden by default, shown by JS adding .show */
    }
    .dropdown-menu .dropdown-menu li{
        border-top: 1px solid #f4f4f4;
    }
    
    .offcanvas .dropdown-menu .dropdown-menu.show {
        display: block !important;
    }

    .offcanvas .dropdown-menu .dropdown-item {
        padding-left: 1rem;
        font-size: 0.9rem;
    }

    .offcanvas .dropdown-menu .dropdown-menu .dropdown-item {
        padding-left: 2rem;
        font-size: 0.9rem;
        color: var(--bs-primary);;
    }

    .offcanvas .dropdown-menu .dropdown-menu .dropdown-item:hover {
        padding-left: 2.25rem;
    }
}


.dropdown-item {
    padding: 0.75rem 1.25rem;
    white-space: normal;
    word-wrap: break-word;
}

/* Bouton d'action du menu plus compact */
.navbar .btn-nav-action {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
}

/* Overlay pour fermer les panneaux */
.settings-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9997;
}

.settings-overlay.open {
    display: block;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    z-index: 9999;
    overflow-y: auto;
    transition: right 0.3s ease;
}

.settings-panel.open {
    right: 0;
}

/* Barre d'actions mobile */
.mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bs-primary);
    display: flex;
    z-index: 1050;
    box-shadow: 0 -2px 10px 0 rgba(0, 0, 0, 0.2);
}

body {
    padding-bottom: 0;
}

@media (max-width: 767px) {
    body {
        padding-bottom: 70px;
    }
}

@media (min-width: 768px) {
    .mobile-action-bar {
        display: none;
    }
}

.mobile-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 0.5rem;
    background: transparent;
    border: none;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 0.25rem;
}

.mobile-action-btn:hover,
.mobile-action-btn:focus {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.mobile-action-btn.accent {
    background: var(--bs-accent);
}

.mobile-action-btn.accent:hover,
.mobile-action-btn.accent:focus {
    background: #D97706;
}

.mobile-action-btn svg {
    width: 24px;
    height: 24px;
}

.mobile-action-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Modal de rappel */
.modal-rappel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1060;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-rappel.show {
    display: flex;
}

.modal-rappel-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-rappel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-rappel-header h3 {
    margin: 0;
    color: var(--bs-primary);
    font-size: 1.5rem;
}

.modal-rappel-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-rappel-close:hover {
    color: #333;
}

.modal-rappel-description {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Toggle séparé pour le menu mobile (Standard UX) */
.offcanvas .submenu-toggler {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 100%;
    border-left: 1px solid rgba(0,0,0,0.05); /* Séparateur subtil */
    color: var(--bs-primary);
    transition: background-color 0.2s ease;
}

.offcanvas .submenu-toggler:hover,
.offcanvas .submenu-toggler:active {
    background-color: rgba(0,0,0,0.03);
}

/* Rotation fluide du SVG lors de l'expansion */
.offcanvas .submenu-toggler svg {
    transition: transform 0.3s ease;
}

.offcanvas .submenu-toggler[aria-expanded="true"] svg {
    transform: rotate(90deg);
}
