/* GLOBAL PRESENCE — CSS isolation
   Some WordPress themes apply aggressive global styles to form controls and buttons.
   We keep the widget visually consistent by resetting ONLY our UI elements. */
.gp-presence, .gp-presence * { box-sizing: border-box; }

.gp-presence {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: #0f172a;
}

.gp-presence__header,
.gp-presence__panel,
.gp-presence__detail,
.gp-presence__status,
.gp-presence__brand,
.gp-item {
  font-family: inherit !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

.gp-presence .gp-control {
  all: unset !important;
  box-sizing: border-box !important;
  font: inherit !important;
  color: inherit !important;
  display: block !important;
  width: 100% !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
}

.gp-presence .gp-select {
  padding: 10px 12px !important;
  cursor: pointer !important;
}

.gp-presence .gp-input {
  padding: 10px 12px !important;
}

.gp-presence .gp-control:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.45) !important;
  outline-offset: 2px !important;
}


.gp-presence {
    width: 100%;
    max-width: 100%;
    margin: 16px 0;

    height: 60dvh;
    max-height: 60dvh;

    --gp-bg: #f7f9fc;
    --gp-card: #ffffff;
    --gp-line: rgba(15, 23, 42, 0.1);
    --gp-text: #0f172a;
    --gp-sub: rgba(15, 23, 42, 0.64);
    --gp-accent: #2563eb;
    --gp-accent2: #7c3aed;

    background: var(--gp-bg);
    color: var(--gp-text);
    border: 1px solid var(--gp-line);
    border-radius: 14px;
    overflow: hidden;

    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);

    /* Isolation: keep the widget identical across themes */
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Arial;
    font-size: 14px !important;
    line-height: 1.4;
}

.gp-presence * {
    box-sizing: border-box;
}

/* Hard reset against hostile themes (keeps typography consistent across WP installs) */
.gp-presence :where(h1,h2,h3,h4,h5,h6,p,ul,ol,li){
    margin: 0;
    padding: 0;
    text-transform: none;
    letter-spacing: normal;
}
.gp-presence :where(button,input,select,textarea){
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.gp-presence :where(button){
    -webkit-appearance: none;
    appearance: none;
}

.gp-presence__header {
    display: grid !important;
    grid-template-columns: 220px 220px 1fr !important;
    gap: 12px !important;
    padding: 16px !important;
    align-items: center !important;
    border-bottom: 1px solid var(--gp-line) !important;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(10px) !important;
}

@media (max-width: 780px) {
  .gp-presence__header {
    grid-template-columns: 1fr !important;
  }
}

/* Allow header to wrap cleanly on small screens */
.gp-presence__header {
    flex-wrap: wrap;
}

.gp-presence__header select,
.gp-presence__header input {
    height: 42px !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: var(--gp-text) !important;
    padding: 0 12px !important;
    outline: none !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}

.gp-presence__header select {
    min-width: 170px;
}
.gp-presence__header input {
    flex: 1;
    min-width: 200px;
}
.gp-presence__header select:disabled {
    opacity: 0.45;
}

/* Layout: MAP bigger than panel */
.gp-presence__body {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px; /* MAP | PANEL */
}

.gp-presence__map {
    min-height: 520px;
    position: relative;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.04), rgba(255, 255, 255, 0));
}

.gp-map-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 22px;
    color: var(--gp-text);
    background: rgba(255, 255, 255, 0.92);
}
.gp-map-error__title {
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 0.2px;
}
.gp-map-error__msg {
    margin-top: 8px;
    color: #b91c1c;
    font-weight: 800;
}
.gp-map-error__hint {
    margin-top: 10px;
    color: var(--gp-sub);
    font-size: 12px;
    line-height: 1.35;
    max-width: 560px;
}

/* Panel */
.gp-presence__panel {
    border-left: 1px solid var(--gp-line);
    background: rgba(255, 255, 255, 0.92);
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.gp-presence__status {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gp-line);
    font-size: 13px;
}
.gp-presence__status[data-kind="error"] {
    color: #b91c1c;
    background: rgba(185, 28, 28, 0.06);
}
.gp-presence__status[data-kind="info"] {
    color: var(--gp-sub);
}

