/* ================================
   BASE STYLES
   ================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    color: #333;
}

/* ================================
   PAGE LAYOUT
   ================================ */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    color: #003C61;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.subtitle {
    font-size: 1rem;
    color: #666;
}

/* ================================
   MAP WRAPPER
   ================================ */
.map-wrapper {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    overflow: hidden;
}

/* ================================
   MAIN MAP
   ================================ */
.map-main {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.map-main svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ================================
   DEPARTMENT STYLING
   ================================ */
.map-main path[data-numerodepartement],
.inset-content path[data-numerodepartement] {
    fill: #e8eaed;
    stroke: #fff;
    stroke-width: 1;
    cursor: pointer;
    transition: fill 0.15s ease, stroke-width 0.15s ease;
}

.map-main path[data-numerodepartement]:hover,
.inset-content path[data-numerodepartement]:hover {
    stroke-width: 1.5;
}

/* Highlighted state */
.map-main path[data-numerodepartement].highlighted,
.inset-content path[data-numerodepartement].highlighted {
    stroke: #fff;
    stroke-width: 1.5;
}

/* Department number labels */
.dept-label {
    font-size: 12px;
    font-weight: 600;
    fill: #555;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: central;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dept-label.small {
    font-size: 9px;
}

/* ================================
   ILE-DE-FRANCE INSET
   ================================ */
.map-inset {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 220px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 10;
}

.inset-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    text-align: center;
}

.inset-content {
    padding: 10px;
    background: #fafafa;
}

.inset-content svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Connection line from main to inset */
.connection-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* ================================
   POPUP MODAL
   ================================ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

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

.popup-card {
    background: #fff;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.popup-overlay.active .popup-card {
    transform: translateY(0) scale(1);
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.popup-close:hover {
    background: #fff;
    transform: scale(1.1);
}

.popup-photo {
    width: 100%;
    padding: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#popup-photo-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.popup-info {
    padding: 1.5rem;
}

.popup-info h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #1a1a2e;
}

.popup-region {
    font-weight: 600;
    font-size: 0.95rem;
    color: #667eea;
    margin-bottom: 0.75rem;
    display: inline-block;
    padding: 4px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
}

.popup-departments {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    line-height: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.dept-label-text {
    margin-right: 4px;
}

.dept-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.popup-title {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.popup-phone,
.popup-email {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-phone::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23667eea' viewBox='0 0 24 24'%3E%3Cpath d='M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.popup-email::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23667eea' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.popup-phone a,
.popup-email span {
    color: #333;
    text-decoration: none;
}

.popup-phone a:hover {
    color: #667eea;
}

.popup-mailto-btn {
    display: block;
    margin-top: 1.5rem;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-mailto-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 900px) {
    .map-inset {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        max-width: 300px;
        margin: 1.5rem auto 0;
    }

    .map-wrapper {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }
}

@media (max-width: 600px) {
    .page-container {
        padding: 1rem 0.5rem;
    }

    .map-wrapper {
        border-radius: 12px;
        padding: 0.75rem;
    }

    .popup-card {
        max-width: 100%;
        margin: 0.5rem;
        border-radius: 12px;
    }

    .popup-photo {
        height: 220px;
    }

    .popup-info {
        padding: 1.25rem;
    }

    .popup-info h2 {
        font-size: 1.2rem;
    }
}
