/* ============================================================
   GS Agent Profiles & License Manager — Frontend Styles
   Colors: Navy #008CD1 | Gold #CEB456 | Gold tint #F8F4E8
   ============================================================ */

/* ── AGENT PROFILES GRID ──────────────────────────────────── */

.gs-profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.gs-profile-card {
    background: #F8F4E8;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.gs-profile-card:hover {
    box-shadow: 0 6px 28px rgba(0,0,0,0.13);
}

/* Card header — always visible */
.gs-profile-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    cursor: pointer;
    background: #F8F4E8;
    transition: background 0.15s;
}

.gs-profile-card-header:hover {
    background: #f0ead4;
}

.gs-profile-avatar {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #008CD1;
}

.gs-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gs-profile-initials {
    width: 100%;
    height: 100%;
    background: #008CD1;
    color: #CEB456;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-profile-card-info {
    flex: 1;
    min-width: 0;
}

.gs-profile-name {
    font-size: 16px;
    font-weight: 800;
    color: #008CD1;
    margin-bottom: 3px;
}

.gs-profile-role {
    font-size: 12px;
    color: #CEB456;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}

.gs-profile-states {
    font-size: 11px;
    color: #888;
}

.gs-profile-toggle {
    flex-shrink: 0;
    color: #008CD1;
    font-size: 14px;
    transition: transform 0.2s;
}

.gs-profile-card.gs-expanded .gs-profile-toggle {
    transform: rotate(180deg);
}

/* Expanded section */
.gs-profile-expanded {
    border-top: 2px solid #008CD1;
}

.gs-profile-expanded-inner {
    display: flex;
    gap: 20px;
    padding: 22px;
    flex-wrap: wrap;
}

.gs-profile-expanded-photo {
    flex-shrink: 0;
}

.gs-profile-expanded-photo img {
    width: 120px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #CEB456;
}

.gs-profile-expanded-content {
    flex: 1;
    min-width: 200px;
}

.gs-profile-bio {
    color: #555;
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 14px;
}

.gs-profile-specialties {
    margin-bottom: 14px;
}

.gs-profile-specialties strong {
    color: #008CD1;
    font-size: 13px;
    display: block;
    margin-bottom: 6px;
}

.gs-specialty-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gs-specialty-pill {
    background: #008CD1;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.gs-profile-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.gs-contact-btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.15s;
}

.gs-contact-btn:hover { opacity: 0.85; }

.gs-btn-phone {
    background: #008CD1;
    color: #fff;
}

.gs-btn-email {
    background: #CEB456;
    color: #008CD1;
}

.gs-btn-appt {
    background: #2E7D32;
    color: #fff;
}

.gs-profile-licensed-states {
    font-size: 13px;
    color: #555;
}

.gs-profile-licensed-states strong {
    color: #008CD1;
    margin-right: 4px;
}

/* ── LICENSE MAP ──────────────────────────────────────────── */

.gs-license-map-wrap {
    position: relative;
    margin-bottom: 40px;
    padding-top: 16px;
}

.gs-map-intro {
    text-align: center;
    margin-bottom: 16px;
}

.gs-map-intro p {
    color: #008CD1;
    font-size: 16px;
    font-weight: 600;
    max-width: 100%;
    margin: 0 auto;
    line-height: 1.7;
}

.gs-map-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* SVG States */
.gs-map-svg {
    width: 100%;
    height: auto;
    display: block;
}

.gs-map-state {
    fill: #F8F4E8;
    stroke: #008CD1;
    stroke-width: 1.5;
    cursor: default;
    transition: fill 0.15s;
}

.gs-map-state.gs-state-licensed {
    fill: #B09A3E;
    cursor: pointer;
}

.gs-map-state.gs-state-licensed:hover {
    fill: #8C7A2E;
}

.gs-map-state.gs-state-active {
    fill: #CEB456;
}

.gs-map-label {
    font-size: 10px;
    font-weight: 700;
    fill: #ffffff;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* Labels on inactive states */
.gs-map-state:not(.gs-state-licensed) + .gs-map-label,
.gs-map-label[data-licensed="false"] {
    fill: #666;
}

/* Map popup */
.gs-map-popup {
    position: absolute;
    z-index: 100;
    background: #fff;
    border: 2px solid #008CD1;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    width: 300px;
    max-width: 90%;
    overflow: hidden;
}

.gs-map-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #008CD1;
}

.gs-map-popup-title {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
}

.gs-map-popup-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.gs-map-popup-close:hover { opacity: 1; }

.gs-map-popup-body {
    padding: 14px 16px;
}

.gs-popup-loading {
    text-align: center;
    color: #888;
    font-size: 13px;
    padding: 8px 0;
}

/* Popup agent card */
.gs-popup-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.gs-popup-agent:last-child { border-bottom: none; }

.gs-popup-agent-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #CEB456;
    flex-shrink: 0;
}

