/*
 * Microsoft Places — Building Map Import & Export
 */

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --ink:     #0A1D5F;
  --blue:    #0972CE;
  --teal:    #37C1CE;
  --snow:    #f7f8fb;
  --cloud:   #eef0f6;
  --mist:    #e2e4ef;
  --silver:  #abafc4;
  --surface: #ffffff;
  --text:    #1a1a2e;
  --muted:   #5a6278;
  --danger:  #d13438;
  --success: #107c10;
  --top-h:   56px;
  --rad:     8px;
  --max-w:   860px;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
html, body { height: 100%; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--snow);
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; }

#main-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

[hidden] { display: none !important; }

/* ── Sign-in screen ─────────────────────────────────────────────────────────── */
#signin-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  z-index: 100;
}

#signin-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(55,193,206,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,193,206,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.signin-logo {
  position: absolute; top: 24px; left: 28px;
  height: 28px; width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}

.signin-card {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  padding: 40px 44px;
  text-align: center;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.32);
}

.signin-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--teal); margin-bottom: 12px;
}

.signin-card h1 { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.signin-card p  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 28px; }

.btn-ms {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 8px;
  padding: 14px 24px; font-family: inherit;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-ms:hover { background: #0d2470; }

/* ── Loading screen ─────────────────────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: var(--ink); z-index: 90;
}

.loading-logo { height: 32px; width: auto; filter: brightness(0) invert(1); opacity: .85; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(55,193,206,.25);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading-msg { font-size: 14px; color: rgba(255,255,255,.7); }

/* ── Error screen ───────────────────────────────────────────────────────────── */
#error-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--snow); z-index: 80;
}

.error-card {
  background: var(--surface); border-radius: 12px;
  padding: 40px; text-align: center; width: 100%; max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  border: 1px solid var(--mist);
}

.error-icon { margin-bottom: 16px; }
.error-card h2 { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.error-card p  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 20px; }

.btn-retry {
  display: inline-block; padding: 10px 24px;
  background: var(--ink); color: #fff; border: none; border-radius: 6px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-retry:hover { background: #0d2470; }

/* ── Consent screen ─────────────────────────────────────────────────────────── */
#consent-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--snow); z-index: 80;
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
#topbar {
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 20px;
  background: var(--ink); flex-shrink: 0;
}

.tb-logo { height: 22px; width: auto; filter: brightness(0) invert(1); opacity: .9; }
.tb-divider { width: 1px; height: 20px; background: rgba(255,255,255,.18); margin: 0 4px; }

.tb-breadcrumb { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.tb-breadcrumb-parent {
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,.6);
  text-decoration: none; transition: color .15s;
}
.tb-breadcrumb-parent:hover { color: rgba(255,255,255,.9); }
.tb-breadcrumb-sep { font-size: 13px; color: rgba(255,255,255,.35); }
.tb-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }

.btn-back, .btn-signout, .btn-help {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px;
  font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8);
  background: transparent; text-decoration: none; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-back:hover, .btn-signout:hover, .btn-help:hover {
  background: rgba(255,255,255,.1); color: #fff;
}

/* ── App body ───────────────────────────────────────────────────────────────── */
#app-body {
  flex: 1; overflow-y: auto;
  padding: 28px 24px;
  display: flex; flex-direction: column; gap: 24px;
}

.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 700px) {
  .panels-grid { grid-template-columns: 1fr; }
}

