/*
 * Mapbox Sales Map Block Styles
 */

.mapbox-sales-map-block {
    width: 100%;
    margin: 40px 0 0 0;
}

.mapbox-sales-map-container {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto 40px auto;
    padding: 0 40px;
}

.map-container {
    width: 100%;
    height: 600px;
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

.map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
}

.breadcrumb-nav {
    background: white;
    padding: 10px 15px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-nav:empty {
    display: none;
}

.breadcrumb-nav a {
    color: #ED1C24;
    text-decoration: none;
    transition: opacity 0.2s;
}

.breadcrumb-nav a:hover {
    opacity: 0.7;
}

.breadcrumb-nav .separator {
    color: #999;
}

.breadcrumb-nav .current {
    color: #333;
    font-weight: 600;
}

.contact-results-container {
    width: 100%;
    background-image: url('/wp-content/uploads/2025/12/mesh_bg_v4_layered.svg');
    background-size: auto;
    background-position: center;
    background-repeat: repeat;
    padding: 40px;
    margin: 0 -40px;
    width: calc(100% + 80px);
}

.contact-results-header {
    margin-bottom: 20px;
}

.contact-results-header h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.contact-results-header p {
    font-size: 16px;
    color: #666;
}

/* Hover tooltip */
.mapbox-sales-map-tooltip .mapboxgl-popup-content {
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.mapbox-sales-map-tooltip .mapboxgl-popup-tip {
    border-top-color: #333;
}

/* ========================================
   Rep/Distributor Cards
   ======================================== */

.results-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 0 40px;
    max-width: 1920px;
    margin-left: auto;
    margin-right: auto;
}

.contact-results-container .results-title {
    font-size: 28px;
    color: #fff;
    margin: 0;
}

.results-title .region-name {
    color: #ED1C24;
}

.btn-show-all {
    padding: 5px 20px;
    background: #ED1C24;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-show-all:hover {
    background: #c00;
}

.rep-cards-grid {
    display: grid;
    max-width: 1920px;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 24px;
    padding: 0 40px;
}

/* Base card styles */
.rep-card {
    position: relative;
    background: #fff;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.rep-card::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    background: url("/wp-content/plugins/tempco-custom-functionality/blocks/mapbox-sales-map/assets/img/tempco_m_logo_large_faded.svg");
    background-size: contain;
    background-repeat: no-repeat;
    width: 148px;
    height: 130px;
}

.rep-card.hidden {
    display: none;
}

/* Factory Rep Card Header */
.factory-rep-card .rep-card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.factory-rep-card .rep-photo {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    overflow: hidden;
    border: 1px solid #e2e2e2;
}

.factory-rep-card .rep-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.factory-rep-card .rep-header-info {
    flex: 1;
    min-width: 0;
}

.factory-rep-card .rep-name {
    font-size: 36px;
    font-weight: 700;
    color: #ED1C24;
    margin: 0 0 4px 0;
    text-transform: uppercase;
}

.factory-rep-card .rep-contact-person {
    font-family: Inter, sans-serif;
    font-size: 26px;
    font-weight: 700;
    line-height: normal;
    letter-spacing: 5.2px;
    text-transform: uppercase;
    color: black;
    margin: 0 0 16px 0;
}

.factory-rep-card .rep-service-area {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 26px;
}

/* Distributor Card Logo */
.distributor-card .rep-card-logo {
    width: 400px;
    height: 150px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.distributor-card .rep-card-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.distributor-card .logo-placeholder {
    width: 60px;
    height: 60px;
    background: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #999;
}

.distributor-card .rep-company-name {
    font-size: 36px;
    font-weight: 700;
    color: #ED1C24;
    margin: 0 0 16px 0;
    text-align: center;
}

/* Card Divider */
.rep-card-divider {
    height: 2px;
    background: #ED1C24;
    margin: 0 0 10px 0;
}

/* vCard Button */
.rep-vcard-row {
    text-align: center;
    margin-bottom: 16px;
}

.btn-add-contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px 2px 10px;
    color: #ED1C24;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
}

.btn-add-contact:hover {
    color: #c00;
}

.btn-add-contact .icon-contact-book {
    width: 24px;
    height: 24px;
}

/* Card Details Grid */
.rep-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}

.rep-details-left,
.rep-details-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rep-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 16px;
    color: black;
    line-height: 1.4;
}

.rep-detail-item .icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-top: 2px;
}

.rep-detail-item a {
    text-decoration: none;
    color: black;
}

.rep-detail-item a:hover {
    text-decoration: underline;
}

.rep-category span {
    font-weight: 600;
    color: black;
}

/* Address multi-line */
.rep-address span {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .mapbox-sales-map-container {
        padding: 0 1.5rem;
    }
    
    .map-container {
        height: 400px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 0 1.5rem;
    }

    .rep-cards-grid {
        grid-template-columns: 1fr;
        padding: 0 1.5rem;
    }

    .rep-card-details {
        grid-template-columns: 1fr;
    }

    .distributor-card .rep-card-logo {
        width: unset;
    }

    .distributor-card .rep-company-name {
        font-size: 28px;
    }

    .factory-rep-card .rep-photo {
        width: 150px;
        height: 150px;
    }

    .factory-rep-card .rep-name {
        font-size: 28px;
    }

    .factory-rep-card .rep-contact-person {
        font-size: 22px;
        letter-spacing: 3px;
    }

    .factory-rep-card .rep-service-area {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .rep-card .rep-card-header {
        flex-direction: column;
    }
}
