:root {
    /* Light Mode Variables */
    --bg-color: #f2f2f7;
    --card-bg: rgba(255, 255, 255, 0.6);
    --text-primary: #1c1c1e;
    --text-secondary: #8e8e93;
    --accent-color: #007aff;
    --glass-border: rgba(255, 255, 255, 0.4);
    --item-bg: #ffffff;
    --item-hover: #f8f8fb;
    --btn-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode Variables */
        --bg-color: #000000;
        --card-bg: #1c1c1e;
        --text-primary: #ffffff;
        --text-secondary: #aeaeb2;
        --accent-color: #0a84ff;
        --glass-border: rgba(255, 255, 255, 0.1);
        --item-bg: #2c2c2e;
        --item-hover: #3a3a3c;
        --btn-text: #000000;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Pile de polices système uniquement : rendu natif et rapide sur chaque
       appareil, sans requête vers un serveur tiers (conformité RGPD). */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.card-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: row; /* Desktop layout: Side by side */
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ====== DESKTOP LAYOUT (Default) ====== */

.card-left {
    width: 35%;
    min-width: 400px;
    max-width: 550px;
    background-color: var(--card-bg);
    display: flex;
    flex-direction: column;
    padding: 60px 40px;
    box-shadow: 15px 0 40px rgba(0, 0, 0, 0.15);
    z-index: 10;
    overflow-y: auto;
}

@media (prefers-color-scheme: dark) {
    .card-left {
        box-shadow: 15px 0 40px rgba(0, 0, 0, 0.8);
    }
}

.banner-container-mobile {
    display: none; /* Hidden on PC */
}

.profile-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 10;
}

.profile-pic-wrapper {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    padding: 8px;
    background: var(--bg-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.profile-pic-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.identity-container {
    text-align: center;
    margin-bottom: 40px;
}

.name {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.role {
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 2px;
}

.company {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.contact-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: flex-start;
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    background: var(--item-bg);
    border: 1px solid var(--glass-border);
    padding: 18px 20px;
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.contact-item:active {
    background: var(--item-hover);
    transform: scale(0.97);
}

@media (hover: hover) {
    .contact-item:hover {
        background: var(--item-hover);
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    }
    
    .add-button:hover {
        opacity: 0.9;
        transform: translateY(-3px);
        box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
    }
}

.icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--accent-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    margin-right: 20px;
    flex-shrink: 0;
    box-shadow: 0 6px 15px rgba(0, 122, 255, 0.3);
}

.contact-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    overflow: hidden;
    flex-grow: 1;
}

.contact-text .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-bottom: 4px;
}

.contact-text .value {
    font-size: 1.05rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-button {
    width: 100%;
    background: var(--text-primary);
    color: var(--btn-text);
    border: none;
    padding: 20px;
    border-radius: 20px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    margin-top: auto; /* Pushes button to bottom if there's space */
}

.add-button ion-icon {
    font-size: 1.5rem;
}

.add-button:active {
    transform: scale(0.96);
    opacity: 0.8;
}

.add-button.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Right Side - Visual / Map */
.card-right {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-color);
}

.desktop-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-overlay-desktop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.5) 100%);
}

.map-container {
    position: absolute;
    bottom: 40px;
    right: 40px;
    width: 400px;
    height: 280px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}


/* ====== MOBILE LAYOUT ====== */
@media (max-width: 850px) {
    .card-container {
        flex-direction: column;
    }

    .card-left {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 0;
        box-shadow: none;
        background: transparent;
        overflow: visible;
    }

    .banner-container-mobile {
        display: block;
        position: relative;
        height: 200px;
        width: 100%;
    }

    .banner-container-mobile img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .banner-overlay-mobile {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60%;
        background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
    }

    .profile-container {
        margin-top: -80px;
        justify-content: center;
    }

    .profile-pic-wrapper {
        width: 150px;
        height: 150px;
        background: var(--bg-color);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
        padding: 6px;
    }

    .identity-container {
        margin-bottom: 30px;
        padding: 0 20px;
    }

    .contact-section {
        padding: 0 20px 40px;
    }

    .contact-list {
        margin-bottom: 30px;
    }
    
    .contact-item {
        padding: 14px 16px;
    }
    
    .icon-wrapper {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        margin-right: 16px;
    }
    
    .contact-text .value {
        font-size: 1rem;
    }
    
    .add-button {
        padding: 18px;
        font-size: 1.1rem;
        margin-top: 0;
    }

    .whatsapp-button,
    .share-button {
        padding: 18px;
        font-size: 1.1rem;
    }

    .role {
        font-size: 1rem;
    }

    .site-footer {
        margin-top: 20px;
    }

    .card-right {
        display: none; /* Hide desktop banner and map on mobile completely */
    }
}

/* Toast Notification */
.toast-message {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-color);
    padding: 16px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    width: 90%;
    max-width: 400px;
    font-weight: 500;
    font-size: 0.95rem;
    pointer-events: none;
}

.toast-message.show {
    bottom: 30px;
    opacity: 1;
    visibility: visible;
}

.toast-message ion-icon {
    font-size: 1.8rem;
    color: var(--bg-color);
}

