/* Карта экосистемы российского ИИ — "Галактика" */

/* Страница карты */
.map-page {
    background: linear-gradient(135deg, #0a0e1a 0%, #0f1629 50%, #0a0e1a 100%);
    color: #e2e8f0;
    min-height: 80vh;
}
.map-page .header { background: rgba(10, 14, 26, 0.95); border-bottom: 1px solid rgba(255,255,255,0.06); }

/* Панель управления */
.map-controls { padding: 0.75rem 1rem; }
.map-controls__bar { display: flex; align-items: center; gap: 1rem; max-width: 1400px; margin: 0 auto; }
.map-controls__filters { display: flex; gap: 0.5rem; overflow-x: auto; flex: 1; scrollbar-width: thin; }
.map-controls__pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
    border-radius: 20px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04);
    color: #94a3b8; font-size: 13px; cursor: pointer; transition: all 0.2s; white-space: nowrap; user-select: none;
}
.map-controls__pill:hover { background: rgba(255,255,255,0.08); color: #cbd5e1; }
.map-controls__pill--active { background: rgba(255,255,255,0.12); color: #f1f5f9; border-color: rgba(255,255,255,0.3); }
.map-controls__pill .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Поиск на карте */
.map-controls__search { position: relative; width: 260px; flex-shrink: 0; }
.map-controls__search-input {
    width: 100%; padding: 8px 16px; border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06);
    color: #e2e8f0; font-size: 13px; outline: none; transition: all 0.2s; box-sizing: border-box;
}
.map-controls__search-input::placeholder { color: #64748b; }
.map-controls__search-input:focus { border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.1); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

@media (max-width: 768px) {
    .map-controls__bar { flex-direction: column; }
    .map-controls__search { width: 100%; }
}

/* Контейнер карты */
.map-container {
    position: relative; width: 100%; height: calc(100vh - 160px); min-height: 500px;
    overflow: hidden; max-width: 1400px; margin: 0 auto;
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); background: #0a0e1a;
}
@media (max-width: 768px) { .map-container { height: calc(100vh - 200px); min-height: 400px; border-radius: 0; } }

/* Звёздное поле */
.map-starfield, #starfieldCanvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
}

/* Граф Cytoscape */
.map-graph, #ecosystemMap {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
}