.gs-popup-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gs-popup-initials {
    width: 100%;
    height: 100%;
    background: #008CD1;
    color: #CEB456;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-popup-agent-info { flex: 1; }

.gs-popup-agent-name {
    font-size: 14px;
    font-weight: 700;
    color: #008CD1;
    margin-bottom: 2px;
}

.gs-popup-agent-role {
    font-size: 11px;
    color: #CEB456;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.gs-popup-license {
    font-size: 11px;
    color: #888;
}

/* ── LICENSE TABLES ───────────────────────────────────────── */

.gs-license-tables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.gs-license-agent-block {
    background: #F8F4E8;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    overflow: hidden;
}

.gs-license-agent-header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #008CD1;
    padding: 16px 20px;
}

.gs-license-agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #CEB456;
    flex-shrink: 0;
}

.gs-license-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gs-license-initials {
    width: 100%;
    height: 100%;
    background: #0070A8;
    color: #CEB456;
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-license-agent-name {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
}

.gs-license-agent-role {
    font-size: 11px;
    color: #CEB456;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.gs-license-state-table {
    width: 100%;
    border-collapse: collapse;
}

.gs-license-state-table th {
    background: #0070A8;
    color: #CEB456;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 10px 16px;
    text-align: left;
}

.gs-license-state-table td {
    padding: 10px 16px;
    font-size: 13px;
    color: #444;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.gs-license-state-table tr:last-child td {
    border-bottom: none;
}

.gs-license-state-table tr:hover td {
    background: rgba(209,178,0,0.07);
}

/* ── MAP LEGEND ───────────────────────────────────────────── */

.gs-map-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.gs-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}

.gs-legend-swatch {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* ── RESPONSIVE ───────────────────────────────────────────── */

@media (max-width: 600px) {
    .gs-profiles-grid {
        grid-template-columns: 1fr;
    }
    .gs-license-tables {
        grid-template-columns: 1fr;
    }
    .gs-map-popup {
        width: 260px;
        left: 50% !important;
        transform: translateX(-50%);
    }
    .gs-profile-expanded-inner {
        flex-direction: column;
    }
    .gs-profile-expanded-photo img {
        width: 100%;
        height: 180px;
    }
}

/* ============================================================
   AGENT PROFILE MODAL
   ============================================================ */

#gs-agent-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#gs-agent-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

#gs-agent-modal-box {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    border-top: 5px solid #CEB456;
}

#gs-agent-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 26px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    font-family: Arial, sans-serif;
    transition: color 0.15s;
    z-index: 2;
}
#gs-agent-modal-close:hover { color: #008CD1; }

body.gs-modal-open { overflow: hidden; }