/* ── Panel ──────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--mist);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  overflow: hidden;
  display: flex; flex-direction: column;
}

.panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 3px solid var(--teal);
}

.panel-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--cloud); border-radius: 7px; color: var(--ink);
}

.panel-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.panel-body  { padding: 20px; display: flex; flex-direction: column; gap: 18px; flex: 1; }

/* ── Form controls ──────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.field-select {
  appearance: none;
  background: var(--snow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6278' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  border: 1px solid var(--mist); border-radius: 6px;
  padding: 9px 32px 9px 12px;
  font-family: inherit; font-size: 14px; color: var(--text);
  cursor: pointer; outline: none;
  transition: border-color .15s;
}
.field-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9,114,206,.1); }

/* ── File upload zone ───────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--mist);
  border-radius: 8px; padding: 28px 20px;
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--blue); background: var(--cloud);
}
.upload-zone.has-file { border-color: var(--teal); background: rgba(55,193,206,.05); border-style: solid; }

.upload-icon { color: var(--silver); margin-bottom: 10px; }
.upload-zone.has-file .upload-icon { color: var(--teal); }

.upload-main { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.upload-sub  { font-size: 12px; color: var(--muted); }
.upload-zone.has-file .upload-sub { color: var(--teal); font-weight: 500; }

/* ── Action button ──────────────────────────────────────────────────────────── */
.btn-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border: none; border-radius: 7px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-action.primary { background: var(--ink); color: #fff; }
.btn-action.primary:hover:not(:disabled) { background: #0d2470; }
.btn-action.export  { background: var(--teal); color: var(--ink); }
.btn-action.export:hover:not(:disabled) { background: #2badb9; }
.btn-action:disabled { opacity: .5; cursor: not-allowed; }

/* ── Status messages ────────────────────────────────────────────────────────── */
.status-msg {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; padding: 11px 14px;
  border-radius: 7px; line-height: 1.5;
}
.status-msg.info    { background: var(--cloud); color: var(--muted); }
.status-msg.success { background: #e8f5e9; color: #1b5e20; border-left: 3px solid var(--success); }
.status-msg.error   { background: #fde8e8; color: var(--danger); border-left: 3px solid var(--danger); }
.status-msg.loading { background: var(--cloud); color: var(--muted); }

.status-spinner {
  width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px;
  border: 2px solid rgba(55,193,206,.3); border-top-color: var(--teal);
  border-radius: 50%; animation: spin .7s linear infinite;
}

/* ── Info box ───────────────────────────────────────────────────────────────── */
.info-box {
  background: var(--cloud); border-radius: 7px;
  padding: 14px 16px; font-size: 13px; color: var(--muted); line-height: 1.65;
}
.info-box ul { padding-left: 16px; margin-top: 6px; }
.info-box li { margin-bottom: 4px; }
.info-box strong { color: var(--text); }
.info-box code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px; background: var(--mist); padding: 1px 5px; border-radius: 3px;
}

/* ── Overwrite warning ──────────────────────────────────────────────────────── */
.overwrite-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff8ec;
  border: 1px solid #f5c97a;
  border-radius: 7px;
  padding: 12px 14px;
  font-size: 13px;
  color: #7a4e00;
  line-height: 1.55;
  cursor: pointer;
}
.overwrite-warn input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #c87800;
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.overwrite-warn strong { color: #5a3800; }

/* ── Help drawer ────────────────────────────────────────────────────────────── */
.help-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,29,95,.35);
  backdrop-filter: blur(2px); z-index: 200;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.help-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 95vw;
  background: var(--surface); z-index: 210;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.18);
  animation: slideIn .25s cubic-bezier(.4,0,.2,1);
}

.help-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 3px solid var(--teal);
  background: var(--ink);
  flex-shrink: 0;
}

.help-title { font-size: 15px; font-weight: 700; color: #fff; }

.help-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: transparent; border: none;
  border-radius: 6px; cursor: pointer; color: rgba(255,255,255,.6);
  transition: background .15s, color .15s;
}
.help-close:hover { background: rgba(255,255,255,.1); color: #fff; }

.help-body {
  flex: 1; overflow-y: auto; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 24px;
}

.help-section { display: flex; flex-direction: column; gap: 10px; }
.help-section-title { font-size: 13px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }

.help-section p { font-size: 13px; color: var(--muted); line-height: 1.75; }
.help-section p + p { margin-top: 6px; }

.help-list { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.help-list li { font-size: 13px; color: var(--muted); line-height: 1.65; }
.help-list strong { color: var(--text); }

.help-section code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px; background: var(--cloud); padding: 1px 5px; border-radius: 3px;
}