.gp-presence__list {
    padding: 12px;
    overflow: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/*
  IMPORTANT: many WP themes aggressively style button/input elements (font-size,
  line-height, text-transform, border-radius, padding). Our list items are
  rendered as <button>, so we hard-reset the appearance to keep the UI identical
  across installations.
*/
.gp-item {
    -webkit-appearance: none !important;
    appearance: none !important;
    font: inherit !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 12px 12px !important;
    cursor: pointer !important;
    border-radius: 12px !important;
    text-align: left !important;
    width: 100% !important;
    display: block !important;
    transition:
        transform 0.12s ease,
        border-color 0.12s ease,
        box-shadow 0.12s ease;
}
.gp-item:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.gp-item.is-active {
    border-color: rgba(37, 99, 235, 0.65);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.14);
}


.gp-item__title {
    font-weight: 800 !important;
    color: var(--gp-text);
    font-size: 14px !important;
    line-height: 1.25 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.gp-item__sub {
    margin-top: 6px;
    color: var(--gp-sub);
    font-size: 12px !important;
    line-height: 1.35 !important;
}

/* Detail area */
.gp-presence__detail {
    padding: 20px;
    border-top: 1px solid var(--gp-line);
    background: rgba(248, 250, 252, 0.9);
    max-height: 40%;
    overflow: auto;
    padding-bottom: 60px;
}

.gp-detail--placeholder {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gp-zone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--gp-sub);
}
.gp-zone b {
    color: var(--gp-text);
    font-weight: 900;
}

.gp-detail__hint {
    color: var(--gp-sub);
    font-size: 12.5px;
    line-height: 1.35;
}
.gp-detail__img {
    width: 100%;
    height: 120px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(15, 23, 42, 0.08);
    margin-bottom: 10px;
}
.gp-detail__title {
    font-weight: 900;
    color: var(--gp-text);
    font-size: 15px;
}
.gp-detail__text {
    margin-top: 8px;
    color: var(--gp-sub);
    font-size: 12.5px;
    line-height: 1.45;
}

.gp-detail__rows {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}
.gp-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--gp-sub);
    font-size: 12.5px;
}
.gp-row b,
.gp-row a {
    color: var(--gp-text);
    font-weight: 800;
    text-decoration: none;
    text-align: right;
}
.gp-row a {
    border-bottom: 1px solid rgba(37, 99, 235, 0.25);
}

.gp-detail__actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.gp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}
.gp-btn:hover {
    background: rgba(37, 99, 235, 0.16);
}

.gp-btn--ghost {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.12);
    color: var(--gp-text);
}

/* Cluster detail */
.gp-cluster-head__title {
    font-weight: 900;
    color: var(--gp-text);
}
.gp-cluster-head__sub {
    margin-top: 4px;
    color: var(--gp-sub);
    font-size: 12.5px;
}
.gp-cluster-list {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

/* Empty + Skeleton */
.gp-empty {
    padding: 14px;
    border: 1px dashed rgba(15, 23, 42, 0.16);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
}
.gp-empty__title {
    color: var(--gp-text);
    font-weight: 900;
}
.gp-empty__sub {
    margin-top: 6px;
    color: var(--gp-sub);
    font-size: 12px;
    line-height: 1.4;
}

.gp-skel {
    padding: 6px;
}
.gp-skel__line {
    height: 14px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.06);
    margin: 10px 0;
    animation: ocmPulse 1.1s ease-in-out infinite;
    border-radius: 10px;
}
@keyframes ocmPulse {
    0%,
    100% {
        opacity: 0.55;
    }
    50% {
        opacity: 1;
    }
}

.gp-presence__brand {
    padding: 10px 12px;
    font-size: 12px;
    color: rgba(15, 23, 42, 0.55);
}
.gp-presence__brand a {
    color: var(--gp-text);
    text-decoration: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.18);
}

/* Responsive */
@media (max-width: 980px) {
    .gp-presence__body {
        grid-template-columns: 1fr;
    }
    .gp-presence__panel {
        border-left: none;
        border-top: 1px solid var(--gp-line);
    }
    .gp-presence__map {
        min-height: 420px;
    }
}


/* Marker label className used in JS */
.gp-marker-label {
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Arial;
    letter-spacing: 0.2px;
    text-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
}

/* Header selects a bit tighter */
.gp-presence__header select {
    min-width: 150px;
}

/* Cluster header with close button */
.gp-cluster-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.gp-cluster-head__left {
    min-width: 0;
}
.gp-cluster-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.9);
    color: rgba(15, 23, 42, 0.75);
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}
.gp-cluster-close:hover {
    background: rgba(15, 23, 42, 0.04);
}

