:root {
    --primary: #1a56db;
    --primary-light: #eff6ff;
    --primary-hover: #1e40af;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-dark: #000000;
    --text-muted: #64748b;
    --border: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 15px 35px -5px rgba(0, 0, 0, 0.05), 0 10px 15px -5px rgba(0, 0, 0, 0.03);
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* Animation d'arrivée sur la page */
.fade-in { animation: fadeInBody 0.6s ease-out; }
@keyframes fadeInBody { from { opacity: 0; } to { opacity: 1; } }

.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* Navbar */
.navbar { background: var(--bg-card); padding: 5px 0; border-bottom: 1px solid var(--border); }
.nav-container { display: flex; justify-content: space-between; align-items: center; max-width: 95% !important; margin: 0 auto; }
.logo { max-height: 65px; width: auto; object-fit: contain; transform: scale(2.5); transform-origin: left center; position: relative; z-index: 100; margin-left: -30%; }
.nav-links a { color: var(--text-muted); text-decoration: none; margin-left: 20px; font-weight: 500; font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--primary); }

/* Hero Section */
.hero { background: #feaa40; color: white; padding: 70px 0 120px 0; text-align: center; }
.hero h1 { font-size: 2.8rem; font-weight: 700; margin-bottom: 15px; letter-spacing: -0.5px; }
.hero p { color: #ffffff; font-size: 1.15rem; max-width: 600px; margin: 0 auto; }

/* Container Principal (colonne) */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: -70px;
    position: relative;
    z-index: 10;
}

/* Widget Central — full width */
.comparator-widget {
    display: flex;
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-height: 500px;
    width: 100%;
    position: relative;
}

/* Rangée des badges — 50/50 */
.badges-row {
    display: flex;
    gap: 30px;
    width: 100%;
    margin-top: 30px;
}

/* Menu Latéral */
.sidebar { width: 260px; background: #f8fafc; border-right: none; border-radius: var(--radius) 0 0 var(--radius); overflow: hidden; }
.tab-btn {
    display: flex; align-items: center; width: 100%; padding: 22px 25px; border: none; background: transparent;
    text-align: left; font-size: 1.05rem; font-weight: 500; color: var(--text-muted); cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative;
}
.tab-btn .icon { font-size: 1.4rem; margin-right: 15px; transition: transform 0.3s; }
.tab-btn:hover { background: #fae4ca; color: #ff9412; }
.tab-btn:hover .icon { transform: scale(1.1); }
.tab-btn.active { background: #ffffff; color: #ff9412 !important; font-weight: 700; border-left: 4px solid #f8fafc;box-shadow: -2px 0 5px #000; }  

/* Contenu Formulaire */
.content-area { flex: 1; padding: 45px; }
.pane-header { margin-bottom: 35px; border-bottom: 1px solid #ffffff; padding-bottom: 15px; }
.pane-header h2 { font-size: 1.6rem; color: var(--text-dark); margin-bottom: 5px; }
.pane-header p { color: rgb(0, 0, 0); font-size: 0.95rem; }

/* Animations des onglets */
.tab-pane { display: none; opacity: 0; }
.tab-pane.active { display: block; animation: slideFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes slideFadeUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* Grille du formulaire pour optimiser l'espace */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color:#ff9412; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;}
.form-group select, .form-group input, .form-group textarea {
    width: 100%; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 1rem; color: var(--text-dark); background: #fff;
    transition: all 0.2s ease; outline: none; box-shadow: var(--shadow-sm);
}
.form-group select:focus, .form-group input:focus, .form-group textarea:focus {
    border-color: #000; box-shadow: 0 0 0 4px var(--primary-light);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Bouton d'action */
.form-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.btn-primary {
    display: flex; align-items: center; gap: 10px; background: #feaa40; color: white; padding: 16px 32px;
    border: none; border-radius: 8px; font-size: 1.05rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; box-shadow: 0 4px 6px -1px rgba(26, 86, 219, 0.2);
}
.btn-primary:hover { background: #ff9412; transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(26, 86, 219, 0.3); }
.btn-primary:active { transform: translateY(0); }

/* ========================================= */
/* --- FORMULAIRE HABITATION --- */
/* ========================================= */

/* Style pour que les champs de texte/nombre soient identiques aux listes déroulantes */
.form-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    color: #1e293b;
    background-color: white;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

.form-group input[type="number"]:focus {
    border-color: #1a56db;
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Petite transition fluide pour l'apparition du champ étage */
#bloc_etage {
    transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .comparator-widget { flex-direction: column; }
    .sidebar { width: 100%; display: flex; overflow-x: auto; border-radius: var(--radius) var(--radius) 0 0; }
    .tab-btn { padding: 15px; box-shadow: none; border-bottom: 3px solid transparent; justify-content: center; white-space: nowrap; }
    .tab-btn.active { box-shadow: 0 -3px 0 inset #feaa40; }
    .form-grid { grid-template-columns: 1fr; }
    .content-area { padding: 25px; }
    .btn-primary { width: 100%; justify-content: center; }
    
    /* Layout mobile : empile les éléments */
    .main-layout {
        gap: 20px;
        margin-top: -40px;
    }

    .badges-row {
        flex-direction: column;
        gap: 15px;
    }

    .left-badges-wrapper {
        display: none;
    }
}

/* ========================================================================== */
/* --- BADGES ROW (en bas du comparateur) --- */
/* ========================================================================== */
.left-badges-wrapper {
    display: none; /* conservé pour compatibilité mais remplacé par .badges-row */
}

.badges-row .partner-badge {
    flex: 1;
}

/* ========================================================================== */
/* --- STYLE COMMUN AUX BADGES (A2SF ET PDF) --- */
/* ========================================================================== */
.partner-badge {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 25px; 
    display: flex;
    flex-direction: row; 
    align-items: center; 
    gap: 25px; 
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%; /* S'adapte à la largeur du wrapper */
}

.partner-badge:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Le rond qui contient le logo ou l'icône */
.partner-logo-container {
    flex-shrink: 0; 
    width: 150px;  
    height: 150px; 
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc; 
    border-radius: 50%; 
    padding: 10px;
}

.partner-badge img {
    width: 100%; 
    height: 100%;
    object-fit: contain; 
}

/* Le texte à côté de l'image */
.partner-content {
    flex: 1; 
}

.partner-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem; 
    color: var(--text-dark);
    font-weight: 700;
}

.partner-content p {
    margin: 0 0 15px 0; 
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5; 
}

/* Les boutons d'action (Lien ou Upload) */
.btn-partner, .custom-file-upload {
    display: inline-block;
    font-size: 0.85rem;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}

/* Bouton A2SF (Plein) */
.btn-partner {
    background-color: #feaa40; 
}
.btn-partner:hover {
    background-color: #ff9412; 
    color: white; 
}

/* Conteneur principal */
.pdf-upload-form {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Groupe flottant */
.floating-group {
    position: relative;
    width: 100%;
}

.floating-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background-color: #ffffff;
    outline: none;
    transition: all 0.2s ease;
    color: #1e293b;
}

/* Label au repos */
.floating-group label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background-color: transparent;
    padding: 0 4px;
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
    transition: all 0.2s ease;
}

/* Label quand l'input est focus ou rempli */
.floating-group input:focus ~ label,
.floating-group input:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 0.75rem;
    color: #feaa40; /* Ta couleur orange */
    background-color: #ffffff; /* Cache la bordure derrière le texte */
    font-weight: 600;
}

/* Bordure orange au focus */
.floating-group input:focus {
    border-color: #feaa40;
    box-shadow: 0 0 0 3px rgba(254, 170, 64, 0.1);
}

/* Bouton Envoyer moderne */
.btn-send-pdf {
    background-color: #feaa40;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(254, 170, 64, 0.2);
}

.btn-send-pdf:hover {
    background-color: #ff9412;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(254, 170, 64, 0.3);
}

#file-name-display {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
}

/* ========================================================================== */
/* --- RESPONSIVE MOBILE --- */
/* ========================================================================== */

@media (max-width: 1200px) {
    /* badges-row reste en flex row jusqu'à 768px */
}

@media (max-width: 768px) {
    /* --- Réglages de la Navbar pour Mobile --- */
    .logo {
        transform: scale(1.5); 
        max-height: 35px; 
        left: -15px; 
    }

    .navbar img {
        height: 100px !important; 
    }
    
    .nav-links a {
        font-size: 0.65rem; 
        text-align: right; 
        line-height: 1.4; 
        display: block; 
        margin-left: 0;
    }

    .nav-container {
        gap: 10px; 
    }

    .hero h1 { font-size: 2rem; }
    
    .comparator-widget { 
        flex-direction: column; 
        margin-top: -40px; 
    }
    
    .sidebar { 
        width: 100%; 
        display: flex; 
        overflow-x: auto; 
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .tab-btn { 
        padding: 15px; 
        justify-content: center; 
        white-space: nowrap; 
    }

    /* Correction du trait bleu en orange sous l'onglet actif */
    .tab-btn.active { 
        box-shadow: 0 -4px 0 inset #ff9412 !important; 
        border-left: none;
    }

    .left-badges-wrapper {
        display: flex; 
        flex-direction: column;
        gap: 15px;
        margin: 20px auto 40px;
        position: relative;
        top: 0;
        left: 0;
        width: 90%; 
    }

    .partner-badge {
        flex-direction: column; 
        text-align: center;
        padding: 20px;
        gap: 15px;
    }

    .partner-logo-container {
        width: 80px; 
        height: 80px;
    }
    
    .btn-upload-pro {
        padding: 14px;
        font-size: 1rem;
    }

    /* --- RÉGLAGES DU CARROUSEL MOBILE (PLACEMENT ET TAILLE) --- */
    .side-ad-left {
        display: block !important; 
        position: relative !important; 
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 90% !important; 
        max-width: 300px; 
        height: 125px !important;
        margin: 20px auto !important; 
        border-radius: 12px; 
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        z-index: 1;
        transform: none !important; /* Évite les décalages bizarres */
    }

    .carousel-slide {
        padding: 0 !important; 
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Taille de base pour les images */
    .carousel-slide img {
        width: auto !important;
        height: auto !important;
        max-width: 85% !important;
        object-fit: contain;
        transform-origin: center center;
    }

    /* 🎯 AJUSTEMENT SUR MESURE PAR POSITION 🎯 */
    
    /* 1. Premier logo (ActionAssur) : On force un gros zoom car il est très petit */
    .carousel-slide:first-child img {
        max-height: 80px !important;
        transform: scale(2.3) !important; 
    }

    /* 2. Deuxième logo (VotrAssureur) : On le stabilise pour qu'il ne déborde pas */
    .carousel-slide:nth-child(2) img {
        max-height: 65px !important;
        transform: scale(1.1) !important; 
    }

    .side-ad-left::before {
        top: 8px;
        font-size: 0.65rem;
        letter-spacing: 0px;
        width: 100%;
        text-align: center;
    }
    
    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
        background: rgba(255, 255, 255, 0.9) !important;
    }
}