/* =========================================================
   OUTLETS & GEOFENCE
========================================================= */

.outlets-content {
    display: grid;
    gap: 22px;
}

.outlets-content[hidden] {
    display: none !important;
}

.outlets-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 28px;
    border: 1px solid var(--border, #e7e9ee);
    border-radius: 24px;
    background:
        radial-gradient(
            circle at 10% 0%,
            rgba(36, 99, 235, .10),
            transparent 36%
        ),
        var(--surface, #fff);
}

.outlets-hero .eyebrow {
    display: block;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .13em;
}

.outlets-hero h2 {
    margin: 0 0 8px;
    font-size: clamp(24px, 3vw, 34px);
}

.outlets-hero p {
    max-width: 650px;
    margin: 0;
    color: #64748b;
    line-height: 1.8;
}

.outlets-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.outlets-secondary-action,
.outlets-map-tool {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #dbe0e8;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.outlets-secondary-action:hover,
.outlets-map-tool:hover {
    background: #f8fafc;
}

/* KPI */

.outlets-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.outlet-kpi-card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border: 1px solid #e8ebf0;
    border-radius: 18px;
    background: #fff;
}

.outlet-kpi-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: #2563eb;
    opacity: .75;
}

.outlet-kpi-card > span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.outlet-kpi-card strong {
    display: block;
    margin: 8px 0 2px;
    font-size: 30px;
    line-height: 1;
}

.outlet-kpi-card small {
    color: #94a3b8;
}

/* Toolbar */

.outlets-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 210px 180px;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e8ebf0;
    border-radius: 18px;
    background: #fff;
}

.outlets-toolbar label,
.outlet-form-grid label {
    display: grid;
    gap: 7px;
}

.outlets-toolbar label > span,
.outlet-form-grid label > span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.outlets-toolbar input,
.outlets-toolbar select,
.outlet-form-grid input,
.outlet-form-grid select,
.outlet-form-grid textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #dbe0e8;
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: #0f172a;
    font: inherit;
}

.outlets-toolbar input:focus,
.outlets-toolbar select:focus,
.outlet-form-grid input:focus,
.outlet-form-grid select:focus,
.outlet-form-grid textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .09);
}

/* Workspace */

.outlets-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(330px, .75fr);
    gap: 16px;
    align-items: stretch;
}

.outlets-map-card,
.outlets-list-card {
    min-width: 0;
    border: 1px solid #e8ebf0;
    border-radius: 20px;
    background: #fff;
    overflow: hidden;
}

.outlets-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid #edf0f4;
}

.outlets-panel-header span {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
}

.outlets-panel-header h3 {
    margin: 3px 0 0;
    font-size: 17px;
}

.outlets-panel-header > strong {
    display: grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 11px;
    background: #eff6ff;
    color: #2563eb;
}

/* Main map */

.outlets-map-shell {
    position: relative;
    min-height: 570px;
    background: #eef2f7;
}

.outlets-map {
    width: 100%;
    height: 570px;
    z-index: 1;
}

.outlets-map-empty {
    position: absolute;
    z-index: 500;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, .88);
    color: #fff;
    font-size: 13px;
    pointer-events: none;
}

.outlets-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 13px 20px;
    border-top: 1px solid #edf0f4;
    color: #64748b;
    font-size: 12px;
}

.outlets-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.legend-dot.active {
    background: #16a34a;
}

.legend-dot.inactive {
    background: #94a3b8;
}

.legend-ring {
    width: 13px;
    height: 13px;
    border: 2px solid #2563eb;
    border-radius: 50%;
}

/* Leaflet */

.outlets-map .leaflet-control-zoom,
.outlet-editor-map .leaflet-control-zoom {
    border: 0 !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12) !important;
}

.outlets-map .leaflet-control-zoom a,
.outlet-editor-map .leaflet-control-zoom a {
    border: 0 !important;
}

.outlet-map-popup {
    min-width: 190px;
    direction: rtl;
    text-align: right;
}