/* Modal header */
.gs-modal-header {
    background: #008CD1;
    padding: 28px 28px 22px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.gs-modal-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #CEB456;
    flex-shrink: 0;
}
.gs-modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gs-modal-initials {
    width: 100%;
    height: 100%;
    background: #0070A8;
    color: #CEB456;
    font-size: 28px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-modal-name {
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}
.gs-modal-role {
    color: #CEB456;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}
.gs-modal-states {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    line-height: 1.6;
}

/* Modal body sections */
#gs-agent-modal-content > *:not(.gs-modal-header) {
    padding: 0 28px;
}

.gs-modal-bio {
    color: #444;
    font-size: 14px;
    line-height: 1.8;
    padding-top: 22px !important;
    padding-bottom: 4px !important;
}

.gs-modal-specialties {
    padding-top: 18px !important;
    padding-bottom: 4px !important;
}
.gs-modal-section-label {
    font-size: 11px;
    font-weight: 800;
    color: #008CD1;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}
.gs-modal-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.gs-modal-pill {
    background: #E5F4FB;
    color: #008CD1;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #008CD1;
}

/* Modal contact buttons */
.gs-modal-contact {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 20px !important;
    padding-bottom: 28px !important;
    border-top: 1px solid #E0E0E0;
    margin-top: 18px;
}
.gs-modal-btn {
    flex: 1 1 140px;
    min-width: 0;
    text-align: center;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    font-family: Arial, sans-serif;
    transition: background 0.15s;
    word-break: break-all;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}
.gs-modal-btn-phone {
    background: #008CD1;
    color: #ffffff;
}
.gs-modal-btn-phone:hover { background: #0070A8; color: #ffffff; }
.gs-modal-btn-email {
    background: #F8F4E8;
    color: #008CD1;
    border: 2px solid #CEB456;
}
.gs-modal-btn-email:hover { background: #CEB456; color: #008CD1; }
.gs-modal-btn-appt {
    background: #2E7D32;
    color: #ffffff;
    flex-basis: 100%;
    text-align: center;
}
.gs-modal-btn-appt:hover { background: #1B5E20; color: #ffffff; }

/* Mobile */
@media (max-width: 560px) {
    #gs-agent-modal-box { border-radius: 10px; }
    .gs-modal-header { padding: 20px; gap: 14px; }
    .gs-modal-avatar { width: 68px; height: 68px; }
    .gs-modal-name { font-size: 18px; }
    #gs-agent-modal-content > *:not(.gs-modal-header) { padding: 0 18px; }
    .gs-modal-contact { padding-bottom: 20px !important; }
}

/* ============================================================
   AGENT HUB — Frontend Profile Editor
   ============================================================ */

.gs-hub-wrap {
    max-width: 760px;
    margin: 0 auto;
    font-family: Arial, sans-serif;
}

/* Notices */
.gs-hub-notice {
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.gs-hub-notice-success {
    background: #E8F5E9;
    border: 2px solid #2E7D32;
    color: #1B5E20;
}
.gs-hub-notice-warn {
    background: #FFF8E1;
    border: 2px solid #CEB456;
    color: #6B4E00;
}

/* Header */
.gs-hub-header {
    background: #008CD1;
    border-radius: 12px;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
    border-bottom: 4px solid #CEB456;
}
.gs-hub-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #CEB456;
    flex-shrink: 0;
}
.gs-hub-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gs-hub-initials {
    width: 100%;
    height: 100%;
    background: #0070A8;
    color: #CEB456;
    font-size: 24px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gs-hub-agent-name { color: #fff; font-size: 20px; font-weight: 800; margin-bottom: 3px; }
.gs-hub-agent-role { color: #CEB456; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }
.gs-hub-agent-since { color: rgba(255,255,255,0.7); font-size: 13px; }

/* Sections */
.gs-hub-section {
    background: #fff;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.gs-hub-section-head {
    background: #008CD1;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 20px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.gs-hub-section-body {
    padding: 20px;
}
.gs-hub-body-hint {
    color: #888;
    font-size: 13px;
    margin: 0 0 14px;
    line-height: 1.6;
}

/* Fields */
.gs-hub-field { margin-bottom: 16px; }
.gs-hub-field:last-child { margin-bottom: 0; }
.gs-hub-field-row { margin-bottom: 0; }
.gs-hub-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.gs-hub-field label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: #008CD1;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 6px;
}
.gs-hub-hint {
    color: #aaa;
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
}
.gs-hub-field input[type="text"],
.gs-hub-field input[type="tel"],
.gs-hub-field input[type="email"],
.gs-hub-field textarea,
.gs-hub-field select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #E0E0E0;
    border-radius: 6px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.gs-hub-field input:focus,
.gs-hub-field textarea:focus,
.gs-hub-field select:focus { border-color: #008CD1; }
.gs-hub-field textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* Photo preview */
.gs-hub-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #CEB456;
    flex-shrink: 0;
}
.gs-hub-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.gs-hub-photo-placeholder {
    width: 100%;
    height: 100%;
    background: #008CD1;
    color: #CEB456;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* License table */
.gs-hub-license-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    font-size: 14px;
}
.gs-hub-license-table th {
    background: #F8F4E8;
    color: #008CD1;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #CEB456;
}
.gs-hub-license-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #F0F0F0;
    vertical-align: middle;
}
.gs-hub-license-table select,
.gs-hub-license-table input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #E0E0E0;
    border-radius: 6px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    outline: none;
    transition: border-color 0.15s;
}
.gs-hub-license-table select:focus,
.gs-hub-license-table input:focus { border-color: #008CD1; }

/* Buttons */
.gs-hub-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    font-family: Arial, sans-serif;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background 0.15s;
}
.gs-hub-btn-add {
    background: #E5F4FB;
    color: #008CD1;
    border: 2px solid #008CD1;
}
.gs-hub-btn-add:hover { background: #008CD1; color: #fff; }
.gs-hub-btn-remove {
    background: none;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    transition: all 0.15s;
}
.gs-hub-btn-remove:hover { background: #e74c3c; color: #fff; }
.gs-hub-btn-secondary {
    background: #F8F4E8;
    color: #008CD1;
    border: 2px solid #CEB456;
    padding: 8px 16px;
    font-size: 13px;
}
.gs-hub-btn-secondary:hover { background: #CEB456; color: #008CD1; }

/* Save row */
.gs-hub-save-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
    margin-bottom: 24px;
}
.gs-hub-btn-save {
    background: #CEB456;
    color: #008CD1;
    font-size: 16px;
    padding: 14px 32px;
}
.gs-hub-btn-save:hover { background: #B09A3E; }
.gs-hub-save-note { color: #888; font-size: 13px; }

/* Preview links */
.gs-hub-preview-note {
    background: #F8F4E8;
    border: 1px solid #CEB456;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 13px;
    color: #555;
    text-align: center;
    margin-bottom: 40px;
}
.gs-hub-preview-note a { color: #008CD1; font-weight: 700; }

/* Mobile */
@media (max-width: 560px) {
    .gs-hub-two-col { grid-template-columns: 1fr; }
    .gs-hub-header { padding: 18px; gap: 14px; }
    .gs-hub-section-body { padding: 16px; }
    .gs-hub-save-row { flex-direction: column; align-items: flex-start; }
}
