/* MEDDIC Map Module Styles — Gamified Corporate Tech */

.map-screen {
  --bg: #0b1220;
  --panel: rgba(15, 23, 42, 0.75);
  --panel-soft: rgba(30, 41, 59, 0.6);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(56, 189, 248, 0.3);
  --accent: #38bdf8;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}
.map-screen.active { display: flex !important; }

/* ========== HUD TOPBAR ========== */
.map-topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap;
  background: var(--panel); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}
.topbar-left, .topbar-right { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.stat-pill, .resource-item {
  background: rgba(15, 23, 42, 0.8); border: 1px solid rgba(56,189,248,0.3);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.stat-pill.score { border-color: var(--accent); color: var(--accent); }

.map-main {
  display: grid; grid-template-columns: 1fr 300px;
  gap: 12px; flex: 1; min-height: 0;
}

/* ========== CYBERPUNK CITY MAP ========== */
.city-map-wrapper {
  position: relative;
  border-radius: 16px; border: 1px solid var(--line);
  overflow: hidden; min-height: 60vh;
  background:
    linear-gradient(90deg, rgba(56,189,248,0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(56,189,248,0.05) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(56,189,248,0.1), var(--bg) 80%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.6);
}
.city-map { position: absolute; inset: 0; transform-origin: center center; will-change: transform; }
.map-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; }

/* ========== HOLOGRAPHIC BUILDINGS ========== */
.client-building {
  position: absolute; width: 120px;
  background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.4); border-top: 4px solid var(--accent);
  border-radius: 8px; padding: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  transform: translate(-50%, -50%);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.client-building::before {
  content: ''; position: absolute; top: -100%; left: -50%; width: 200%; height: 200%;
  background: linear-gradient(to bottom, transparent, rgba(56,189,248,0.2), transparent);
  transform: rotate(30deg); animation: holoScan 4s linear infinite; pointer-events: none;
}
@keyframes holoScan { 0% { transform: translateY(-100%) rotate(30deg); } 100% { transform: translateY(100%) rotate(30deg); } }

.client-building:hover, .client-building.selected { 
  transform: translate(-50%, -60%) scale(1.1); 
  border-color: var(--accent); box-shadow: 0 10px 20px rgba(0,0,0,0.6); 
  z-index: 100;
}
.client-building:not(.selected) .company { opacity: 0.8; }

.client-building .company { font-size: 13px; font-weight: 800; line-height: 1.3; color: var(--text); }
.client-building .meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
.status-chip { border-radius: 4px; padding: 3px 6px; font-size: 10px; font-weight: 700; border: 1px solid transparent; text-transform: uppercase; }

.client-building[data-status="未接触"] .status-chip { background: rgba(71,85,105,0.3); color: #cbd5e1; border-color: #475569; }
.client-building[data-status="已建联"] .status-chip { background: rgba(59,130,246,0.2); color: #93c5fd; border-color: #3b82f6; }
.client-building[data-status="活跃"] .status-chip { background: rgba(245,158,11,0.2); color: #fcd34d; border-color: #f59e0b; }
.client-building[data-status="NO-GO"] .status-chip,
.client-building[data-status="放弃"] .status-chip { background: rgba(239,68,68,0.2); color: #fca5a5; border-color: #ef4444; }
.client-building[data-status="死单"] .status-chip { background: rgba(15,23,42,0.8); color: #64748b; border-color: #334155; }
.client-building[data-status="赢单"] .status-chip { background: rgba(16,185,129,0.2); color: #6ee7b7; border-color: #10b981; }

.client-building.dead { opacity: 0.3; background: #0f172a; }
.client-building.nogo { opacity: 0.5; background: #1e293b; }

.client-building.pulse { animation: pulse-ring 0.8s ease-out; }
@keyframes pulse-ring {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ========== DRONE AVATAR ========== */
.sales-avatar {
  position: absolute; left: 8%; top: 85%;
  width: 32px; height: 32px;
  transform: translate(-50%, -50%);
  transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 30; pointer-events: none;
  color: transparent;
}
.sales-avatar::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 0; height: 0;
  border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-bottom: 24px solid var(--accent);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: droneBreathe 1.5s infinite alternate;
}
@keyframes droneBreathe {
  0% { transform: translate(-50%, -50%) rotate(45deg) scale(0.9); }
  100% { transform: translate(-50%, -50%) rotate(45deg) scale(1.1); }
}

/* ========== TUTORIAL BUBBLE ========== */
.tutorial-bubble {
  position: absolute; z-index: 120; top: 86px; left: 16px;
  background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(8px);
  border: 1px solid #f59e0b; border-radius: 12px; padding: 12px 16px;
  font-size: 13px; font-weight: 600; color: #fde68a;
  box-shadow: 0 4px 10px rgba(245,158,11,0.2);
  animation: floatBounce 2s infinite;
}
.tutorial-bubble::after {
  content: ''; position: absolute; left: 20px; bottom: -7px;
  width: 12px; height: 12px; background: rgba(15, 23, 42, 0.9);
  border-right: 1px solid #f59e0b; border-bottom: 1px solid #f59e0b;
  transform: rotate(45deg);
}
@keyframes floatBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ========== BOTTOM SHEET MENU ========== */
.client-action-menu {
  position: fixed; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%;
  background: rgba(11, 18, 32, 0.95); backdrop-filter: blur(20px);
  border-top: 1px solid var(--line); border-radius: 24px 24px 0 0;
  padding: 24px; padding-bottom: max(24px, env(safe-area-inset-bottom));
  box-shadow: 0 -5px 20px rgba(0,0,0,0.6);
  transform: translateY(100%); animation: slideUpSheet 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 1000; box-sizing: border-box;
}
.client-action-menu::before {
  content: ''; display: block; width: 40px; height: 4px;
  background: rgba(255,255,255,0.2); border-radius: 2px; margin: 0 auto 20px auto;
}
@keyframes slideUpSheet { to { transform: translateY(0); } }

.client-action-menu .menu-title { font-size: 16px; font-weight: 800; margin-bottom: 16px; color: var(--accent); text-align: center; }
.client-action-menu .menu-actions { display: flex; flex-direction: column; gap: 8px; }
.client-action-menu button {
  background: var(--panel-soft); border: 1px solid rgba(71,85,105,0.6); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
  transition: all 0.2s; display: flex; justify-content: space-between; align-items: center;
}
.client-action-menu button::after { content: '→'; opacity: 0.5; }
.client-action-menu button:hover { background: rgba(56,189,248,0.15); border-color: var(--accent); transform: translateX(4px); }
.client-action-menu button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; border-color: rgba(71,85,105,0.6); }
.client-action-menu button[data-act="nogo"] { color: #fca5a5; border-color: rgba(239,68,68,0.4); }
.client-action-menu button[data-act="nogo"]:hover { background: rgba(239,68,68,0.15); border-color: #ef4444; }
.client-action-menu .research-submenu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.client-action-menu .research-submenu button { font-size: 12px; padding: 10px; justify-content: center; }
.client-action-menu .research-submenu button::after { display: none; }

/* ========== INTEL PREVIEW PANEL ========== */
.intel-preview {
  background: var(--panel); backdrop-filter: blur(12px); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; overflow: auto; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.intel-preview h4 { margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }
.intel-item {
  font-size: 13px; padding: 10px 12px; margin-bottom: 8px;
  background: rgba(30,41,59,0.5); border-radius: 8px; border-left: 4px solid rgba(71,85,105,0.8);
  line-height: 1.5;
}
.intel-item.flash { animation: flash-in 0.8s ease; border-left-color: var(--accent); }
@keyframes flash-in { 0% { background: rgba(56,189,248,0.3); } 100% { background: rgba(30,41,59,0.5); } }

/* ========== BOTTOM BAR BUTTONS ========== */
.map-bottombar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bottom-btn {
  position: relative; overflow: hidden;
  padding: 14px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-soft); backdrop-filter: blur(8px);
  color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: all 0.3s; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.bottom-btn:hover { background: rgba(56,189,248,0.15); border-color: var(--accent); box-shadow: 0 4px 12px rgba(56,189,248,0.2); transform: translateY(-3px); }
.bottom-btn.danger { border-color: rgba(239,68,68,0.5); color: #fecaca; }
.bottom-btn.danger:hover { background: rgba(239,68,68,0.15); border-color: #ef4444; box-shadow: 0 4px 12px rgba(239,68,68,0.2); }

/* ========== GLASSMORPHISM MODAL ========== */
.map-modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
}
.map-modal {
  background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 24px; max-width: 560px; width: 92%; max-height: 80vh; overflow: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.map-modal h3 { margin: 0 0 16px; color: var(--accent); font-size: 1.5rem; font-weight: 800; }
.map-modal table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0; }
.map-modal th, .map-modal td { padding: 10px; border-bottom: 1px solid rgba(71,85,105,0.5); text-align: left; }
.map-modal th { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.modal-actions { margin-top: 20px; text-align: right; }
.modal-actions button {
  background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; border: none;
  padding: 10px 24px; border-radius: 10px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 8px rgba(56,189,248,0.3); transition: all 0.2s;
}
.modal-actions button:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(56,189,248,0.4); }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .map-main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .intel-preview { max-height: 30vh; }
}

@media (max-width: 768px) {
  .map-topbar, .client-building, .tutorial-bubble, .client-action-menu, .intel-preview, .bottom-btn, .map-modal-mask, .map-modal {
    backdrop-filter: none !important;
  }
  .map-topbar, .client-action-menu, .intel-preview, .map-modal {
    background-color: rgba(15, 23, 42, 0.98) !important;
  }
  .client-building, .bottom-btn, .tutorial-bubble {
    background-color: rgba(30, 41, 59, 0.98) !important;
  }
  .map-modal-mask {
    background-color: rgba(0, 0, 0, 0.85) !important;
  }
}

@media (min-width: 769px) {
  .client-action-menu {
    position: absolute; bottom: auto; left: auto; right: auto; width: 220px;
    border-radius: 16px; border: 1px solid var(--line);
    transform: none; animation: fadeUp 0.2s ease-out;
    padding: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  }
  .client-action-menu::before { display: none; }
}

@media (max-width: 520px) {
  .map-screen { padding: 8px; gap: 8px; }
  .client-building { width: 100px; padding: 8px; }
  .map-bottombar { grid-template-columns: 1fr; }
}
