/**
 * Remorque Gourdon - Carte Commerciaux
 * Styles CSS v2.0 - Panneau latéral fixe
 */

/* ==============================================
   WRAPPER PRINCIPAL
   ============================================== */

.rg-carte-wrapper {
    max-width: 1200px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: visible !important;
}

.rg-carte-titre {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 40px;
}

/* ==============================================
   CONTAINER CARTE + PANNEAU
   ============================================== */

.rg-carte-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    overflow: visible !important;
}

/* ==============================================
   CARTE SVG
   ============================================== */

.rg-carte-svg-wrapper {
    flex: 1 1 500px;
    max-width: 700px;
    min-width: 280px;
    overflow: visible !important;
    padding-bottom: 20px; /* Espace pour la Corse */
}

/* ==============================================
   PANNEAU DROIT (Card + Légende)
   ============================================== */

.rg-carte-side-panel {
    flex: 0 0 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rg-carte-info-panel {
    /* Conteneur de la card */
}

.rg-carte-svg-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible !important;
}

.rg-carte-svg-wrapper svg path {
    fill: #e0e0e0;
    stroke: #ffffff;
    stroke-width: 1px;
    transition: fill 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}

.rg-carte-svg-wrapper svg path:hover {
    filter: brightness(0.85);
}

.rg-carte-svg-wrapper svg path.dept-active {
    filter: brightness(0.75);
    stroke-width: 2px;
}

/* Départements non attribués */
.rg-carte-svg-wrapper svg path.dept-unassigned {
    fill: #e0e0e0;
}

.rg-carte-svg-wrapper svg path.dept-unassigned:hover {
    fill: #d0d0d0;
}

/* Animation de highlight */
@keyframes pulse-dept {
    0% { filter: brightness(1); }
    50% { filter: brightness(0.7); }
    100% { filter: brightness(1); }
}

.rg-carte-svg-wrapper svg path.highlight {
    animation: pulse-dept 0.8s ease infinite;
}

/* ==============================================
   PANNEAU INFO (FICHE COMMERCIAL)
   ============================================== */

.rg-carte-info-panel {
    flex: 0 0 320px;
    /* PAS de sticky ni fixed */
}

.rg-carte-info-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* État vide */
.rg-info-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.rg-info-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.rg-info-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Header info wrapper */
.rg-card-header-info {
    flex: 1;
    min-width: 0;
}