.outlet-map-popup strong {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.outlet-map-popup small {
    display: block;
    margin-bottom: 8px;
    color: #64748b;
}

.outlet-map-popup button {
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
    cursor: pointer;
}

/* List */

.outlets-list {
    height: 570px;
    overflow-y: auto;
    padding: 10px;
}

.outlet-list-item {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    margin-bottom: 8px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: #f8fafc;
    text-align: right;
    cursor: pointer;
    transition: .18s ease;
}

.outlet-list-item:hover,
.outlet-list-item.is-selected {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.outlet-list-pin {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: #fff;
    color: #2563eb;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}

.outlet-list-pin svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.outlet-list-copy {
    min-width: 0;
}

.outlet-list-copy strong {
    display: block;
    overflow: hidden;
    color: #0f172a;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.outlet-list-copy span {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #64748b;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.outlet-list-meta {
    display: grid;
    justify-items: end;
    gap: 5px;
}

.outlet-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.outlet-status-badge.active {
    background: #dcfce7;
    color: #15803d;
}

.outlet-status-badge.inactive {
    background: #f1f5f9;
    color: #64748b;
}

.outlet-status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.outlet-radius-label {
    color: #94a3b8;
    font-size: 10px;
}

.outlets-empty-state {
    display: grid;
    place-items: center;
    min-height: 220px;
    padding: 30px;
    color: #94a3b8;
    text-align: center;
    line-height: 1.8;
}

/* Drawer */

.outlet-drawer {
    width: min(720px, 96vw);
}

.outlet-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.outlet-form-wide {
    grid-column: 1 / -1;
}

.outlet-form-grid textarea {
    resize: vertical;
}

.outlet-location-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.outlet-location-toolbar > span {
    color: #64748b;
    font-size: 12px;
}

.outlet-editor-map {
    width: 100%;
    height: 330px;
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid #dfe4eb;
    border-radius: 15px;
    background: #eef2f7;
}

.coordinates-grid {
    direction: ltr;
}

.coordinates-grid label {
    direction: rtl;
}

#outletRadiusRange {
    min-height: 20px;
    padding: 0;
    accent-color: #2563eb;
}

.outlet-polygon-notice {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid #fde68a;
    border-radius: 11px;
    background: #fffbeb;
    color: #92400e;
    font-size: 12px;
    line-height: 1.7;
}

/* Responsive */

@media (max-width: 1180px) {
    .outlets-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .outlets-workspace {
        grid-template-columns: 1fr;
    }

    .outlets-list {
        height: auto;
        max-height: 430px;
    }
}

@media (max-width: 760px) {
    .outlets-hero {
        align-items: stretch;
        flex-direction: column;
        padding: 20px;
    }

    .outlets-hero-actions {
        width: 100%;
    }

    .outlets-hero-actions > * {
        flex: 1;
    }

    .outlets-kpis {
        grid-template-columns: 1fr 1fr;
    }

    .outlets-toolbar {
        grid-template-columns: 1fr;
    }

    .outlets-map,
    .outlets-map-shell {
        height: 430px;
        min-height: 430px;
    }

    .outlet-form-grid {
        grid-template-columns: 1fr;
    }

    .outlet-form-wide {
        grid-column: auto;
    }
}

@media (max-width: 480px) {
    .outlets-kpis {
        grid-template-columns: 1fr;
    }

    .outlets-panel-header {
        align-items: flex-start;
    }

    .outlets-map,
    .outlets-map-shell {
        height: 380px;
        min-height: 380px;
    }

    .outlet-editor-map {
        height: 280px;
    }
}
/* OUTLET CARD ACTIONS - PRODUCTION */

.outlet-list-item {
    position: relative;
    cursor: pointer;
}

.outlet-list-item:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.outlet-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.outlet-card-action {
    min-height: 34px;
    padding: 6px 13px;
    border: 1px solid #dbe4ee;
    border-radius: 9px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease,
        transform .18s ease;
}

.outlet-card-action:hover {
    transform: translateY(-1px);
}

.outlet-card-action.edit:hover {
    border-color: #2563eb;
    color: #1d4ed8;
    background: #eff6ff;
}

.outlet-card-action.deactivate {
    color: #b42318;
}

.outlet-card-action.deactivate:hover {
    border-color: #fda29b;
    background: #fff1f0;
}

.outlet-card-action.activate {
    color: #067647;
}

.outlet-card-action.activate:hover {
    border-color: #75e0a7;
    background: #ecfdf3;
}

@media (max-width: 767px) {
    .outlet-card-actions {
        gap: 8px;
    }

    .outlet-card-action {
        flex: 1 1 0;
        min-height: 40px;
    }
}
/* OUTLET CONFIRM MODAL - PRODUCTION */

.outlet-confirm-modal[hidden] {
    display: none !important;
}

.outlet-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl;
}

.outlet-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 20, 35, 0.62);
    backdrop-filter: blur(4px);
}

