/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: #f5f5f5;
}

/* Layout */
.container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 400px;
  background: white;
  padding: 20px;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.sidebar-content {
  flex: 1;
}

h1 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: #333;
}

/* Config Section */
.config-section {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.config-section label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 5px;
}

.config-section input {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Facility List */
.facility-list {
  margin-bottom: 15px;
}

.facility-item {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.facility-item.found {
  border-left: 4px solid #4CAF50;
}

.facility-item.not-found {
  border-left: 4px solid #f44336;
}

.facility-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.facility-header input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.facility-name {
  flex: 1;
  font-size: 0.9rem;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-width: 0;
  background: white;
  color: #333;
}

.facility-details {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.85rem;
}

.facility-details label {
  color: #666;
}

.facility-details input {
  width: 70px;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.facility-status {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

.status-found {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-not-found {
  background: #ffebee;
  color: #c62828;
}

/* Buttons */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  width: 100%;
  margin-bottom: 10px;
  transition: background 0.2s;
}

.btn-primary {
  background: #1976D2;
  color: white;
}

.btn-primary:hover {
  background: #1565C0;
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-danger {
  background: #f44336;
  color: white;
}

.btn-danger:hover {
  background: #d32f2f;
}

.btn-add {
  background: #4CAF50;
  color: white;
  padding: 8px 15px;
  font-size: 0.85rem;
  width: auto;
}

.btn-add:hover {
  background: #43A047;
}

.btn-amazon {
  background: #FF9900;
  color: white;
  text-decoration: none;
  text-align: center;
  display: block;
}

.btn-amazon:hover {
  background: #E68A00;
}

.btn-googlemap {
  background: #34A853;
  color: white;
}

.btn-googlemap:hover {
  background: #2E8B47;
}

.btn-hazard {
  background: #E65100;
  color: white;
}

.btn-hazard:hover {
  background: #BF360C;
}

.btn-remove {
  background: #f44336;
  color: white;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-remove:hover {
  background: #d32f2f;
}

/* Map */
#map {
  flex: 1;
  min-height: 300px;
}

/* Legend */
.legend {
  background: white;
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  font-size: 0.85rem;
}

.legend h4 {
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  opacity: 0.5;
  flex-shrink: 0;
}

/* Loading */
.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px 40px;
  border-radius: 10px;
  z-index: 10000;
  display: none;
}

/* Map Instruction */
.map-instruction {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1976D2;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Facility Location */
.facility-location {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.location-set {
  font-size: 0.75rem;
  color: #2e7d32;
  background: #e8f5e9;
  padding: 2px 8px;
  border-radius: 10px;
}

.location-unset {
  font-size: 0.75rem;
  color: #c62828;
  background: #ffebee;
  padding: 2px 8px;
  border-radius: 10px;
}

.btn-location {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-location:hover {
  background: #e0e0e0;
}

.btn-clear-location {
  background: #ffebee;
  border-color: #ffcdd2;
  color: #c62828;
  font-size: 0.75rem;
}

.btn-clear-location:hover {
  background: #ffcdd2;
}

/* Ad Space */
.ad-space {
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid #eee;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.8rem;
}

/* Footer */
.footer {
  padding: 10px;
  text-align: center;
  font-size: 0.75rem;
  color: #888;
  border-top: 1px solid #eee;
}

.footer a {
  color: #1976D2;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
  .container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: 100%;
    max-height: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    order: 2;
  }

  #map {
    height: 50vh;
    min-height: 300px;
    order: 1;
  }

  h1 {
    font-size: 1.1rem;
  }

  .facility-header {
    flex-wrap: wrap;
  }

  .facility-name {
    width: 100%;
    order: 2;
    margin-top: 5px;
  }

  .facility-header input[type="checkbox"] {
    order: 1;
  }

  .btn-remove {
    order: 1;
    margin-left: auto;
  }

  .btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .ad-space {
    min-height: 80px;
  }
}

@media screen and (max-width: 480px) {
  .sidebar {
    padding: 15px;
  }

  .config-section {
    padding: 10px;
  }

  .facility-item {
    padding: 10px;
  }

  .facility-details {
    flex-wrap: wrap;
    gap: 5px;
  }
}
