/* ======= 共通レイアウト ======= */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
  padding: 0;
  background-color: #f9f9f9;
}

h1,
h2,
h3 {
  color: #333;
}

input,
select,
button,
label {
  display: block;
  margin: 10px 0;
  padding: 8px;
  width: 90%;
  max-width: 400px;
  font-size: 16px;
}

button {
  background: #4caf50;
  color: #fff;
  border: none;
  cursor: pointer;
}

button:hover {
  background: #45a049;
}

#productList {
  margin-top: 20px;
}

#productList div {
  background: #fff;
  border: 1px solid #ddd;
  padding: 10px;
  margin-bottom: 10px;
}

#totals {
  margin-top: 20px;
  padding: 10px;
  background: #eef;
  border: 1px solid #ccd;
}

#logoArea {
  text-align: right;
  margin-bottom: 10px;
}

#companyLogo {
  width: 150px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.modal-content {
  background: #fff;
  padding: 20px;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
}

#searchCustomerResults {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid #ccc;
}

#searchCustomerResults div {
  padding: 8px;
  border-bottom: 1px solid #ccc;
  cursor: pointer;
}

#searchCustomerResults div:hover {
  background: #f0f0f0;
}

.page {
  page-break-after: always;
  padding: 20px;
  border: 2px solid #000;
  background: #fff;
}

.page h3 {
  margin-top: 0;
}

.page table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.page th,
.page td,
.page table {
  border: 1px solid #000;
}

.page th,
.page td {
  padding: 5px;
}

@media print {
  body * {
    visibility: hidden;
  }

  #orderPages,
  #orderPages * {
    visibility: visible;
  }

  #orderPages {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  #logoArea,
  #companyLogo {
    display: block;
    position: fixed;
    top: 10px;
    right: 20px;
  }
}

.required {
  color: red;
  margin-left: 4px;
}

.input-error {
  border: 2px solid red;
  background: #ffe6e6;
}

/* ======= 管理ダッシュボード専用 ======= */
body.dashboard-bg {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(130deg, #f5f7fa 0%, #c3cfe2 100%);
  font-family: "Inter", system-ui, Arial, sans-serif;
}

.dashboard-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.dashboard-logo {
  width: 160px;
  margin: 0 auto 1.5rem;
}

.dashboard-heading {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 2rem;
}

.dashboard-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-btn {
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: block;
  width: 90%;
  max-width: 400px;
  text-align: center;
}

label.dashboard-btn {
  width: 90% !important;
  max-width: 400px !important;
  margin: 1rem auto !important;
  text-align: center !important;
}

.dashboard-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.dashboard-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* ===== カード幅バリエーション ===== */
.dashboard-card[style*="max-width: 800"] {
  max-width: 800px;
}

.dashboard-card[style*="max-width: 780"] {
  max-width: 780px;
}

.dashboard-card[style*="max-width: 700"] {
  max-width: 700px;
}

/* 1) ダッシュボードカード内のフォーム要素を中央寄せ */
.dashboard-card input,
.dashboard-card select,
.dashboard-card button,
.dashboard-card label {
  margin-left: auto;
  margin-right: auto;
}

/* 2) ラベル文字は左寄せのまま、要素自体は中央配置 */
.dashboard-card label {
  text-align: left;
  width: 90%;
  max-width: 400px;
}

/* 3) 受注伝票 .page は常に左寄せ */
.page {
  text-align: left !important;
}

/* ===== order_history テーブル装飾 ===== */
#historyTable thead th,
#historyTable tbody td {
  border-bottom: 1px solid #e0e0e0;
  padding: 0.45rem 0.6rem;
  text-align: center;
  font-size: 0.9rem;
}
#historyTable tbody tr:hover {
  background: #f6f8ff;
}
.icon-cell {
  color: #555;
  cursor: pointer;
}
.icon-cell .fa-file-csv {
  color:#1e88e5;
}

.icon-cell .fa-search {
  color:#3c3c3c;
}

.icon-cell:hover {
  opacity: .75;
}

#searchForm {
  gap: .3rem !important;
}

#searchForm label {
  gap: .25rem;
}

#searchForm input[type="text"],
#searchForm input[type="date"],
#searchForm select {
  margin: 2px 0;
}

/* ===== 受注詳細モーダル ===== */
#detailModal .modal-content h3 {
  text-align: center;
}

#detailModal .modal-content button {
  display: block;
  margin: 1rem auto 0;
}

/* ===== 検索件数ラベル ===== */
#countArea { font-weight: 600; margin-bottom: .4rem; }

/* ===== ページネーション ===== */
#pager {
  display: flex;
  flex-direction: row; 
  justify-content: center;
  align-items: center;
  gap: .3rem;
  font-size: 1rem;
}

#pager .pager-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
  padding: 0 .2rem;
  min-width: auto;
  font-size: .8rem; 
  border-bottom-width: 2px;
}

#pager .pager-btn:hover:not(.disabled) {
  color: #1976d2;
}

#pager .pager-btn.active {
  color: #1976d2;
  font-weight: 600;
  border-bottom: 2px solid #1976d2;
  border-bottom-width: 2px;
  padding-bottom: 1px;
}

#pager .pager-btn.disabled {
  cursor: default; opacity: .35;
}

/* ===== 商品検索結果テーブル装飾 ===== */
#resultTable thead th,
#resultTable tbody td {
  border-bottom: 1px solid #e0e0e0;
  padding: 0.45rem 0.6rem;
  text-align: center;
  font-size: 0.9rem;
}

#resultTable tbody tr:hover {
  background: #f6f8ff;
}

#resultTable .icon-cell {
  color: #555;
  cursor: pointer;
}

#resultTable .fa-pen-to-square {
  color: #1e88e5;
}

#resultTable .fa-search {
  color: #3c3c3c;
}

.material-icons.export-icon {
  font-size: 1.2rem;
  color: #1e88e5;
  cursor: pointer;
}

.material-icons.detail-icon,
.material-icons.export-icon {
  font-size: 1.2rem;
  cursor: pointer;
}

.material-icons.detail-icon {
  color: #3c3c3c;
}

#searchCustomerResults {
  max-height: 160px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0;
}

#searchCustomerResults::-webkit-scrollbar {
  width: 6px;
}
#searchCustomerResults::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}
#searchCustomerResults::-webkit-scrollbar-track {
  background: transparent;
}

#productList > .product-box {
  border: 1px solid #ddd;
  background-color: #fafafa;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#productList > .product-box > .product-field,
#productList > .product-box > .delete-row {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 0 0.5rem 0;
}

#productList > .product-box > .delete-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.5rem;
}

.delete-btn {
  background-color: #e57373;
  color: #fff !important;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
  width: auto;
}
.delete-btn:hover {
  background-color: #ef5350;
}

.product-field {
  font-size: 0.95rem;
  color: #333;
}

#productList > .product-box > .product-field,
#productList > .product-box > .delete-row *:not(.delete-btn) {
  border: none !important;
  background: transparent !important;
}

@media print {
  html, body {
    background: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    margin: 0 !important;
  }

  .wrapper, .container, #root {
    background: transparent !important;
  }

  .print-hidden, .footer, .btn-area {
    display: none !important;
  }

  @page {
    size: A4 portrait;
    margin: 20mm;
  }
}