.outlet-confirm-dialog {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    padding: 28px;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 25px 80px rgba(15, 23, 42, 0.28);
}

.outlet-confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: #eef6ff;
    color: #2563eb;
    font-size: 22px;
    font-weight: 900;
}

.outlet-confirm-dialog h3 {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 20px;
}

.outlet-confirm-dialog p {
    margin: 0;
    color: #64748b;
    line-height: 1.8;
}

.outlet-confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.outlet-confirm-accept,
.outlet-confirm-cancel {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 11px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.outlet-confirm-accept {
    flex: 1;
    border: 0;
    background: #08758a;
    color: #ffffff;
}

.outlet-confirm-accept.danger {
    background: #b42318;
}

.outlet-confirm-cancel {
    border: 1px solid #dbe4ee;
    background: #ffffff;
    color: #475569;
}

@media (max-width: 520px) {
    .outlet-confirm-modal {
        align-items: flex-end;
        padding: 12px;
    }

    .outlet-confirm-dialog {
        width: 100%;
        padding: 22px 18px;
    }

    .outlet-confirm-actions {
        flex-direction: column;
    }

    .outlet-confirm-accept,
    .outlet-confirm-cancel {
        width: 100%;
    }
}
/* PHASE_4_G2C2_GEOFENCE_STYLES */

.outlet-polygon-editor {
    display: grid;
    gap: 14px;
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.outlet-polygon-editor[hidden] {
    display: none !important;
}

.polygon-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.polygon-editor-copy {
    display: grid;
    gap: 5px;
}

.polygon-editor-copy strong {
    color: #172554;
    font-size: 13px;
}

.polygon-editor-copy small {
    color: #475569;
    line-height: 1.7;
}

.polygon-point-count {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #fff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
}

.polygon-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.polygon-editor-button {
    min-height: 38px;
    padding: 8px 12px;
}

.polygon-editor-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.polygon-clear-button {
    color: #b91c1c;
}

.polygon-editor-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #dbeafe;
    color: #475569;
    font-size: 11px;
}

.polygon-editor-stats strong {
    color: #0f172a;
}

.polygon-validation-state {
    padding: 5px 9px;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-weight: 800;
}

.polygon-validation-state.is-valid {
    background: #dcfce7;
    color: #15803d;
}

.outlet-editor-map {
    cursor: crosshair;
}

@media (max-width: 640px) {
    .polygon-editor-head,
    .polygon-editor-stats {
        align-items: stretch;
        flex-direction: column;
    }

    .polygon-point-count {
        align-self: flex-start;
    }

    .polygon-editor-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* PHASE_4_G2F_POLYGON_VISUAL */

.outlet-editor-map {
    cursor: crosshair;
}

/*
 * Polygon vertices are geometry handles,
 * not location pins.
 */
.outlet-polygon-vertex {
    cursor: grab;
}

.outlet-polygon-vertex:active {
    cursor: grabbing;
}

/*
 * Improve visibility of Leaflet vector geometry
 * inside the outlet editor.
 */
#outletEditorMap .leaflet-overlay-pane svg {
    overflow: visible;
}

#outletEditorMap .leaflet-interactive {
    vector-effect: non-scaling-stroke;
}

.polygon-validation-state.is-valid {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.polygon-point-count {
    min-width: 64px;
    text-align: center;
}

/* ========================================================
   PHASE_4_G2H_LEAFLET_SVG_FIX

   Leaflet dynamically controls the SVG renderer dimensions.
   Global application SVG/icon sizing must not constrain it.
   ======================================================== */

#outletEditorMap .leaflet-overlay-pane > svg,
#outletEditorMap .leaflet-zoom-animated > svg,
#outletEditorMap svg.leaflet-zoom-animated {
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

/*
 * Preserve Leaflet's own SVG width/height attributes.
 * CSS intrinsic sizing must follow those attributes.
 */
#outletEditorMap .leaflet-overlay-pane svg {
    overflow: visible;
}

/*
 * Vector paths must remain scalable and visible.
 */
#outletEditorMap .leaflet-overlay-pane path {
    vector-effect: non-scaling-stroke;
}
