/* ==========================================================================
   Plate Sales Map - Interactive Sales Representative Map
   ========================================================================== */

.psm-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    font-family: inherit;
}

/* ---------- Tabs ---------- */

.psm-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    border-bottom: 2px solid #e5e7eb;
}

.psm-tab {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: -2px;
}

.psm-tab:hover {
    color: #fff;
    background: #1f2937;
    border-bottom-color: #ef4444;
}

.psm-tab.active {
    color: #fff;
    background: #1f2937;
    border-bottom-color: #ef4444;
}

.psm-tab-content {
    display: none;
}

.psm-tab-content.active {
    display: block;
}

/* ---------- Map + Panel Layout ---------- */

.psm-map-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    align-items: start;
}

/* ---------- Map Container (simplemaps) ---------- */

.psm-map-container {
    position: relative;
    background: #f9fafb;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.psm-simplemaps-target {
    width: 100%;
    min-height: 400px;
}

.psm-simplemaps-target a[href="https://simplemaps.com"],
.psm-simplemaps-target a[href="https://simplemaps.com"][title*="Trial"],
.psm-simplemaps-target div:has(> a[href="https://simplemaps.com"]) {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    clip: rect(0,0,0,0) !important;
    pointer-events: none !important;
}

/* ---------- Legend ---------- */

.psm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 20px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.psm-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.psm-legend-item:hover {
    opacity: 0.7;
}

.psm-legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.psm-legend-label {
    font-weight: 500;
}

.psm-legend-rep {
    color: #6b7280;
    font-size: 13px;
}

/* ---------- Panel Close Button (mobile) ---------- */

.psm-panel-close {
    display: none;
}

/* ---------- Contact Panel (sidebar) ---------- */

.psm-panel {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.psm-panel.psm-panel-active {
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.psm-panel-placeholder {
    padding: 40px 24px;
    text-align: center;
    color: #9ca3af;
}

.psm-panel-placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.psm-panel-placeholder p {
    font-size: 15px;
    line-height: 1.5;
}

/* Panel header with region color stripe */
.psm-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: none;
}

.psm-panel-header.visible {
    display: block;
}

.psm-panel-region-stripe {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    margin-bottom: 12px;
}

.psm-panel-region-name {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0;
}

.psm-panel-state-name {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 4px 0 0;
}

/* Panel body */
.psm-panel-body {
    padding: 24px;
    display: none;
}

.psm-panel-body.visible {
    display: block;
}

.psm-panel-rep-name {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 4px;
}

.psm-panel-rep-title {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px;
}

.psm-panel-contact-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.psm-panel-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.psm-panel-contact-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.psm-panel-contact-icon svg {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.psm-panel-contact-item a {
    color: #2563EB;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
}

.psm-panel-contact-item a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Territory list in panel */
.psm-panel-territory {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.psm-panel-territory-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0 0 10px;
}

.psm-panel-territory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.psm-panel-territory-tag {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    background: #f3f4f6;
    color: #374151;
}

.psm-panel-territory-tag.current {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}


/* ---------- Contact Form in Panel ---------- */

.psm-panel-form-wrapper {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.psm-panel-form-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0 0 12px;
}

.psm-panel-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.psm-form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.psm-panel-form input[type="text"],
.psm-panel-form input[type="email"],
.psm-panel-form input[type="tel"],
.psm-panel-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #1f2937;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.psm-panel-form input:focus,
.psm-panel-form textarea:focus {
    outline: none;
    border-color: #2563EB;
    background: #fff;
}

.psm-panel-form textarea {
    resize: vertical;
    min-height: 70px;
}

.psm-form-submit {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #1f2937;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.psm-form-submit:hover {
    background: #374151;
}

.psm-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.psm-form-status {
    font-size: 13px;
    min-height: 20px;
}

.psm-form-status.success {
    color: #059669;
}

.psm-form-status.error {
    color: #DC2626;
}

/* ---------- International Section ---------- */

.psm-international {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 60px 24px;
}

.psm-international-icon {
    width: 72px;
    height: 72px;
    background: #f0f9ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.psm-international-icon svg {
    width: 32px;
    height: 32px;
    color: #0891B2;
}

.psm-international-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px;
}

.psm-international-message {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 28px;
}

.psm-international-contacts {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.psm-international-contact {
    display: flex;
    align-items: center;
    gap: 10px;
}

.psm-international-contact-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f0f9ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psm-international-contact-icon svg {
    width: 20px;
    height: 20px;
    color: #0891B2;
}

.psm-international-contact a {
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s;
}

.psm-international-contact a:hover {
    color: #0891B2;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .psm-map-layout {
        grid-template-columns: 1fr;
    }

    .psm-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.15);
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 70vh;
        overflow-y: auto;
    }

    .psm-panel.psm-panel-active {
        transform: translateY(0);
    }

    .psm-panel-placeholder {
        display: none;
    }

    .psm-panel-close {
        display: block;
        position: sticky;
        top: 0;
        float: right;
        margin: 12px 12px 0 0;
        width: 36px;
        height: 36px;
        border: none;
        background: #f3f4f6;
        border-radius: 50%;
        font-size: 22px;
        line-height: 1;
        color: #6b7280;
        cursor: pointer;
        z-index: 10;
    }

    .psm-panel-close:hover {
        background: #e5e7eb;
        color: #1f2937;
    }

    /* Hide simplemaps "View Website" link on mobile, keep state name */
    .tt_sm a {
        display: none !important;
    }
}

@media (max-width: 600px) {
    .psm-tabs {
        flex-direction: column;
        gap: 0;
    }

    .psm-tab {
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
        border-left: 3px solid transparent;
        margin-bottom: 0;
    }

    .psm-tab.active {
        border-bottom-color: #e5e7eb;
        border-left-color: #ef4444;
        background: #1f2937;
        color: #fff;
    }

    .psm-legend {
        flex-direction: column;
        gap: 10px;
    }

    .psm-international-contacts {
        flex-direction: column;
        align-items: center;
    }
}
