/* style.css */

/* 基本スタイルとリセット */
:root {
  --primary-color: #00B900; /* LINE Green */
  --background-color: #f0f2f5;
  --text-color: #333;
  --card-bg-color: #ffffff;
  --footer-bg-color: #ffffff;
  --border-color: #e0e0e0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  padding-bottom: 80px; /* フッターの高さ分 */
}

/* ローディング画面 */
.loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; z-index: 1000; transition: opacity 0.3s;
}
.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1); width: 36px; height: 36px;
  border-radius: 50%; border-left-color: var(--primary-color);
  animation: spin 1s ease infinite; margin-bottom: 1rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ヘッダー */
.app-header {
  background-color: var(--primary-color); color: white; padding: 1rem;
  text-align: center; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* メインコンテンツ */
#app-main { padding: 1rem; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.menu-item-card {
  background-color: var(--card-bg-color); border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08); overflow: hidden;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column;
}
.menu-item-card:hover { transform: translateY(-5px); box-shadow: 0 4px 10px rgba(0,0,0,0.12); }
.menu-item-card img { width: 100%; height: 120px; object-fit: cover; }
.item-info { padding: 0.75rem; flex-grow: 1; }
.item-name { font-weight: bold; margin-bottom: 0.25rem; }
.item-price { color: #666; font-size: 0.9em; }

/* フッター (カート) */
.cart-footer {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background-color: var(--footer-bg-color); display: flex;
  justify-content: space-between; align-items: center; padding: 1rem;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.1); z-index: 100;
}
.view-cart-button {
  background-color: var(--primary-color); color: white; border: none;
  border-radius: 20px; padding: 0.75rem 1.5rem; font-size: 1rem;
  font-weight: bold; cursor: pointer; transition: background-color 0.2s;
}
.view-cart-button:disabled { background-color: #ccc; cursor: not-allowed; }
.total-price-display { font-size: 1.1rem; font-weight: bold; }

/* モーダル共通 */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6); display: none;
  justify-content: center; align-items: center; z-index: 200;
}
.modal-overlay.visible { display: flex; }
.modal-content {
  background-color: white; border-radius: 12px; width: 90%;
  max-width: 500px; max-height: 90vh; display: flex; flex-direction: column;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem; border-bottom: 1px solid var(--border-color);
}
.modal-header h2 { font-size: 1.2rem; }
.close-button { background: none; border: none; font-size: 1.8rem; cursor: pointer; color: #888; }
.modal-footer { padding: 1rem; border-top: 1px solid var(--border-color); background-color: #f9f9f9; }

/* カートモーダル */
.cart-items-container { padding: 1rem; overflow-y: auto; flex-grow: 1; }
.cart-item {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #f0f0f0;
}
.cart-item:last-child { border-bottom: none; margin-bottom: 0; }
.cart-item-details { flex-grow: 1; }
.cart-item-name { font-weight: bold; }
.cart-item-meta { font-size: 0.9em; color: #666; }
.cart-item-price { font-weight: bold; }
.cart-item-actions { display: flex; align-items: center; }
.quantity-controls { display: flex; align-items: center; margin-right: 1rem; }
.quantity-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-color);
  background-color: #f9f9f9; font-size: 1.2rem; cursor: pointer;
}
.quantity-display { padding: 0 1rem; font-weight: bold; }
.remove-item-btn { background: none; border: none; color: #ff4d4f; font-size: 1.5rem; cursor: pointer; }
.cart-summary-total { text-align: right; font-size: 1.2rem; margin-bottom: 1rem; }

/* 商品詳細モーダル */
.item-detail-body { padding: 1rem; overflow-y: auto; flex-grow: 1; }
.item-detail-img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px; margin-bottom: 1rem; }
#item-detail-description { margin-bottom: 1.5rem; color: #555; line-height: 1.6; }
.item-options { margin-bottom: 1.5rem; }
.option-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 1rem; border: 1px solid var(--border-color);
  border-radius: 8px; margin-bottom: 0.5rem; cursor: pointer; transition: all 0.2s;
}
.option-label:has(input:checked) { border-color: var(--primary-color); background-color: #f0fff0; font-weight: bold; }
.option-label input[type="radio"] { display: none; }
.option-price { color: var(--primary-color); font-weight: bold; }
.quantity-selector { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; font-size: 1rem; }

/* 汎用ボタン */
.submit-button {
  width: 100%; background-color: var(--primary-color); color: white;
  border: none; padding: 1rem; border-radius: 8px;
  font-size: 1.1rem; font-weight: bold; cursor: pointer;
}
.submit-button:disabled { background-color: #ccc; cursor: wait; }

/* カスタムアラート */
.custom-alert-body { padding: 1.5rem 1rem; text-align: center; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
#custom-alert-modal .modal-header h2 { width: 100%; text-align: center; }

/* ★追加: 配達オプションフォーム */
.order-options-container {
  padding: 0 1rem 1rem 1rem;
  border-top: 1px solid var(--border-color);
}
.order-options-container h3 { margin-bottom: 0.75rem; font-size: 1.1rem; padding-top: 1rem; }
.option-group { margin-bottom: 1rem; }
.delivery-details.hidden { display: none; }
.delivery-details { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border-color); }
.delivery-details h4 { margin-bottom: 0.75rem; }
.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; font-size: 0.9em; }
.form-group input[type="text"], .form-group select {
  width: 100%; padding: 0.75rem; border: 1px solid var(--border-color);
  border-radius: 8px; font-size: 1rem; font-family: inherit; background-color: #fff;
}
.address-input-group { display: flex; gap: 8px; }
#get-location-button { flex-shrink: 0; padding: 0 0.8rem; }
.form-group small { display: block; margin-top: 0.5rem; color: #777; font-size: 0.85em; }

