/* miniExif Web — clean utility styling, close to the Mac app's feel. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: #e2e2e7;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --accent: #0a84ff;
  --danger: #ff3b30;
  --warn: #ff9f0a;
  --ok: #30d158;
  --radius: 12px;
  font-size: 15px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 10px;
  background: #1d1d1f; color: var(--accent);
  font-weight: 700; font-size: 17px;
}
.brand h1 { margin: 0; font-size: 18px; }
.web-tag {
  font-size: 11px; vertical-align: middle; background: var(--accent); color: #fff;
  border-radius: 6px; padding: 2px 6px; margin-left: 4px;
}
.tagline { margin: 2px 0 0; color: var(--text-dim); font-size: 12.5px; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #eafaf0; border: 1px solid #bfe9cf; color: #1d7a3e;
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.privacy-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* ---------- layout ---------- */
#app { flex: 1; display: flex; flex-direction: column; }

.empty-state { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.dropzone {
  text-align: center; padding: 64px 72px; border: 2px dashed #c7c7cc;
  border-radius: 20px; background: var(--surface); cursor: pointer; max-width: 640px;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #f0f8ff; }
.dropzone-icon { font-size: 44px; }
.dropzone h2 { margin: 12px 0 6px; }
.dropzone p { margin: 4px 0; color: var(--text-dim); }
.dropzone .hint { font-size: 12.5px; }

.workspace {
  flex: 1; display: grid; grid-template-columns: 300px 1fr; gap: 0;
  max-width: 1400px; width: 100%; margin: 0 auto; padding: 16px 20px 40px;
}
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } }

.sidebar { padding-right: 16px; }
.sidebar-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.file-count { color: var(--text-dim); font-size: 12.5px; }
.file-list { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow: auto; }
.file-item {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.file-item:hover { background: #ececf0; }
.file-item.selected { background: #e3eefe; border-color: #b3d7ff; }
.file-item img, .file-thumb-fallback {
  width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #e5e5ea;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-dim);
}
.file-item .file-meta { min-width: 0; flex: 1; }
.file-item .file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .file-sub { font-size: 11.5px; color: var(--text-dim); }
.file-item input[type="checkbox"] { flex-shrink: 0; }
.badge {
  font-size: 10px; font-weight: 700; border-radius: 5px; padding: 1px 5px; margin-left: 4px;
}
.badge.gps { background: #ffe3e1; color: #b3261e; }
.badge.edited { background: #e5f2ff; color: #0a5dc2; }
.sidebar-hint { color: var(--text-dim); font-size: 11.5px; margin-top: 10px; }

/* ---------- tabs & panels ---------- */
.content { min-width: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: none; background: none; padding: 10px 16px; font-size: 14px; font-weight: 600;
  color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-header h2 { margin: 0; font-size: 17px; }
.apply-scope { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-dim); }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: filter .1s;
}
.btn:hover { filter: brightness(0.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { border-color: #ffc9c5; color: #b3261e; background: #fff5f4; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.linklike { border: none; background: none; color: var(--accent); cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; }

label { display: block; font-size: 13px; font-weight: 600; margin: 8px 0 4px; }
input[type="text"], input[type="datetime-local"] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; background: var(--surface); color: var(--text);
}
input:focus { outline: 2px solid #b3d7ff; border-color: var(--accent); }

/* ---------- viewer ---------- */
.viewer-body { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 18px; }
@media (max-width: 900px) { .viewer-body { grid-template-columns: 1fr; } }
.viewer-preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.viewer-preview img { max-width: 100%; max-height: 420px; border-radius: 8px; display: block; margin: 0 auto; }
.viewer-preview .no-preview { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--text-dim); }
.viewer-fields { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px 12px; }
.field-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f0f2; font-size: 13.5px; }
.field-row:last-child { border-bottom: none; }
.field-key { color: var(--text-dim); }
.field-value { word-break: break-word; }
.field-value .sep { color: var(--text-dim); }

details.allmeta { margin-top: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px 14px; }
details.allmeta summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.meta-filter { margin: 10px 0; }
.meta-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.meta-table th { text-align: left; color: var(--text-dim); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.meta-table td { padding: 5px 8px; border-bottom: 1px solid #f0f0f2; vertical-align: top; word-break: break-word; }
.meta-table td.cat { color: var(--accent); font-weight: 600; white-space: nowrap; }
.privacy-flag { color: #b3261e; font-weight: 700; }

/* ---------- privacy ---------- */
.privacy-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.summary-card .cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.summary-card h3 { margin: 0; font-size: 14px; }
.summary-card .count { font-size: 24px; font-weight: 700; margin: 6px 0 2px; }
.summary-card .affected { font-size: 11.5px; color: var(--text-dim); margin-bottom: 8px; }
.severity { font-size: 10.5px; font-weight: 800; border-radius: 6px; padding: 2px 7px; text-transform: uppercase; letter-spacing: .4px; }
.severity.high { background: #ffe3e1; color: #b3261e; }
.severity.medium { background: #fff1d6; color: #9a6200; }
.severity.low { background: #ececf0; color: #55555c; }
.findings-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 12px; }
.findings-group h3 { font-size: 13.5px; margin: 4px 0 8px; }
.finding-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f0f0f2; font-size: 13px; align-items: center; }
.finding-row:last-child { border-bottom: none; }
.finding-detail { color: var(--text-dim); font-size: 12.5px; }
.empty-note { color: var(--text-dim); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; }

/* ---------- edit panel ---------- */
.edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.edit-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.edit-card legend { font-weight: 700; font-size: 13.5px; padding: 0 4px; }
.edit-card .btn { align-self: flex-start; }
.card-hint { color: var(--text-dim); font-size: 11.5px; margin: 0; }
.edit-history { margin-top: 18px; }
.edit-history h3 { font-size: 14px; }
.history-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 10px; font-size: 13px; }
.history-group .when { color: var(--text-dim); font-size: 11.5px; }
.history-group ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- presets ---------- */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.preset-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.preset-card h3 { margin: 0; font-size: 14.5px; }
.preset-card p { margin: 0; color: var(--text-dim); font-size: 12.5px; flex: 1; }

/* ---------- export ---------- */
.export-list { display: flex; flex-direction: column; gap: 8px; }
.export-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; font-size: 13px; }
.export-row .grow { flex: 1; min-width: 0; }
.export-row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.export-row .sub { color: var(--text-dim); font-size: 11.5px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; align-items: center; }
.toast {
  background: #1d1d1f; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); animation: toast-in .18s ease-out; max-width: 80vw;
}
.toast.error { background: #b3261e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.drop-overlay {
  position: fixed; inset: 0; background: rgba(10, 132, 255, .12); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 40; pointer-events: none;
}
.drop-overlay > div {
  background: var(--surface); border: 2px dashed var(--accent); color: var(--accent);
  font-weight: 700; font-size: 18px; padding: 40px 64px; border-radius: 20px;
}

.footer { text-align: center; color: var(--text-dim); font-size: 11.5px; padding: 14px 20px 22px; }
.footer span { display: block; }