/* Тултип */
.map-tooltip {
    position: fixed; z-index: 1000; background: rgba(15,23,42,0.95); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; padding: 12px 16px; pointer-events: none; max-width: 280px;
    backdrop-filter: blur(8px); box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.map-tooltip[hidden] { display: none; }
.map-tooltip__name { font-size: 14px; font-weight: 600; color: #f1f5f9; margin: 0 0 4px; }
.map-tooltip__ecosystem { font-size: 11px; color: #94a3b8; margin: 0 0 6px; }
.map-tooltip__category { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,0.08); color: #cbd5e1; margin-bottom: 6px; }
.map-tooltip__rating { font-size: 13px; color: #fbbf24; }

/* Zoom */
.map-zoom {
    position: absolute; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 4px; z-index: 50;
}
.map-zoom__btn {
    width: 36px; height: 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(15,23,42,0.8); color: #cbd5e1; font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.map-zoom__btn:hover { background: rgba(15,23,42,0.95); color: #f1f5f9; }

/* Панель деталей */
.map-detail {
    position: absolute; right: 0; top: 0; bottom: 0; width: 360px; background: rgba(15,23,42,0.97);
    border-left: 1px solid rgba(255,255,255,0.08); z-index: 200; overflow-y: auto;
    transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.map-detail[hidden] { display: block; transform: translateX(100%); }
.map-detail:not([hidden]) { transform: translateX(0); }
.map-detail.open { transform: translateX(0); }
.map-detail__close {
    position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: #94a3b8;
    font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 1;
}
.map-detail__close:hover { background: rgba(255,255,255,0.1); color: #f1f5f9; }
.map-detail__content { padding: 2rem 1.5rem; }

/* Панель деталей (JS-генерируемая разметка) */
.map-detail-panel { /* алиас для .map-detail */ }
.map-detail-panel__logo { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: rgba(255,255,255,0.08); margin-bottom: 0.75rem; }
.map-detail-panel__logo--fallback { width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(168,85,247,0.3)); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: #c4b5fd; margin-bottom: 0.75rem; }
.map-detail-panel__close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: #94a3b8; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.map-detail-panel__header { margin-bottom: 0.75rem; }
.map-detail-panel__name { font-size: 1.2rem; font-weight: 700; color: #f1f5f9; margin: 0 0 0.5rem; }
.map-detail-panel__badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; margin-right: 4px; margin-bottom: 6px; }
.map-detail-panel__rating { margin: 0.75rem 0; font-size: 14px; color: #94a3b8; }
.map-detail-panel__rating-label { margin-right: 4px; }
.map-detail-panel__rating-value { color: #fbbf24; font-weight: 700; font-size: 18px; }
.map-detail-panel__description { font-size: 0.875rem; line-height: 1.6; color: #94a3b8; margin: 0.75rem 0; }
.map-detail-panel__pricing { font-size: 0.8rem; color: #64748b; margin: 0.5rem 0; }
.map-detail-panel__link { display: inline-block; margin-top: 1rem; padding: 8px 20px; border-radius: 8px; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; transition: all 0.2s; }
.map-detail-panel__link:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,0.4); }
.map-detail-panel--open { transform: translateX(0) !important; }

@media (max-width: 768px) {
    .map-detail { position: fixed; right: 0; top: auto; bottom: 0; width: 100%; height: 60vh; border-left: none; border-top: 1px solid rgba(255,255,255,0.08); border-radius: 20px 20px 0 0; transform: translateY(100%); }
    .map-detail:not([hidden]), .map-detail.open { transform: translateY(0); }
    .map-zoom { bottom: 1rem; right: 1rem; }
    .map-legend { bottom: 1rem; left: 1rem; }
}

/* Легенда */
.map-legend {
    position: absolute; bottom: 1.5rem; left: 1.5rem; z-index: 50; background: rgba(15,23,42,0.9);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 0.75rem 1rem;
    max-width: 220px; max-height: 300px; overflow-y: auto;
}
.map-legend__title { font-size: 12px; font-weight: 600; color: #94a3b8; margin: 0 0 8px; cursor: pointer; user-select: none; }
.map-legend__list { list-style: none; padding: 0; margin: 0; }
.map-legend__item { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 11px; color: #cbd5e1; }
.map-legend__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.map-legend__dot--company { background: #4f46e5; }
.map-legend__dot--product { background: #10b981; }
.map-legend__dot--category { background: #f59e0b; }
.map-legend__line { width: 20px; height: 2px; flex-shrink: 0; }
.map-legend__line--develops { background: #10b981; }
.map-legend__line--integrates { background: #3b82f6; }
.map-legend__line--partners { background: #f59e0b; }

/* Загрузка */
.map-loading {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 10; background: rgba(10,14,26,0.8);
}
.map-loading--fade-out { animation: mapFadeOut 0.5s forwards; }
@keyframes mapFadeOut { to { opacity: 0; } }
.map-loading__inner { text-align: center; }
.map-loading__text { font-size: 14px; color: #94a3b8; margin-top: 1rem; }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-top-color: #818cf8; border-radius: 50%; animation: mapSpin 0.8s linear infinite; margin: 0 auto; }
.spinner--large { width: 48px; height: 48px; }
@keyframes mapSpin { to { transform: rotate(360deg); } }

/* Адаптация layout */
.map-page .main-content { padding: 0; max-width: none; }

/* Search suggestions dropdown (created by JS) */
.map-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: rgba(15,23,42,0.97); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 4px; z-index: 100; max-height: 300px; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.map-search-results[hidden] { display: none; }
.map-search-result { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; transition: background 0.15s; font-size: 13px; color: #e2e8f0; }
.map-search-result:hover { background: rgba(255,255,255,0.08); }