/* Google Maps InfoWindow content */
.gm-style .gp-iw {
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        "Segoe UI Variable",
        "Segoe UI",
        Roboto,
        Arial;
    padding: 14px 14px 12px;
    min-width: 260px;
    max-width: 340px;
    color: #0f172a;
}
.gm-style .gp-iw__head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.gm-style .gp-iw__thumb {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    overflow: hidden;
    flex: 0 0 auto;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.10);
}
.gm-style .gp-iw__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gm-style .gp-iw__thumb--ph {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(34, 197, 94, 0.10));
}
.gm-style .gp-iw__headText {
    min-width: 0;
}
.gm-style .gp-iw__title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: 0.1px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.gm-style .gp-iw__sub {
    margin-top: 4px;
    color: rgba(15, 23, 42, 0.60);
    font-size: 11px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.gm-style .gp-iw__meta {
    margin-top: 12px;
    color: rgba(15, 23, 42, 0.74);
    font-size: 12px;
    line-height: 1.42;
}
.gm-style .gp-iw__actions {
    margin-top: 14px;
    display: flex;
}
.gm-style .gp-iw__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(37, 99, 235, 0.28);
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-decoration: none;
    width: 100%;
}

.gm-style .gp-iw__btn:hover {
    background: rgba(37, 99, 235, 0.16);
}

/* List click ping */
.gp-item.is-ping {
    animation: ocmPing 260ms ease;
}

@keyframes ocmPing {
    from {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 rgba(37, 99, 235, 0);
    }
    50% {
        transform: translateY(-1px) scale(1.01);
        box-shadow: 0 16px 40px rgba(37, 99, 235, 0.18);
    }
    to {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 rgba(37, 99, 235, 0);
    }
}
/* Ensure cluster/pin SVG icons stay clean (no theme shadows) */
.gm-style img {
    box-shadow: none !important;
    filter: none !important;
}
/* Chrome InfoWindow: zero padding + rounding pulito */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14) !important;
}

/* Contenitore interno che Google usa */
.gm-style .gm-style-iw-d {
    overflow: hidden !important;
    padding: 0 !important;
}

/* (opzionale) riduci la X */
.gm-style button.gm-ui-hover-effect {
    top: 8px !important;
    right: 8px !important;
    opacity: 0.65;
}
.gm-style button.gm-ui-hover-effect:hover {
    opacity: 1;
}

/* Detail header with close button */
.gp-detail__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.gp-detail-close{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,0.12);
  background:rgba(255,255,255,0.9);
  color:rgba(15,23,42,0.75);
  font-size:20px;
  font-weight:900;
  line-height:1;
  cursor:pointer;
  display:grid;
  place-items:center;
  padding:0;
  flex:0 0 auto;
  flex:0 0 auto;
}
.gp-detail-close:hover{ background: rgba(15,23,42,0.04); }

/* -------------------------
   Agent dedicated page
   ------------------------- */
.gp-agent-page {
  padding: 28px 16px;
}
.gp-agent-container {
  max-width: 1080px;
  margin: 0 auto;
}
.gp-agent-header {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.gp-agent-title {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}
.gp-agent-h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 950;
  color: #0f172a;
}
.gp-agent-tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.gp-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(37, 99, 235, 0.06);
  color: rgba(15,23,42,0.78);
  font-weight: 800;
  font-size: 12.5px;
}
.gp-agent-thumb img {
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}
.gp-agent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.gp-agent-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}
.gp-agent-h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 950;
}
.gp-agent-dl {
  margin: 0;
}
.gp-agent-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(15,23,42,0.08);
}
.gp-agent-row:first-child { border-top: 0; padding-top: 0; }
.gp-agent-row dt {
  color: rgba(15,23,42,0.55);
  font-weight: 850;
}
.gp-agent-row dd {
  margin: 0;
  color: rgba(15,23,42,0.86);
  font-weight: 750;
}
.gp-agent-row a {
  color: #1d4ed8;
  text-decoration: none;
  border-bottom: 1px solid rgba(29,78,216,0.18);
}
.gp-agent-content {
  color: rgba(15,23,42,0.82);
  line-height: 1.55;
}
.gp-agent-back {
  margin-top: 16px;
}
.gp-agent-backlink {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.12);
  background: rgba(15,23,42,0.04);
  color: rgba(15,23,42,0.8);
  text-decoration: none;
  font-weight: 900;
}
.gp-agent-backlink:hover { background: rgba(15,23,42,0.07); }

@media (max-width: 980px) {
  .gp-agent-header { grid-template-columns: 1fr; }
  .gp-agent-grid { grid-template-columns: 1fr; }
}


.gp-presence__header .gp-control { min-width: 0 !important; }