/* Animations */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-element {
    opacity: 0;
    animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Social Icons */
.social-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.social-icon:hover {
    transform: translateY(-3px);
    background: var(--accent-color);
    color: white;
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
}

@media (prefers-color-scheme: dark) {
    .social-icon {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* WhatsApp Button */
.whatsapp-button {
    width: 100%;
    background: #25D366;
    color: #ffffff;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.25);
}

.whatsapp-button ion-icon {
    font-size: 1.4rem;
}

.whatsapp-button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Footer credit */
.site-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.site-footer p {
    margin: 4px 0;
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.site-footer a:hover {
    border-color: var(--text-secondary);
}

/* Map consent (RGPD) */
.map-consent {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 20, 0.75);
    color: #fff;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-align: center;
    padding: 20px;
}

.map-consent ion-icon {
    font-size: 2rem;
}

.map-consent span {
    font-size: 1.05rem;
    font-weight: 600;
}

.map-consent small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    max-width: 260px;
}

/* Share Button */
.share-button {
    width: 100%;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.share-button ion-icon {
    font-size: 1.4rem;
}

.share-button:hover {
    background: var(--text-primary);
    color: var(--bg-color);
    transform: scale(0.98);
}

@media (prefers-color-scheme: dark) {
    .share-button {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* Share Modal */
.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.share-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.share-modal {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 350px;
    text-align: center;
    position: relative;
    transform: translateY(50px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.share-modal-overlay.active .share-modal {
    transform: translateY(0) scale(1);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.share-modal h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.share-modal p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 25px;
}

.qr-mode-toggle {
    display: flex;
    background: var(--item-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 16px;
}

.qr-mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 10px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.qr-mode-btn.active {
    background: var(--accent-color);
    color: #ffffff;
}

.qr-container {
    background: white;
    padding: 15px;
    border-radius: 16px;
    display: inline-block;
    margin-bottom: 25px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.qr-container img {
    display: block;
    width: 180px;
    height: 180px;
}

.native-share-btn {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.native-share-btn:hover {
    background: var(--accent-hover);
    transform: scale(0.98);
}

/* Formulaire "Laisser mes coordonnées" */
#leadForm {
    text-align: left;
}

.lead-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.lead-form-field input,
.lead-form-field textarea {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-primary);
    background: var(--item-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 14px;
    resize: vertical;
}

.lead-form-field input:focus,
.lead-form-field textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* ====== DESKTOP : barre horizontale fixe en bas (>850px) ======
   La bannière + la carte occupent tout l'écran, et une barre fixe en bas
   regroupe l'identité (à gauche) et tous les éléments cliquables en grille
   (à droite) : plus besoin de descendre la page pour voir quoi que ce soit. */
@media (min-width: 851px) {
    .card-container {
        display: block;
        height: 100vh;
    }

    .card-right {
        width: 100%;
        height: 100%;
    }

    /* La carte Google Maps flotte au-dessus de la barre du bas, pas derrière */
    .map-container {
        bottom: 150px;
    }

    .card-left {
        position: fixed;
        left: 0;
        bottom: 0;
        z-index: 50;
        width: 100%;
        min-width: 0;
        max-width: none;
        overflow: visible;
        flex-direction: row;
        align-items: center;
        gap: 24px;
        padding: 14px 28px;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    }

    @media (prefers-color-scheme: dark) {
        .card-left {
            box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
        }
    }

    .profile-container {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .profile-pic-wrapper {
        width: 56px;
        height: 56px;
        padding: 3px;
    }

    .identity-container {
        text-align: left;
        margin-bottom: 0;
        flex-shrink: 0;
        min-width: 150px;
        max-width: 220px;
    }

    .name {
        font-size: 1.05rem;
        margin-bottom: 0;
    }

    .role {
        font-size: 0.78rem;
    }

    .company {
        font-size: 0.78rem;
    }

    .social-container {
        justify-content: flex-start;
        margin-top: 4px;
        gap: 6px;
    }

    .social-icon {
        width: 26px;
        height: 26px;
        font-size: 0.95rem;
    }

    /* Le conteneur des liens de contact "disparaît" pour que ses 4 éléments
       rejoignent directement la grille ci-dessous, aux côtés des boutons. */
    .contact-list {
        display: contents;
    }

    .contact-section {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .contact-item,
    .add-button,
    .whatsapp-button,
    .share-button {
        width: auto;
        margin: 0;
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 0.82rem;
        box-shadow: none;
        justify-content: flex-start;
        gap: 8px;
    }

    .contact-item .icon-wrapper,
    .add-button ion-icon,
    .whatsapp-button ion-icon,
    .share-button ion-icon {
        flex-shrink: 0;
    }

    .icon-wrapper {
        width: 26px;
        height: 26px;
        font-size: 0.95rem;
        margin-right: 8px;
        border-radius: 8px;
    }

    .add-button ion-icon,
    .whatsapp-button ion-icon,
    .share-button ion-icon {
        font-size: 1.05rem;
    }

    /* On affiche la vraie coordonnée (numéro, email, adresse...) plutôt que
       le libellé générique : l'icône suffit à indiquer de quoi il s'agit. */
    .contact-text .label {
        display: none;
    }

    .contact-text {
        min-width: 0;
    }

    .contact-text .value {
        display: block;
        font-size: 0.82rem;
        font-weight: 500;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-footer {
        flex-shrink: 0;
        margin-top: 0;
        margin-left: auto;
        text-align: right;
        font-size: 0.65rem;
        max-width: 140px;
    }

    .site-footer p {
        margin: 1px 0;
    }
}
