/* Interactive Map Layout Styles */
.rep-group-map-interactive-area {
    display: flex;
    position: relative; 
    height: 75vh;
    width: 100%;
    margin-bottom: var(--wp--preset--spacing--medium, 20px);
    box-sizing: border-box;
}

.rep-map-info-column {
    width: 35%; 
    max-width: 450px; 
    min-width: 300px; 
    height: 100%; 
    overflow-y: hidden;
    display: flex; 
    flex-direction: column; 
    background-color: var(--bg-color-main-content, #ffffff);
    box-sizing: border-box;
    padding: 15px;
    overflow: hidden; 
}

.rep-map-default-content,
.rep-map-details-content {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    overflow-y: hidden; 
    box-sizing: border-box;
    position: relative; 
    will-change: transform, opacity;
    width: 100%;
    padding-top: 1em;
}

h3.rep-map-list-title {
    font-size: 1.2em;
    color: var(--text-color, #444444);
}

h5.rep-associate-name {
    margin-bottom: 4px;
}

.rep-map-list-container {
    flex-grow: 1;
    overflow-y: auto;
}

.rep-map-list-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rep-map-list-container li a {
    display: block;
    padding: var(--wp--preset--spacing--x-small, 1em) var(--wp--preset--spacing--small, 10px);
    text-decoration: none;
    color: var(--text-color, #444444);
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.rep-map-list-container li a:hover {
    background-color: var(--link-bg, rgba(128, 128, 128, 0.1));
}

.rep-map-list-container li:last-child a {
    border-bottom: none;
}

.rep-map-list-container .area-color-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid var(--color-transparent-gray, rgba(0, 0, 0, 0.1));
    vertical-align: middle;
}

.rep-map-default-footer {
    padding-top: var(--wp--preset--spacing--small, 10px);
    font-size: 0.85em;
    color: var(--text-color, #555555);
    opacity: 0.7;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.rep-group-info-target {
    flex-grow: 1;
    overflow-y: auto;
}

.rep-map-svg-column {
    flex-grow: 1; 
    height: 100%; 
    position: relative; 
    background-color: var(--bg-color, #f0f0f0);
    box-sizing: border-box;
}

.svg-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden; 
    cursor: grab;
    position: relative; 
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rep-group-map-interactive-area {
        flex-direction: column;
        height: 86vh;
    }

    .rep-map-info-column,
    .rep-map-svg-column {
        width: 100%; 
        border-right: none;
    }

    .rep-map-info-column {
        height: 40vh;
        max-height: 350px;
        overflow-y: hidden;
        border-bottom: 1px solid var(--border-color);
    }

    .rep-map-svg-column {
        height: 50vh;
    }
}

.rep-map-info-column p,
.rep-map-info-column li {
    color: var(--text-color, #444444);
    font-size: .95em;
    margin-bottom: 1em;
}

.rep-map-info-column li {
    margin-bottom: 0;
}

.rep-group-info-target .rep-group-item {
    margin-bottom: 25px;
    padding-bottom: 20px;
}
.rep-group-info-target .rep-group-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.rep-group-info-target .rep-group-main-details,
.rep-group-info-target .rep-associate-item {
    margin-bottom: 15px;
}

.rep-group-info-target .rep-group-title-map + .area-context-map .area-name-highlighted {
    position: relative;
    display: inline-block;
    background-color: transparent !important;
    text-decoration: underline;
}

.rep-group-info-target .rep-group-title-map + .area-context-map .area-name-highlighted::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px; 
    background-color: transparent; 
}

.rep-map-details-content .back-to-map-default {
    display: inline-block;
    background-color: transparent;
    color: var(--link-color, #29317d);
    border: none;
    padding-bottom: 1rem;
    text-decoration: underline;
    cursor: pointer;
    font-family: var(--font-family-primary);
    font-size: var(--font-size-small);
}

.rep-map-details-content .back-to-map-default:hover {
    color: var(--button-bg-hover, #404999);
    background-color: transparent;
}

.rep-group-map-svg object, 
.rep-group-map-svg svg {    
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; 
    display: block; 
    transform-origin: 0 0; 
    transition: transform 0.1s ease-out; 
    will-change: transform; 
}

.rep-group-map-svg-object { 
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: 0 0; 
    transition: transform 0.1s ease-out; 
    will-change: transform; 
}

/* Rep Group Details Panel Styling (for Interactive Map) */
.rep-group-details-header {
    text-align: left;
    margin-bottom: 15px;
}

.rep-group-details-header .area-served-header {
    font-size: 1em;
    color: var(--text-color, #555555);
    opacity: 0.8;
    margin-bottom: 8px;
}

.rep-group-logo-map {
    max-width: 120px; 
    height: auto;
    margin-bottom: 10px;
    border-radius: 4px;
}

.rep-group-title-map {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 5px;
    padding-top: 16px;
    color: var(--text-color, #333333);
    font-family: var(--font-family-primary, sans-serif);
}

.contact-item {
    display: flex;
    align-items: flex-start; 
    margin-bottom: 10px;
    font-size: 0.95em;
}

.contact-item ion-icon {
    font-size: 1.3em; 
    margin-right: 10px;
    flex-shrink: 0; 
    color: var(--text-color, #6d747a);
    opacity: 0.7;
}

.contact-item a {
    color: var(--link-color, #29317d);
    text-decoration: none;
    word-break: break-word;
    line-height: 1.5; 
}

.contact-item a:hover {
    text-decoration: underline;
}

.rep-group-contact-item .contact-text {
    line-height: 1.5;
}

.rep-group-contact-item .contact-text-hidden,
.rep-associate-contact-item .contact-text-hidden,
.contact-item .contact-text.visually-hidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    white-space: nowrap; 
}

.address-details .contact-text {
    display: block; 
    line-height: 1.5;
    color: var(--text-color, #333333); 
    margin-right: 8px;
    flex-shrink: 0;
}

/* Area Served Styling */
.area-served-info {
    margin-bottom: 8px; 
    padding-left: 10px; 
    border-left: 5px solid transparent;
    color: var(--text-color, #666666);
}

.area-label {
    font-weight: bold; 
    display: block; 
}

.area-values {
    display: block; 
    font-size: .95em;
}

.team-divider {
    margin-top: 1.2em;
    margin-bottom: 1.2em;
    border: 0;
    height: 0px;
    border-top: 2px dotted var(--border-color, #e0e0e0);
    background-color: transparent;
}

.team-members-section {
    margin-top: 1em;
}

.team-section-title, .rep-map-view-by-title {
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 1em;
    color: var(--text-color, #777777); 
    opacity: 0.7;
    text-transform: uppercase;
}

.rep-map-view-by-title .view-by-select {
    background-position: 90% 50% !important;
}

.rep-associate-item {
    margin-bottom: 20px;
}

.rep-associate-name {
    font-size: 1em; 
    font-weight: bold;
    margin: 0 0 5px 0;
}

.rep-associate-areas-served {
    padding-left: 0;
    border-left: none; 
}

ion-icon {
    display: inline-block; 
}

/* Panel Animation Styles */
@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToLeft {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.panel-active {
    display: flex !important;
}

.panel-hidden {
    display: none !important;
}

.slide-in {
    animation: slideInFromRight 0.25s forwards ease-in-out;
}

.slide-out {
    animation: slideOutToLeft 0.25s forwards ease-in-out;
}

.rep-map-view-controls {
    display: flex;
    align-items: center;
    gap: 10px; 
    margin-bottom: 15px;
    flex-wrap: wrap; 
}

.rep-map-view-controls,
h4.team-section-title {
    white-space: nowrap;
    font-size: 0.9em;
}

h4.rep-map-view-by-title {
    font-size: 0.9em;
    margin-bottom: 0;
}

.view-by-select, 
.sort-toggle-button {
    padding: 8px 10px;
    border: 1px solid var(--border-color, #cccccc);
    border-radius: 4px;
    background-color: var(--bg-color-main-content, #ffffff);
    color: var(--text-color, #333333);
    font-size: 0.9rem;
    cursor: pointer;
}

.view-by-select {
    padding-right: 26px;
}

select.view-by-select {
    background-position: 90% 50% !important;
}

.view-by-select:hover,
.sort-toggle-button:hover {
    background-color: var(--link-bg, rgba(128, 128, 128, 0.1));
    border-color: var(--color-primary, #29317d);
    background-color: inherit;
}

.view-by-select:focus,
.sort-toggle-button:focus {
    outline: 2px solid var(--color-primary, #29317d);
    outline-offset: 1px;
    border-color: var(--color-primary, #29317d);
    background-color: inherit;
}

.sort-toggle-button {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color, #cccccc);
    padding: 8px;
}

.sort-toggle-button ion-icon {
    font-size: 1.1em;
    color: var(--text-color, #333333);
}

/* =================================================================
   Rep Group Fallback Page Styles
   ================================================================= */

/* Navigation Notice */
.rep-group-notice {
    background: var(--bg-color, #f9f9f9);
    border: 1px solid var(--border-color, #e1e1e6);
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.rep-group-notice p {
    margin: 0;
    color: var(--text-color, #444);
}

.rep-group-notice a {
    color: var(--link-color, #4a66ff);
    text-decoration: none;
}

.rep-group-notice a:hover {
    text-decoration: underline;
}

/* Single Rep Group Page */
.single-rep-group .entry-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #e1e1e6);
}

.single-rep-group .entry-title {
    color: var(--text-color, #444);
    margin-bottom: 0;
}

/* Content Sections */
.rep-contact-section,
.rep-address-section,
.rep-satellite-section,
.rep-associates-section {
    margin-bottom: 2rem;
}

.rep-contact-section h2,
.rep-address-section h2,
.rep-satellite-section h2,
.rep-associates-section h2 {
    color: var(--text-color, #444);
    border-bottom: 1px solid var(--border-color, #e1e1e6);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Phone Numbers */
.phone-numbers ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.phone-numbers li {
    margin-bottom: 0.25rem;
}

/* Satellite Offices */
.satellite-office {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #e1e1e6);
}

.satellite-office:last-child {
    border-bottom: none;
}

.satellite-office h3 {
    color: var(--text-color, #444);
    margin-bottom: 0.5rem;
}

/* Associates */
.associate-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #e1e1e6);
}

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

.associate-item h3 {
    color: var(--text-color, #444);
    margin-bottom: 0.5rem;
}

.associate-item p {
    margin: 0.25rem 0;
}

/* Navigation */
.rep-group-navigation {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #e1e1e6);
}

.rep-group-navigation .button {
    display: inline-block;
    background: var(--button-bg, #29317d);
    color: var(--color-white, #fff);
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 4px;
    transition: var(--hover-transition, 150ms cubic-bezier(0.2,0,0,1));
}

.rep-group-navigation .button:hover {
    background: var(--button-bg-hover, #404999);
}

/* Archive Page */
.post-type-archive-rep-group .page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #e1e1e6);
}

.post-type-archive-rep-group .page-title {
    color: var(--text-color, #444);
    margin-bottom: 0.5rem;
}

.archive-description {
    color: var(--text-color, #444);
    margin: 0;
}

/* Rep Groups Listing */
.rep-groups-listing {
    margin-bottom: 2rem;
}

.rep-group-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e1e1e6);
}

.rep-group-item:last-child {
    border-bottom: none;
}

.rep-group-title {
    margin-bottom: 1rem;
}

.rep-group-title a {
    color: var(--text-color, #444);
    text-decoration: none;
}

.rep-group-title a:hover {
    color: var(--link-color, #4a66ff);
}

.rep-group-summary p {
    margin: 0.5rem 0;
}

.rep-group-summary a {
    color: var(--link-color, #4a66ff);
    text-decoration: none;
}

.rep-group-summary a:hover {
    text-decoration: underline;
}

/* No Results */
.no-results .page-header {
    margin-bottom: 1rem;
}

.no-results .page-title {
    color: var(--text-color, #444);
}

.no-results .page-content {
    color: var(--text-color, #444);
}

.no-results a {
    color: var(--link-color, #4a66ff);
    text-decoration: none;
}

.no-results a:hover {
    text-decoration: underline;
}