/* ================================================================
   GIS Module Styles — ثمن
   نقشه هوشمند + پانل پرونده + Kanban
================================================================ */

/* ── Wrap اصلی ─────────────────────────────────────────────── */
.gis-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    min-height: 500px;
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #e2e8f0;
}

/* ── Toolbar ───────────────────────────────────────────────── */
.gis-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1.5px solid #e2e8f0;
    flex-wrap: wrap;
    flex-shrink: 0;
    z-index: 10;
}

.gis-toolbar__left  { display: flex; gap: 8px; align-items: center; }
.gis-toolbar__layers { display: flex; gap: 12px; align-items: center; font-size: 12px; margin-right: auto; }
.gis-toolbar__filters { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── دکمه انتخاب بلوک ──────────────────────────────────── */
.gis-block-mode-btn {
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    transition: all .15s;
}

/* ── نوار بلوک‌های انتخابی ──────────────────────────────── */
.gis-block-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 36px;
}

.gis-block-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── تب‌های فشرده GIS ───────────────────────────────────── */
.gis-tab-nav {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.gis-tab-btn {
    padding: 6px 18px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.gis-tab-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.gis-tab-btn--active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* ── سوئیچر کاشی نقشه ──────────────────────────────────── */
.gis-tile-switcher {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}
.gis-tile-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #64748b;
    background: transparent;
    transition: all .15s;
    white-space: nowrap;
}
.gis-tile-btn--active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

.gis-add-hint {
    font-size: 12px;
    color: #059669;
    font-weight: 600;
    background: #dcfce7;
    padding: 4px 10px;
    border-radius: 8px;
    animation: gis-pulse 1s ease infinite;
}

@keyframes gis-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Botones GIS ───────────────────────────────────────────── */
.gis-btn {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s;
    white-space: nowrap;
}

.gis-btn--primary   { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.gis-btn--primary:hover { background: #2563eb; }
.gis-btn--secondary { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.gis-btn--secondary:hover { background: #e2e8f0; }
.gis-btn--success   { background: #10b981; color: #fff; border-color: #10b981; }
.gis-btn--success:hover { background: #059669; }
.gis-btn--danger    { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.gis-btn--danger:hover { background: #fecaca; }
.gis-btn--add       { background: #0f172a; color: #fff; border-color: #0f172a; }
.gis-btn--add:hover { background: #1e293b; }
.gis-btn--add-mode  { background: #dc2626; color: #fff; border-color: #dc2626; }
.gis-btn--refresh   { background: #f1f5f9; border-color: #e2e8f0; color: #475569; }
.gis-btn--sm  { padding: 5px 12px; font-size: 12px; }
.gis-btn--xs  { padding: 3px 9px;  font-size: 11px; }

/* ── فیلتر وضعیت ───────────────────────────────────────────── */
.gis-filter-btn {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    transition: all .15s;
    white-space: nowrap;
}

.gis-filter-btn:hover,
.gis-filter-btn--active {
    background: var(--fc, #3b82f6);
    color: #fff;
    border-color: var(--fc, #3b82f6);
}

/* ── Layer toggles ─────────────────────────────────────────── */
.gis-layer-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}

.gis-layer-toggle input { accent-color: #3b82f6; cursor: pointer; }

/* ── Body: نقشه + پانل ─────────────────────────────────────── */
.gis-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.gis-map-container {
    flex: 1;
    position: relative;
    transition: flex .3s ease;
    min-width: 0;
}

#gis-leaflet-map {
    width: 100%;
    height: 100%;
}

.gis-map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248,250,252,.9);
    font-size: 14px;
    color: #64748b;
    gap: 10px;
    z-index: 999;
}

/* ── پانل جزئیات ───────────────────────────────────────────── */
.gis-detail-panel {
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    transition: width .3s ease;
    border-right: 0 solid #e2e8f0;
    background: #fff;
}

.gis-detail-panel--open {
    width: 380px;
    border-right-width: 1.5px;
    overflow-y: auto;
}

.gis-detail-panel__inner {
    width: 380px;
    padding: 0;
}

/* ── هدر پانل ──────────────────────────────────────────────── */
.gis-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1.5px solid #e2e8f0;
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 5;
}

.gis-panel-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.gis-panel-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
}

.gis-panel-close {
    background: none;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all .15s;
    flex-shrink: 0;
}

.gis-panel-close:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

/* ── امتیاز badge ──────────────────────────────────────────── */
.gis-score-badge {
    padding: 5px 10px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

/* ── نوار وضعیت پارسل ──────────────────────────────────────── */
.gis-panel-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.gis-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gis-lock-badge {
    font-size: 11px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 600;
}

.gis-issue-badge {
    font-size: 11px;
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 700;
}

.gis-issue-badge--critical { background: #fee2e2; color: #dc2626; }
.gis-issue-badge--warning  { background: #fef3c7; color: #d97706; }

/* ── تب‌های پانل ────────────────────────────────────────────── */
.gis-panel-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1.5px solid #e2e8f0;
    overflow-x: auto;
    background: #f8fafc;
}

.gis-panel-tab {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-bottom: 2.5px solid transparent;
    background: none;
    color: #64748b;
    white-space: nowrap;
    transition: all .15s;
}

.gis-panel-tab:hover { color: #1e293b; background: #f1f5f9; }
.gis-panel-tab--active { color: #2563eb; border-bottom-color: #2563eb; background: #fff; }

/* ── بدنه پانل ──────────────────────────────────────────────── */
.gis-panel-body { padding: 14px 16px; }

.gis-panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #94a3b8;
}

.gis-panel-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1.5px solid #e2e8f0;
    background: #f8fafc;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
}

/* ── محتوای تب ──────────────────────────────────────────────── */
.gis-tab-content { font-size: 13px; }

.gis-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 10px;
}

.gis-info-label { color: #64748b; font-size: 12px; flex-shrink: 0; }
.gis-info-value { color: #1e293b; font-weight: 600; text-align: left; }

.gis-info-divider {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 12px 0 4px;
    padding-bottom: 4px;
    border-bottom: 1px dashed #e2e8f0;
}

.gis-alert-row {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    margin: 6px 0;
}

.gis-alert-row--critical { background: #fee2e2; color: #dc2626; }
.gis-alert-row--warning  { background: #fef3c7; color: #d97706; }

.gis-amenities-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    font-size: 12px;
    color: #475569;
    margin-top: 8px;
}

.gis-empty-tab {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    padding: 24px 0;
}

/* ── مالکین ────────────────────────────────────────────────── */
.gis-owner-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.gis-owner-card--primary { border-color: #93c5fd; background: #eff6ff; }
.gis-owner-name { font-weight: 700; font-size: 13px; color: #1e293b; margin-bottom: 3px; }
.gis-owner-meta { font-size: 11px; color: #64748b; }
.gis-badge { background: #3b82f6; color: #fff; border-radius: 5px; padding: 1px 7px; font-size: 10px; font-weight: 700; }

/* ── Timeline ───────────────────────────────────────────────── */
.gis-timeline { position: relative; padding-right: 20px; }
.gis-timeline::before {
    content: '';
    position: absolute;
    right: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.gis-timeline-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    position: relative;
}

.gis-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #3b82f6;
    flex-shrink: 0;
    margin-top: 3px;
    position: absolute;
    right: -20px;
}

.gis-timeline-body { padding-right: 4px; flex: 1; }
.gis-timeline-title { font-weight: 700; font-size: 13px; color: #1e293b; }
.gis-timeline-meta  { font-size: 11px; color: #64748b; margin-top: 2px; }
.gis-timeline-note  { font-size: 11px; color: #94a3b8; margin-top: 3px; font-style: italic; }

/* ── مشکلات ─────────────────────────────────────────────────── */
.gis-issue-card {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.gis-issue-title { font-weight: 700; font-size: 13px; color: #1e293b; margin-bottom: 3px; }
.gis-issue-meta  { font-size: 11px; color: #475569; }
.gis-issue-desc  { font-size: 12px; color: #64748b; margin-top: 4px; }

.gis-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f1f5f9;
}

/* ── کارنامه ─────────────────────────────────────────────────── */
.gis-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 3px solid;
    border-radius: 16px;
    margin-bottom: 14px;
}

.gis-score-value { font-size: 48px; font-weight: 900; line-height: 1; }
.gis-score-label { font-size: 14px; font-weight: 700; color: #64748b; margin-top: 4px; }

.gis-score-bar-wrap { margin-bottom: 14px; }
.gis-score-bar-track {
    height: 10px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
}

.gis-score-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .6s ease;
}

/* ── نوار وضعیت پایین نقشه ────────────────────────────────── */
.gis-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 14px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
}

/* ── لیست پرونده‌ها ─────────────────────────────────────────── */
.parcel-list-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: box-shadow .15s;
}

.parcel-list-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }

/* ── Kanban ─────────────────────────────────────────────────── */
.gis-kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.gis-kanban-col {
    min-width: 180px;
    width: 180px;
    flex-shrink: 0;
    background: #f8fafc;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    overflow: hidden;
}

.gis-kanban-col__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f1f5f9;
    border-bottom: 1.5px solid #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}

.gis-kanban-count {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 99px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #3b82f6;
}

.gis-kanban-col__body { padding: 8px; }

.gis-kanban-card {
    background: #fff;
    border-radius: 8px;
    padding: 9px 10px;
    margin-bottom: 6px;
    border: 1.5px solid #e2e8f0;
    font-size: 12px;
}

.gis-kanban-card__title { font-weight: 700; color: #1e293b; margin-bottom: 3px; }
.gis-kanban-card__meta  { color: #64748b; font-size: 11px; }
.gis-kanban-card__user  { color: #94a3b8; font-size: 11px; margin-top: 3px; }

/* ── لایه‌های مناطق/محلات ──────────────────────────────────── */
.gis-layer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
}

.gis-layer-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Leaflet overrides ─────────────────────────────────────── */
.leaflet-container { font-family: inherit; direction: ltr; }
.leaflet-tooltip { direction: rtl; text-align: right; }
.leaflet-popup-content { direction: rtl; text-align: right; font-family: inherit; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .gis-detail-panel--open { width: 100%; border-top: 1.5px solid #e2e8f0; border-right: none; }
    .gis-body { flex-direction: column; }
    .gis-wrap { height: auto; min-height: 100vh; }
    .gis-toolbar { gap: 6px; }
    .gis-toolbar__filters { display: none; }
}
