/* ===== リセットとベーススタイル ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  font-size: 16px;
}

/* ===== コンテナとレイアウト ===== */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
  margin-bottom: 20px;
}

/* ===== ヘッダー ===== */
h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
  font-size: 24px;
  font-weight: 700;
  padding-bottom: 15px;
  border-bottom: 3px solid #3498db;
}

/* ===== LINE連携状態表示（修正版） ===== */
.line-status {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.line-status.success {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.line-status.error {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

.line-status.warning {
  background-color: #fff3cd;
  color: #856404;
  border-color: #ffeaa7;
}

.line-icon {
  font-size: 16px;
  color: #00c300;
  flex-shrink: 0;
}

.line-status-content {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.hidden {
  display: none !important;
}

/* ===== フォームグループ ===== */
.form-group {
  margin-bottom: 30px;
}

.form-label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 16px;
}

.label-note {
  font-size: 12px;
  font-weight: normal;
  color: #e74c3c; /* 少し目立つ色に */
  margin-left: 8px;
}

/* ===== ラジオボタン（改善版） ===== */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #ffffff;
}

.radio-item:hover {
  border-color: #3498db;
  background-color: #f8f9fa;
}

.radio-item input[type="radio"] {
  margin: 0;
  margin-right: 12px;
  width: 18px;
  height: 18px;
  accent-color: #3498db;
  cursor: pointer;
}

.radio-item label {
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #2c3e50;
  flex: 1;
}

.radio-item input[type="radio"]:checked + label,
.radio-item:has(input[type="radio"]:checked) {
  color: #3498db;
  font-weight: 600;
}

.radio-item:has(input[type="radio"]:checked) {
  border-color: #3498db;
  background-color: #e3f2fd;
}

/* ===== テキストエリア ===== */
textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s ease;
}

/* === テキストエリアのハイライト用オーバーレイ === */
.textarea-wrapper {
  position: relative;
}

.textarea-wrapper textarea {
  position: relative;
  background: transparent; /* オーバーレイと重ねるため */
  z-index: 1;
}

.textarea-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 12px 16px; /* textareaと合わせる */
  border: 2px solid transparent; /* レイアウト合わせ用 */
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: transparent; /* 通常文字は見えない（下のtextareaを見せる） */
  pointer-events: none; /* 操作はtextareaに通す */
  overflow: hidden;
}

.textarea-overlay .overflow {
  color: #e74c3c; /* 上限超過部分を赤く表示 */
}

textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea::placeholder {
  color: #6c757d;
  font-style: italic;
}

/* ===== 写真コントロール ===== */
.photo-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.button-like-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.button-like-input:hover {
  background-color: #5a6268;
  transform: translateY(-1px);
}

/* ===== 画像プレビュー ===== */
#image-preview {
  display: none;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 2px solid #e9ecef;
  margin-top: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== 地図セクション（修正版） ===== */
#map-wrapper {
  position: relative;
  width: 100%;
  height: 300px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 15px;
  background-color: #f8f9fa;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

#center-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  font-size: 24px;
  color: #e74c3c;
  z-index: 1000;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#coords-display {
  padding: 10px 12px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  font-size: 14px;
  color: #495057;
  text-align: center;
  font-family: 'Courier New', monospace;
}

/* ===== 送信ボタン ===== */
#btn-submit {
  width: 100%;
  padding: 18px 28px;
  min-height: 56px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3);
}

#btn-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(52, 152, 219, 0.4);
}

#btn-submit:disabled {
  background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== ローディング画面 ===== */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loader {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-text {
  margin-top: 20px;
  color: white;
  font-size: 16px;
  font-weight: 600;
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 768px) {
  .container {
    margin: 10px;
    padding: 16px;
    border-radius: 8px;
  }
  
  h2 {
    font-size: 20px;
    margin-bottom: 24px;
  }
  
  .form-group {
    margin-bottom: 24px;
  }
  
  .photo-controls {
    flex-direction: column;
  }
  
  .button-like-input {
    width: 100%;
    justify-content: center;
  }
  
  #map-wrapper {
    height: 250px;
  }
}

@media (max-width: 480px) {
  .container {
    margin: 5px;
    padding: 12px;
  }
  
  h2 {
    font-size: 18px;
  }
  
  .form-label {
    font-size: 15px;
  }
  
  .radio-item {
    padding: 10px 12px;
  }
  
  .radio-item label {
    font-size: 14px;
  }
  
  #map-wrapper {
    height: 200px;
  }
  
  #btn-submit {
    padding: 16px 24px;
    min-height: 56px;
    font-size: 16px;
  }
}

/* ===== 通知スタイル ===== */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  z-index: 10000;
  max-width: 300px;
  word-wrap: break-word;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.3s ease-out;
}

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

.notification-success {
  background-color: #28a745;
}

.notification-error {
  background-color: #dc3545;
}

.notification-warning {
  background-color: #ffc107;
  color: #212529;
}

.notification-info {
  background-color: #17a2b8;
}

/* ===== アクセシビリティ改善 ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== フォーカス状態の改善 ===== */
button:focus,
input:focus,
textarea:focus,
.radio-item:focus-within {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

/* ===== 印刷スタイル ===== */
@media print {
  .photo-controls,
  #btn-submit,
  .loader-overlay {
    display: none !important;
  }
  
  .container {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  #map-wrapper {
    border: 1px solid #000;
    background-color: #f0f0f0;
  }
}
