/* 注文画面固有スタイル */

/* 全体コンテナ */
body {
  max-width: 600px;
  margin: 0 auto;
  background: #f8fafc;
}

/* ヘッダー（sticky） */
.order-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 100;
}

.table-badge {
  background: linear-gradient(135deg, var(--color-order) 0%, var(--color-order-hover) 100%);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1rem;
}

.table-badge-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-badge-icon {
  font-size: 1.25rem;
}

.admin-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.admin-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 大カテゴリタブ */
.main-category-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
}

.main-category-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9375rem;
  background: #f8fafc;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  color: #64748b;
}

.main-category-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
}

/* 小カテゴリグリッド */
.sub-category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  background: #f8fafc;
}

.sub-category-btn {
  padding: 10px 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-category-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sub-category-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* メインコンテンツ */
.order-content {
  padding-bottom: 100px;
  /* カートバー分 */
}

/* メニューアイテム（モバイル最適化） */
.menu-item-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin: 0 12px 10px;
}

.menu-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.menu-item-name {
  font-weight: 600;
  font-size: 0.9375rem;
  flex: 1;
  padding-right: 8px;
}

.menu-item-price {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.menu-item-price.free {
  color: #10b981;
  font-size: 0.8125rem;
}

/* 数量セレクタ */
.qty-row {
  display: flex;
  gap: 6px;
}

.qty-btn {
  flex: 1;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.1s;
}

.qty-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.qty-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* チェックボックス選択（チーズ盛り等） */
.option-checkbox-group {
  margin-left: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
}

.option-checkbox-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

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

.option-checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  accent-color: var(--primary);
}

.option-checkbox-item label {
  flex: 1;
  font-size: 0.875rem;
}

.selection-warning {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 4px;
  padding: 4px 8px;
  background: #fef2f2;
  border-radius: 4px;
}

.selection-ok {
  color: #10b981;
  font-size: 0.75rem;
  margin-top: 4px;
  padding: 4px 8px;
  background: #ecfdf5;
  border-radius: 4px;
}

/* セクション見出し */
.section-divider {
  padding: 12px 16px 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  margin: 0 12px 8px;
  border-radius: 6px;
}

/* 手打ちメニュー追加 */
.custom-add-section {
  margin: 16px 12px;
  padding: 16px;
  background: #f1f5f9;
  border-radius: 10px;
}

.custom-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
}

.custom-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.custom-item-form {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
}

.custom-item-row {
  margin-bottom: 10px;
}

.custom-item-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
}

.custom-item-row input {
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9375rem;
}

.custom-item-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.custom-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.custom-item-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.custom-item-cancel {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
}

.custom-item-add {
  background: var(--primary);
  border: none;
  color: #fff;
}

/* カートバー */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 16px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

/* cart-bar-enhancedで上書きされない場合のデフォルト */
.cart-bar:not(.cart-bar-enhanced) {
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

.cart-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-info {
  font-size: 0.9375rem;
}

.cart-count {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.125rem;
}

.cart-total {
  font-weight: 700;
  font-size: 1.25rem;
}

.cart-btn {
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
}

.cart-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* 追加済みカスタムアイテム表示（カード形式） */
.custom-items-added {
  margin: 0 12px 12px;
}

.custom-item-card {
  background: #fff;
  border: 1px solid #10b981;
  border-left: 4px solid #10b981;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.custom-item-card .menu-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.custom-item-card .menu-item-name {
  font-weight: 600;
  font-size: 0.9375rem;
  flex: 1;
}

.custom-item-card .menu-item-price {
  font-weight: 700;
  color: #10b981;
}

.custom-item-card .custom-item-qty {
  font-size: 0.875rem;
  color: #64748b;
}

.custom-item-card .remove-btn {
  padding: 6px 12px;
  background: #fee2e2;
  border: none;
  border-radius: 6px;
  color: #ef4444;
  font-size: 0.75rem;
  cursor: pointer;
  margin-top: 8px;
}

/* テーブル選択画面 */
.table-select-screen {
  min-height: 100vh;
  background: linear-gradient(180deg, #dbeafe 0%, #f1f5f9 100%);
  display: flex;
  flex-direction: column;
}

.table-select-header {
  background: linear-gradient(135deg, var(--color-order) 0%, var(--color-order-hover) 100%);
  color: #fff;
  padding: 24px 16px;
  text-align: center;
}

.table-select-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.table-select-header p {
  font-size: 0.875rem;
  opacity: 0.9;
}

.table-select-content {
  flex: 1;
  padding: 20px 16px;
}

.table-group {
  margin-bottom: 24px;
}

.table-group-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.table-select-btn {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table-select-btn:hover {
  border-color: var(--color-order);
  color: var(--color-order);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

.table-select-btn:active {
  transform: translateY(0);
}

.table-select-btn.has-order {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  color: #92400e;
}

.table-select-btn .table-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.table-select-btn .table-name {
  font-size: 1rem;
}

.table-select-btn .order-badge {
  font-size: 0.625rem;
  padding: 2px 6px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  margin-top: 4px;
}

.admin-quick-link {
  display: block;
  text-align: center;
  padding: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #64748b;
  text-decoration: none;
  font-weight: 600;
  margin-top: 16px;
  transition: all 0.2s ease;
}

.admin-quick-link:hover {
  background: #f8fafc;
  color: var(--color-admin);
}

/* 注文メイン画面（テーブル選択時は非表示） */
.order-main {
  display: none;
}

.order-main.active {
  display: block;
}