/* Header avec photo - LAYOUT HORIZONTAL */
.rg-card-header {
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.rg-card-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rg-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rg-card-photo-placeholder {
    width: 36px;
    height: 36px;
}

.rg-card-header-info {
    flex: 1;
    min-width: 0;
}

.rg-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.rg-card-dept {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0 !important;
}

/* Body avec contacts */
.rg-card-body {
    padding: 20px;
}

.rg-card-contact {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin: 0 -20px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.rg-card-contact:last-child {
    border-bottom: none;
}

.rg-card-contact:hover {
    background: #f8f9fa;
    color: #3498db;
}

.rg-card-contact-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.rg-card-contact-icon svg {
    width: 20px;
    height: 20px;
    stroke: #666;
    fill: none;
    stroke-width: 2;
}

.rg-card-contact:hover .rg-card-contact-icon {
    background: #3498db;
}

.rg-card-contact:hover .rg-card-contact-icon svg {
    stroke: #fff;
}

.rg-card-contact-info {
    flex: 1;
}

.rg-card-contact-label {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.rg-card-contact-value {
    font-size: 0.95rem;
    font-weight: 500;
}

/* ==============================================
   LÉGENDE
   ============================================== */

.rg-carte-legende {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.rg-carte-legende h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

.rg-legende-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rg-legende-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.rg-legende-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.rg-legende-item.active {
    border-color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.rg-legende-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rg-legende-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

/* Overlay (non utilisé) */
.rg-carte-overlay {
    display: none;
}

/* ==============================================
   RESPONSIVE
   ============================================== */

@media (max-width: 900px) {
    .rg-carte-container {
        flex-direction: column;
        align-items: center;
    }
    
    .rg-carte-svg-wrapper {
        flex: 1 1 auto;
        max-width: 100%;
        order: 1;
    }
    
    .rg-carte-side-panel {
        flex: 1 1 auto;
        width: 100%;
        max-width: 500px;
        order: 2;
    }
    
    .rg-legende-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .rg-legende-item {
        flex: 0 0 auto;
    }
}

@media (max-width: 768px) {
    .rg-carte-wrapper {
        padding: 20px 15px;
    }

    .rg-carte-titre {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }

    .rg-legende-list {
        gap: 8px;
    }

    .rg-legende-item {
        padding: 8px 12px;
    }

    .rg-legende-name {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .rg-carte-legende {
        padding: 15px;
    }

    .rg-legende-item {
        flex: 1 1 100%;
    }
    
    .rg-carte-side-panel {
        max-width: 100%;
    }
    
    .rg-card-contact-value {
        font-size: 0.85rem;
    }
}

/* ==============================================
   TABLEAU COMMERCIAUX (Version Mobile)
   ============================================== */

.rg-tableau-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.rg-tableau-titre {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 30px;
}

/* Style tableau par département */
.rg-tableau-container {
    overflow-x: auto;
}

.rg-tableau-commerciaux {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.rg-tableau-commerciaux thead {
    background: #f8f9fa;
}

.rg-tableau-commerciaux th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #1a1a2e;
    border-bottom: 2px solid #dee2e6;
}

.rg-tableau-commerciaux td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.rg-tableau-commerciaux tbody tr:hover {
    background-color: #f8f9fa;
}

.rg-dept-code {
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rg-dept-info {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.rg-dept-info .rg-dept-name {
    font-weight: 600;
}

.rg-dept-info .rg-dept-code {
    color: #666;
    font-weight: 400;
    font-size: 0.85em;
}

.rg-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.rg-tel-link,
.rg-email-link {
    color: #3498db;
    text-decoration: none;
    white-space: nowrap;
}

.rg-tel-link:hover,
.rg-email-link:hover {
    text-decoration: underline;
}

.rg-email-link {
    word-break: break-all;
    white-space: normal;
}

/* Style cards par commercial */
.rg-commercial-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.rg-commercial-header {
    padding: 15px 20px;
    color: #fff;
}

.rg-commercial-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.rg-commercial-body {
    padding: 20px;
}

.rg-commercial-contacts {
    margin-bottom: 15px;
}

.rg-commercial-contacts p {
    margin: 8px 0;
}

.rg-commercial-contacts a {
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.rg-commercial-contacts a:hover {
    color: #3498db;
}

.rg-commercial-contacts svg {
    flex-shrink: 0;
    color: #666;
}

.rg-commercial-depts {
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
}

.rg-commercial-depts strong {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.rg-depts-list {
    color: #333;
    line-height: 1.6;
}

/* Responsive tableau */
@media (max-width: 768px) {
    .rg-tableau-commerciaux {
        font-size: 0.8rem;
    }

    .rg-tableau-commerciaux th,
    .rg-tableau-commerciaux td {
        padding: 8px 10px;
    }

    /* Masquer la colonne email sur tablette */
    .rg-tableau-par-dept .rg-commercial-email {
        display: none;
    }
    
    .rg-tableau-par-dept th:nth-child(4) {
        display: none;
    }

    .rg-tableau-titre {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .rg-tableau-wrapper {
        padding: 10px;
    }

    .rg-tableau-commerciaux {
        font-size: 0.75rem;
    }
    
    .rg-tableau-commerciaux th,
    .rg-tableau-commerciaux td {
        padding: 6px 8px;
    }

    /* Sur mobile : afficher département + numéro sur 2 lignes */
    .rg-dept-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .rg-dept-info .rg-dept-code {
        font-size: 0.7rem;
    }

    /* Masquer la colonne commercial sur très petit écran */
    .rg-tableau-par-dept .rg-commercial-nom {
        display: none;
    }
    
    .rg-tableau-par-dept th:nth-child(2) {
        display: none;
    }

    .rg-commercial-contacts a {
        font-size: 0.85rem;
    }
}
