@import url('./mobile-responsive.css');
@import url('./modules/sales-workspace-mobile.css');

/* State hover must win over Leaflet grab cursor */
        body.map-hovering,
        body.map-hovering #map,
        body.map-hovering .leaflet-container,
        body.map-hovering .leaflet-interactive,
        body.map-hovering path,
        .leaflet-container.is-state-hover,
        .leaflet-container.is-state-hover *,
        .leaflet-container.is-state-hover .leaflet-interactive,
        .leaflet-container.is-state-hover path {
            cursor: pointer !important;
        }
        
        .leaflet-container {
            cursor: grab;
        }
        .leaflet-container.leaflet-grabbing {
            cursor: grabbing !important;
        }
        .panel-busy-overlay {
            position: absolute;
            inset: 0;
            z-index: 910;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: rgba(3, 8, 20, 0.58);
            backdrop-filter: blur(6px);
        }
        .panel-busy-card {
            width: min(430px, 100%);
            padding: 24px 26px;
            border-radius: 22px;
            border: 1px solid rgba(96, 165, 250, 0.2);
            background: linear-gradient(180deg, rgba(11, 19, 35, 0.96) 0%, rgba(9, 15, 28, 0.94) 100%);
            box-shadow: 0 30px 90px rgba(2, 6, 23, 0.45);
        }
        .panel-busy-line {
            display: flex;
            align-items: center;
            gap: 16px;
        }
        .panel-busy-spinner {
            width: 42px;
            height: 42px;
            flex-shrink: 0;
            border-radius: 999px;
            border: 3px solid rgba(96, 165, 250, 0.16);
            border-top-color: var(--noc-accent);
            box-shadow: 0 0 28px rgba(59, 130, 246, 0.25);
            animation: panelBusySpin .85s linear infinite;
        }
        .panel-busy-kicker {
            margin-bottom: 6px;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 1.4px;
            text-transform: uppercase;
            color: rgba(96, 165, 250, 0.84);
        }
        .panel-busy-title {
            display: block;
            margin-bottom: 4px;
            font-size: 1rem;
            font-weight: 700;
            color: var(--noc-text);
        }
        .panel-busy-text {
            color: var(--noc-muted);
            font-size: 0.92rem;
            line-height: 1.5;
        }
        .filter-label-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .filter-help-trigger {
            position: relative;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 18px;
            height: 18px;
            border-radius: 999px;
            border: 1px solid rgba(96, 165, 250, 0.28);
            background: rgba(15, 23, 42, 0.92);
            color: #93c5fd;
            font-size: 11px;
            font-weight: 700;
            line-height: 1;
            cursor: pointer;
            transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
        }
        .filter-help-trigger:hover,
        .filter-help-trigger:focus-visible,
        .filter-help-trigger.is-open {
            outline: none;
            transform: translateY(-1px);
            border-color: rgba(96, 165, 250, 0.65);
            background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(59, 130, 246, 0.14));
            color: #dbeafe;
        }
        .filter-help-text {
            margin-top: 8px;
        }
        .filter-help-text.is-muted {
            display: none;
        }
        .filter-guidance-card {
            display: none;
            margin-top: 12px;
            padding: 12px 12px 11px;
            border-radius: 16px;
            border: 1px solid rgba(96, 165, 250, 0.22);
            background:
                linear-gradient(180deg, rgba(13, 20, 34, 0.94), rgba(10, 16, 28, 0.96)),
                radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 56%);
            box-shadow: 0 14px 36px rgba(2, 8, 23, 0.26);
            transform: translateY(6px);
            opacity: 0;
        }
        .filter-guidance-card.is-visible {
            display: block;
            animation: filterGuidanceReveal 220ms ease forwards;
        }
        .filter-guidance-kicker {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 6px;
            color: #93c5fd;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
        }
        .filter-guidance-title {
            margin: 0 0 4px;
            color: #eff6ff;
            font-size: 13px;
            font-weight: 700;
            line-height: 1.35;
        }
        .filter-guidance-body {
            margin: 0;
            color: #c7d2e8;
            font-size: 12px;
            line-height: 1.45;
        }
        .filter-guidance-step {
            margin-top: 8px;
            color: #dbeafe;
            font-size: 11px;
            font-weight: 600;
            line-height: 1.4;
        }
        .filter-guidance-actions {
            display: flex;
            gap: 10px;
            margin-top: 12px;
            flex-wrap: wrap;
        }
        .filter-guidance-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            min-height: 36px;
            padding: 0 14px;
            border-radius: 12px;
            border: 1px solid rgba(96, 165, 250, 0.22);
            background: rgba(15, 23, 42, 0.74);
            color: #dbeafe;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
        }
        .filter-guidance-btn:hover,
        .filter-guidance-btn:focus-visible {
            outline: none;
            transform: translateY(-1px);
            border-color: rgba(96, 165, 250, 0.52);
            background: rgba(30, 41, 59, 0.88);
        }
        .filter-guidance-btn-primary {
            background: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(59, 130, 246, 0.84));
            border-color: rgba(96, 165, 250, 0.45);
            color: #eff6ff;
        }
        .filter-guidance-btn-primary:hover,
        .filter-guidance-btn-primary:focus-visible {
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.96), rgba(96, 165, 250, 0.9));
        }
        .filter-input-group.is-guidance-target label {
            color: #dbeafe;
        }
        .filter-input-group.is-guidance-target .ts-control,
        .filter-input-group.is-guidance-target select {
            border-color: rgba(96, 165, 250, 0.72) !important;
            box-shadow:
                0 0 0 3px rgba(59, 130, 246, 0.18),
                0 0 0 1px rgba(96, 165, 250, 0.22) inset,
                0 0 24px rgba(59, 130, 246, 0.18);
        }
        .filter-input-group.is-guidance-target::after {
            content: 'Comece por aqui';
            display: inline-flex;
            align-items: center;
            margin-top: 8px;
            padding: 5px 10px;
            border-radius: 999px;
            background: rgba(37, 99, 235, 0.16);
            border: 1px solid rgba(96, 165, 250, 0.22);
            color: #bfdbfe;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.01em;
        }
        .filter-help-tooltip {
            position: fixed;
            inset: auto auto auto auto;
            max-width: min(320px, calc(100vw - 32px));
            padding: 12px 14px;
            border-radius: 14px;
            border: 1px solid rgba(96, 165, 250, 0.22);
            background:
                linear-gradient(180deg, rgba(12, 18, 32, 0.98), rgba(9, 14, 24, 0.98)),
                radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 55%);
            box-shadow: 0 18px 42px rgba(2, 8, 23, 0.48);
            color: #d7e3ff;
            font-size: 12px;
            font-weight: 500;
            line-height: 1.5;
            letter-spacing: 0.01em;
            z-index: 9999;
            opacity: 0;
            pointer-events: none;
            visibility: hidden;
            transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
            transform: translateY(4px);
        }
        .filter-help-tooltip.is-visible {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }
        [data-dev-hidden="true"] {
            display: none !important;
        }
        @media (max-width: 980px) {
            .filter-help-tooltip {
                max-width: min(300px, calc(100vw - 24px));
            }
        }
        @keyframes panelBusySpin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        @keyframes filterGuidanceReveal {
            from {
                opacity: 0;
                transform: translateY(6px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

/* Leaflet panes must keep their intrinsic geometry.
   enterprise.css has a legacy full-size .leaflet-pane override that makes
   transparent panes (notably popup/tooltip panes) cover the map and steal
   pointer events from MarkerCluster icons. app.css is loaded after it, so
   restore Leaflet's natural pane dimensions here. */
#map .leaflet-pane {
    width: auto !important;
    height: auto !important;
}

/* Provider circle markers use Leaflet's SVG renderer in this custom pane.
   Safari/WebKit does not reliably recover an SVG renderer whose pane was
   collapsed to intrinsic dimensions after a visual-viewport reflow. Keep only
   this renderer pane map-sized; popup and tooltip panes retain their intrinsic
   geometry for hit-testing. */
#map .leaflet-map-pane,
#map .leaflet-provider-pane {
    width: 100% !important;
    height: 100% !important;
}

/* With intrinsic pane dimensions, wrapped tooltips need an explicit intrinsic
   width of their own. Otherwise the tooltip pane's zero-width containing block
   can collapse normal-flow text to one character per line. */
#map .leaflet-tooltip.custom-tooltip {
    width: max-content !important;
    min-width: min(240px, calc(100vw - 48px));
    max-width: min(360px, calc(100vw - 32px)) !important;
    white-space: normal !important;
}

#map .leaflet-tooltip.custom-tooltip .map-tooltip {
    width: max-content;
    min-width: min(220px, calc(100vw - 64px));
    max-width: min(332px, calc(100vw - 48px));
    overflow-wrap: normal;
    word-break: normal;
}
