/* 管理画面固有スタイル */
.admin-nav {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 16px;
  overflow-x: auto;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.admin-nav-item {
  flex: 1;
  padding: 12px 16px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  text-align: center;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  font-size: 0.875rem;
}

.admin-nav-item:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.admin-nav-item.active {
  background: var(--color-admin);
  color: #fff;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* メニュー編集 */
.category-group {
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

.category-title {
  font-weight: 700;
  font-size: 0.9375rem;
}

.category-actions {
  display: flex;
  gap: 8px;
}

.category-actions button {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.menu-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.menu-item-row:hover {
  background: #f8fafc;
}

.menu-item-row:last-child {
  border-bottom: none;
}

.menu-item-row.dragging {
  opacity: 0.5;
  background: #dbeafe;
}

.drag-handle {
  cursor: grab;
  color: #94a3b8;
  font-size: 1rem;
  padding: 4px;
}

.drag-handle:active {
  cursor: grabbing;
}

.menu-item-row input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.menu-item-row input[type="number"] {
  width: 80px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  text-align: right;
}

.menu-item-row input:focus {
  outline: none;
  border-color: var(--color-admin);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.delete-btn {
  padding: 6px 10px;
  background: #fee2e2;
  border: none;
  border-radius: 6px;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.delete-btn:hover {
  background: #fecaca;
}

.add-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  background: #f8fafc;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  width: 100%;
  transition: all 0.15s ease;
}

.add-item-btn:hover {
  background: #f1f5f9;
  color: var(--color-admin);
}

/* 注文画面風メニュー管理UI */
.menu-main-tab {
  padding: 10px 20px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.menu-main-tab:hover {
  background: #e2e8f0;
}

.menu-main-tab.active {
  background: linear-gradient(135deg, var(--color-admin) 0%, #6d28d9 100%);
  color: #fff;
}

.menu-sub-tab {
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-sub-tab:hover {
  border-color: var(--color-admin);
  color: var(--color-admin);
}

.menu-sub-tab.active {
  background: var(--color-admin);
  border-color: var(--color-admin);
  color: #fff;
}

.menu-item-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.15s ease;
}

.menu-item-card:hover {
  border-color: var(--color-admin);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
}

.menu-item-card.editing {
  background: #faf5ff;
  border-color: var(--color-admin);
}

.menu-item-info {
  flex: 1;
  min-width: 0;
}

.menu-item-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1e293b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item-price {
  font-size: 0.875rem;
  color: var(--color-admin);
  font-weight: 700;
  font-feature-settings: 'tnum';
}

.menu-item-actions {
  display: flex;
  gap: 6px;
}

.menu-item-actions button {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.menu-item-actions .edit-btn {
  background: #f1f5f9;
  color: #64748b;
}

.menu-item-actions .edit-btn:hover {
  background: #e2e8f0;
  color: var(--color-admin);
}

.menu-item-actions .delete-btn {
  background: #fee2e2;
  color: #ef4444;
}

.menu-item-actions .delete-btn:hover {
  background: #fecaca;
}

/* 編集フォーム（インライン） */
.menu-item-edit-form {
  display: flex;
  gap: 8px;
  flex: 1;
  align-items: center;
}

.menu-item-edit-form input {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
}

.menu-item-edit-form input[type="text"] {
  flex: 1;
  min-width: 0;
}

.menu-item-edit-form input[type="number"] {
  width: 100px;
  text-align: right;
}

.menu-item-edit-form input:focus {
  outline: none;
  border-color: var(--color-admin);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.empty-category-message {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* 売上レポート */
.report-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.report-bottom-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.report-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.report-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.report-card.highlight {
  background: linear-gradient(135deg, var(--color-admin) 0%, #6d28d9 100%);
  color: #fff;
  border: none;
}

.report-card-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.report-card.highlight .report-card-value {
  font-size: 1.75rem;
}

.report-card-label {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}

.report-card.highlight .report-card-label {
  color: rgba(255, 255, 255, 0.8);
}

.date-picker {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.date-picker input {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
}

.date-picker input:focus {
  outline: none;
  border-color: var(--color-admin);
}

/* 設定 */
.setting-group {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.setting-group-title {
  padding: 14px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  font-weight: 700;
  font-size: 0.875rem;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-group-title .icon {
  font-size: 1rem;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
}

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

.setting-label {
  font-weight: 600;
  font-size: 0.9375rem;
}

.setting-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

.setting-input {
  width: 200px;
}

.setting-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  resize: vertical;
  font-family: inherit;
}

.setting-textarea:focus {
  outline: none;
  border-color: var(--color-admin);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* 詳細リスト */
.detail-list-item {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}

.detail-list-item:last-child {
  border-bottom: none;
}

/* QRコードセクション */
.qr-settings {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.qr-settings-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.qr-settings-row input {
  flex: 1;
  min-width: 200px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.qr-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.qr-card:hover {
  box-shadow: var(--shadow);
}

.qr-card canvas {
  margin-bottom: 8px;
}

.qr-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-order);
  margin-bottom: 4px;
}

.qr-card-url {
  font-size: 0.625rem;
  color: #94a3b8;
  word-break: break-all;
}

.qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.qr-card-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 8px;
}

.qr-card-actions button {
  padding: 4px 8px;
  font-size: 0.625rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.qr-card-actions button:hover {
  background: #f8fafc;
  color: var(--color-order);
  border-color: var(--color-order);
}

.qr-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

/* 印刷用スタイル（3cm四方 ≈ 113px @96dpi） */
@media print {

  /* すべて非表示 */
  body * {
    visibility: hidden;
  }

  /* 印刷エリアのみ表示 */
  #qr-print-area,
  #qr-print-area * {
    visibility: visible;
  }

  #qr-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
  }

  .qr-print-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5mm;
    padding: 5mm;
    justify-content: flex-start;
  }

  .qr-print-item {
    text-align: center;
    page-break-inside: avoid;
    border: 1px solid #000;
    padding: 2mm;
    width: 32mm;
    box-sizing: border-box;
  }

  .qr-print-item img {
    display: block;
    width: 28mm !important;
    height: 28mm !important;
    margin: 0 auto;
  }

  .qr-print-item .table-name {
    font-size: 10pt;
    font-weight: bold;
    margin-top: 1mm;
  }
}

/* ========== スマホ対応（480px以下） ========== */
@media (max-width: 480px) {

  /* カテゴリヘッダーを縦積みに */
  .category-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .category-header .category-title-input {
    font-size: 1rem;
    padding: 8px 0;
  }

  .category-actions {
    justify-content: flex-end;
  }

  .category-actions button {
    padding: 8px 12px;
    font-size: 0.8125rem;
  }

  /* メニュー行を縦積みに */
  .menu-item-row {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }

  .menu-item-row .drag-handle {
    order: -1;
  }

  .menu-item-row input[type="text"] {
    flex: 1 1 100%;
    order: 1;
  }

  .menu-item-row input[type="number"] {
    width: 100px;
    order: 2;
  }

  .menu-item-row .delete-btn {
    order: 3;
    margin-left: auto;
  }

  /* レポート */
  .report-bottom-row {
    grid-template-columns: 1fr;
  }

  /* 設定グループ */
  .setting-item {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }

  .setting-item>div:last-child {
    width: 100%;
  }

  .setting-item input[type="text"] {
    width: 100% !important;
  }
}
