/* map.css */
html, body { height: 100%; margin: 0; padding: 0; font-family: sans-serif; display: flex; flex-direction: column; overflow: hidden; background-color: #f8f9fa; }

#loginScreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); z-index: 3000; display: flex; justify-content: center; align-items: center; flex-direction: column; }
.login-box { background: white; padding: 30px 20px; border-radius: 12px; width: 85%; max-width: 320px; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.login-input { width: 90%; padding: 12px; margin-bottom: 15px; border: 1px solid #ccc; border-radius: 6px; font-size: 16px; box-sizing: border-box; }
.login-btn { background: #795548; color: white; border: none; padding: 14px; width: 90%; border-radius: 6px; font-size: 16px; font-weight: bold; cursor: pointer; }

.control-panel { position: absolute; top: 0; left: 0; width: 100%; box-sizing: border-box; padding: 10px; background-color: transparent; z-index: 10; display: flex; justify-content: center; box-shadow: none; pointer-events: none; }
.control-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; pointer-events: auto; }

.ctrl-btn { padding: 8px 12px; font-size: 12px; font-weight: bold; cursor: pointer; border-radius: 5px; box-sizing: border-box; }

.search-container { position: relative; display: flex; align-items: center; }
#searchInput { width: 220px; padding: 8px 12px; border-radius: 20px; border: 1px solid #888; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); font-size: 16px; }
#searchSuggestions { position: absolute; top: 100%; left: 0; width: 100%; background: white; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 2000; max-height: 250px; overflow-y: auto; display: none; margin-top: 5px; }
.suggestion-item { padding: 12px; cursor: pointer; border-bottom: 1px solid #eee; font-size: 14px; text-align: left; color: #333; }

#map { flex-grow: 1; width: 100%; }

.mobile-bottom-bar {
  display: flex;
  background: #fff;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.12);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
  justify-content: center;
  flex-shrink: 0;
  border-top: 1px solid #e0e0e0;
}

.mobile-bottom-bar button {
  flex: 1;
  max-width: 100px;
  background: none;
  border: none;
  padding: 8px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #555;
  border-radius: 0;
}

.mobile-bottom-bar button:hover { background: #f5f5f5; }
.mobile-bottom-bar button:active { background: #f0f0f0; }

input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea { padding: 8px; font-size: 16px; border-radius: 5px; border: 1px solid #aaa; box-sizing: border-box; width: 100%; }
.form-label { display: block; font-size: 14px; color: #555; margin-bottom: 5px; font-weight: bold; margin-top: 10px; text-align: left; }

#modal { display: none; position: fixed; z-index: 9999; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); justify-content: center; align-items: center; }
.modal-content { background: #fff; color: #333; padding: 20px; border-radius: 12px; width: 90%; max-width: 400px; max-height: 85vh; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.3); text-align: left; }

.polygon-label { text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; font-weight: bold; font-size: 12px; }

/* 圃場メモ（CAD風） */
#fieldMemoOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: #1b120e;
  flex-direction: column;
}
#fieldMemoOverlay.open { display: flex; }
#fieldMemoHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #4E342E;
  color: #fff;
  flex-shrink: 0;
}
#fieldMemoMapWrap {
  flex: 1;
  position: relative;
  min-height: 0;
}
#fieldMemoMap { width: 100%; height: 100%; }
#fieldMemoPanel {
  background: #2c211c;
  color: #eee;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  border-top: 1px solid #5D4037;
  max-height: 48vh;
  overflow-y: auto;
}
.fm-btn {
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
}
.fm-btn:disabled { opacity: 0.5; cursor: default; }
.fm-btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.fm-btn-row .fm-btn { flex: 1; min-width: 70px; }
.fm-tool.active { outline: 2px solid #FFD54F; outline-offset: 1px; }

@media screen and (max-width: 768px) {
  .control-panel {
    padding: 8px 10px;
  }

  .control-row {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .control-row::-webkit-scrollbar {
    height: 4px;
  }

  .control-row::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.45);
    border-radius: 2px;
  }

  .control-row > * {
    flex-shrink: 0;
  }

  #searchInput {
    width: 200px;
  }
}

