/* matmap.nlink.kr - Modern Minimal Dark & Glassmorphism */
:root {
  --bg-primary: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.88);
  --bg-input: #1e293b;
  --border-color: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-blue: #38bdf8;
  --accent-green: #10b981;
  --danger: #ef4444;
  --font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

input, textarea, select, [contenteditable="true"], .selectable {
  -webkit-user-select: text;
  user-select: text;
}

#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Header & Search Bar */
.floating-header {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 480px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-box-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.brand-badge {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.5px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 10px;
  cursor: pointer;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.header-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s;
}

.header-btn:hover {
  color: var(--text-main);
}

/* Floating Action Button (영수증 인증) */
.fab-certify {
  position: absolute;
  bottom: 28px;
  right: 16px;
  z-index: 10;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fab-certify:active {
  transform: scale(0.95);
}

/* Quick Tools (GPS 내 위치 & 약관) */
.floating-tools {
  position: absolute;
  right: 16px;
  bottom: 90px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: background 0.2s, transform 0.15s;
}

.tool-circle-btn:active {
  transform: scale(0.92);
}

/* Custom Map Marker */
.mat-marker {
  cursor: pointer;
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid rgba(245, 158, 11, 0.8);
  border-radius: 9999px;
  padding: 5px 11px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  transform: translate(-50%, -100%);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.mat-marker:hover, .mat-marker.active {
  transform: translate(-50%, -105%) scale(1.08);
  border-color: #fbbf24;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.5);
}

.mat-marker-name {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  margin-right: 6px;
  white-space: nowrap;
}

.mat-marker-badge {
  background: #f59e0b;
  color: #0f172a;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Bottom Sheet / Card */
.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 32px 20px;
  z-index: 20;
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

@media (min-width: 481px) {
  .bottom-sheet {
    left: 50%;
    transform: translate(-50%, 105%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    bottom: 24px;
    padding: 22px;
  }
  .bottom-sheet.open {
    transform: translate(-50%, 0) !important;
  }
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 0 auto 14px auto;
}

.sheet-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.sheet-title {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
}

.sheet-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
}

.sheet-address {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.sheet-stats-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.sheet-stats-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-gold);
}

.sheet-stats-desc {
  font-size: 12.5px;
  color: #fde68a;
  line-height: 1.4;
}

.sheet-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
}

.action-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #0f172a;
  color: #ffffff;
  font-size: 13.5px;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-gold);
}

.info-box {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: #bae6fd;
  line-height: 1.45;
  margin-bottom: 16px;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:active {
  opacity: 0.9;
}

/* In-App Terms Tabs */
.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 8px;
}

.tab-btn.active {
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.15);
}

.terms-content {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.6;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* In-App Camera Viewfinder */
.camera-view-wrapper {
  position: relative;
  width: 100%;
  height: 230px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#captured-preview-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

#captured-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.camera-guide-overlay {
  position: absolute;
  top: 14px;
  left: 20px;
  right: 20px;
  bottom: 14px;
  border: 2px dashed rgba(245, 158, 11, 0.7);
  border-radius: 10px;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.guide-text {
  background: rgba(15, 23, 42, 0.85);
  color: #fde68a;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.camera-action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-shutter {
  flex: 2;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-shutter:active {
  transform: scale(0.97);
}

.btn-retake {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: #f8fafc;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-toggle-gallery {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
  text-align: center;
  width: 100%;
  margin-bottom: 10px;
}

/* Ultra-Compact Zero-Scroll Overrides */
.modal-card.compact-modal {
  padding: 16px 16px 18px 16px !important;
  max-width: 420px;
}

.camera-view-wrapper.compact-cam {
  height: 220px !important;
  margin-bottom: 8px !important;
}

.compact-btn {
  padding: 10px 14px !important;
  font-size: 13.5px !important;
}

.compact-input {
  padding: 9px 10px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
}

/* Autocomplete Dropdown for Store Name */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 130px;
  overflow-y: auto;
  background: #090d16;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
  z-index: 200;
}

.autocomplete-item {
  padding: 8px 10px;
  font-size: 12px;
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:active, .autocomplete-item:hover {
  background: rgba(245, 158, 11, 0.15);
}

.ac-name {
  font-weight: 700;
  color: #ffffff;
}

.ac-badge {
  font-size: 10.5px;
  color: var(--accent-gold);
  font-weight: 800;
}

/* Receipt Guide Aspect Ratio (Vertical) */
.camera-guide-overlay {
  top: 10px !important;
  bottom: 10px !important;
  left: 28px !important;
  right: 28px !important;
  border-radius: 12px !important;
}
