/* ===============================
   Global Common Styles
=============================== */
html, body {
  font-family: 'Montserrat', 'Noto Sans JP', sans-serif;
  font-weight: 300;
  color: #555;
  margin: 0; padding: 0;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background: linear-gradient(135deg, rgba(179, 229, 179, 0.79) 0%, rgba(255, 255, 255, 0.89) 37%, rgba(255, 179, 179, 0.8) 100%);
  display: flex; align-items: center; justify-content: center;
}

/* 枠線リセット */
*:focus { outline: none !important; }
button, input, select { border: none; }

/* ===============================
   レイアウト
=============================== */
.layout-container { display: flex; width: 95vw; height: 90vh; gap: 24px; }
.sidebar-wrapper, .layout-content-wrapper { display: flex; flex-direction: column; gap: 16px; padding-top: 30px; }
.sidebar-wrapper { flex: 1; min-width: 240px; }
.layout-content-wrapper { flex: 4; padding-right: 20px; }

.sidebar, .layout-main-box {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 20px;
}
.sidebar { flex: 1; padding: 20px 12px; display: flex; flex-direction: column; }
.layout-main-box { flex: 1; padding: 30px 40px; overflow-y: auto; }

/* タイトル設定 */
.title-group { margin-bottom: 24px; }
.title p2 { font-size: 1.6rem; font-weight: 500; color: #333; }
.title p3 { font-size: 1rem; color: #888; margin-left: 8px; }

/* ===============================
   フォーム
=============================== */
.field-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.field-row label { width: 100px; font-size: 0.95rem; color: #666; font-weight: 500; }

/* ===============================
   ボタンデザイン（サイズ統一・ホワ〜ン版）
=============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  text-decoration: none;
  box-sizing: border-box;
  white-space: nowrap;

  transition:
    background-color 0.4s ease,
    transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 0.4s ease;

  position: relative;
  z-index: 10;
  pointer-events: auto !important;
}

/* メインボタン：緑 */
.btn-primary {
  background-color: #6abf69;
  color: white;
}
.btn-primary:hover {
  background-color: #7bcc7a;
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(106, 191, 105, 0.25);
}

/* サブボタン：グレー */
.btn-secondary {
  background-color: rgba(0, 0, 0, 0.05);
  color: #666;
}
.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.btn:active { transform: translateY(0px); }

/* ===============================
   完了済み（disabled）ボタンのスタイル
=============================== */
.btn:disabled,
.btn.disabled {
  background-color: #e0e0e0 !important;
  color: #999 !important;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
  opacity: 0.7;
}
.btn:disabled:hover {
  background-color: #e0e0e0 !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ===============================
   サイドバー
=============================== */
.sidebar-menu { list-style: none !important; padding: 0; }
.sidebar-menu a, .logout-link, .logout-button {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: 14px; color: #555; text-decoration: none;
  background: transparent; border: none !important;
  transition: all 0.4s ease;
}
.sidebar-menu a:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #6abf69;
  padding-left: 20px;
}
.sidebar-menu li.active a { background: rgba(179, 229, 179, 0.6) !important; color: #2d5a2d !important; }

/* 一覧：z-indexを整理してボタンをクリック可能にする */
#list { list-style: none; padding: 0; }
#list li {
  background: rgba(255, 255, 255, 0.5); padding: 12px 20px; border-radius: 12px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
  position: relative;
  z-index: 1;
}

/* ===============================
   Course Page / その他微調整
=============================== */
.course-container { max-width: 600px; }
.course-container .form-group { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.course-container .form-label { width: 200px; font-size: 0.95rem; font-weight: 500; color: #666; flex-shrink: 0; }
.course-container .form-actions { margin-left: 220px; margin-top: 32px; }

::placeholder { color: #bbb !important; opacity: 1; }

select:invalid, select option[value=""] { color: #bbb !important; }
select:has(option[value=""]:checked) { color: #bbb !important; }

/* ===============================
   完了一覧ページ専用デザイン
=============================== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  margin-top: 20px;
}
.table th {
  padding: 12px;
  font-size: 0.85rem;
  color: #888;
  font-weight: 500;
  border-bottom: 2px solid rgba(0,0,0,0.05);
  text-align: left;
}
.table td {
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  font-size: 0.95rem;
  color: #444;
}
.table tr td:first-child { border-radius: 12px 0 0 12px; }
.table tr td:last-child { border-radius: 0 12px 12px 0; }
.table td:last-child { font-weight: 600; color: #6abf69; }

/* ===============================
   合計エリア（背景グリーン・完全復元版）
=============================== */
.summary-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
  margin-bottom: 30px;
  padding: 24px;
  background: rgba(106, 191, 105, 0.2) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(106, 191, 105, 0.4);
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(106, 191, 105, 0.1);
}
.summary-item { flex: 1; min-width: 120px; text-align: center; }
.summary-label {
  display: block;
  font-size: 0.85rem;
  color: #4a754a;
  margin-bottom: 6px;
  font-weight: 600;
}
.summary-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1b4d1b;
}

/* ナビボタン */
.nav-button-group {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

/* ついでにテーブルの下の余白 */
.table { margin-bottom: 30px !important; }

/* ===============================
   通知メッセージ（フラッシュ）
=============================== */
.flash-message {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 12px 32px;
  border-radius: 50px;
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-width: 200px;
  text-align: center;
  pointer-events: none;
  animation: fadeInOut 4.5s ease-in-out forwards;
}
.flash-notice {
  background: rgba(106, 191, 105, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.flash-alert {
  background: rgba(235, 87, 87, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -20px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -20px); visibility: hidden; }
}

/* ===============================
   コース選択画面（タイル表示）
=============================== */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}
.course-card-link {
  text-decoration: none !important;
  color: inherit;
  display: block;
}
.course-card {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.course-card-link:hover .course-card {
  background: rgba(255, 255, 255, 0.6);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border-color: rgba(106, 191, 105, 0.4);
}
.course-icon {
  width: 48px;
  height: 48px;
  background: rgba(106, 191, 105, 0.15);
  color: #6abf69;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.course-info { flex: 1; }
.course-name {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}
.course-arrow { color: #ccc; transition: transform 0.4s ease; }
.course-card-link:hover .course-arrow { transform: translateX(5px); color: #6abf69; }

/* ===============================
   Dashboard：タブ・テーブル微調整
=============================== */
.dashboard-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 12px;
  width: fit-content;
}
.dash-tab {
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #777;
  transition: all 0.3s ease;
}
.dash-tab.active {
  background: white;
  color: #6abf69;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.pagination-wrapper { margin: 15px 0; font-size: 0.9rem; }
.time-highlight { color: #6abf69; font-weight: 600; }
.score-badge {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  font-weight: 500;
  color: #555;
}
.table td strong { color: #333; }

/* ===============================
   Dashboard：単日実績ページの調整
=============================== */
.filter-section {
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.3);
  padding: 16px 20px;
  border-radius: 15px;
  display: inline-block;
}
.filter-section label {
  font-weight: 500;
  color: #666;
  margin-right: 10px;
}
.table td.text-center { text-align: center; color: #999; padding: 40px; }

/* ===============================
   Analytics専用：グラフパネル
=============================== */
.analytics-chart-panel {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  padding: 30px;
  margin-top: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}
.analytics-chart-panel div { height: 400px !important; }

/* ===============================
   Settings：設定メニュー
=============================== */
.page-description { color: #777; font-size: 0.9rem; margin: 10px 0 25px 5px; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.setting-card-link { text-decoration: none !important; color: inherit; display: block; }
.setting-card {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.setting-card-link:hover .setting-card {
  background: rgba(255, 255, 255, 0.7);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
  border-color: rgba(106, 191, 105, 0.4);
}
.setting-icon {
  width: 44px;
  height: 44px;
  background: rgba(106, 191, 105, 0.1);
  color: #6abf69;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.setting-icon .material-symbols-outlined { font-size: 24px; }
.setting-info { flex: 1; }
.setting-title { display: block; font-size: 1rem; font-weight: 600; color: #333; }
.setting-sub { font-size: 0.75rem; color: #888; }
.setting-arrow { color: #ddd; transition: all 0.3s ease; }
.setting-card-link:hover .setting-arrow { color: #6abf69; transform: translateX(3px); }

/* ===============================
   Driver Settings：フォームデザイン
=============================== */
.settings-form-container { max-width: 600px; margin-top: 20px; }
.full-width { width: 100% !important; display: block !important; margin-bottom: 20px; }

.form-card {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.input-grid { display: flex; flex-direction: column; gap: 20px; }
.input-row { display: flex; gap: 15px; }
.input-row .input-group { flex: 1; }

.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #444;
  margin-bottom: 8px;
  margin-left: 4px;
}

.btn-wide {
  width: 100%;
  padding: 14px !important;
  font-size: 1rem !important;
  margin-top: 10px;
}

.form-actions { margin-top: 30px; }

/* ===============================
   入力欄（フォームコントロール）の視認性強化
=============================== */
.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background-color: rgba(255, 255, 255, 0.9) !important;
  border: 1.5px solid #d1d1d1 !important;
  border-radius: 10px;
  font-size: 1rem;
  color: #333;
  transition: all 0.2s ease;
  box-sizing: border-box;
}
.form-input::placeholder { color: #aaa; }
.form-input:focus,
.form-select:focus {
  outline: none;
  background-color: #fff !important;
  border-color: #6abf69 !important;
  box-shadow: 0 0 0 4px rgba(106, 191, 105, 0.2);
}
.select-wrapper::after { color: #666; }

/* ===============================
   Login Page：最終調整（重複統合）
=============================== */
.login-page-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: fadeInUp 0.8s ease-out;
}

.login-header-outside { margin-bottom: 35px; }

.login-footer-links {
  margin-top: 25px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 20px;
}
.login-footer-links a {
  font-size: 0.8rem;
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}
.login-footer-links a:hover { color: #6abf69; }

.login-card {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 30px;
  padding: 40px 30px;
  width: 100%;
  max-width: 380px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.main-brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}
.main-brand-logo .logo-dot {
  width: 14px;
  height: 14px;
  background-color: #6abf69;
  border-radius: 50%;
}
.main-brand-logo .logo-text {
  font-size: 2.4rem;
  font-weight: 800;
  color: #1b4d1b;
  letter-spacing: -0.02em;
}
.sub-welcome-text {
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ===============================
   Responsive：スマートフォン対応 (1024px以下)
=============================== */
@media (max-width: 1024px) {
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

  body {
    align-items: flex-start;
    padding: 10px;
  }

  .layout-container {
    flex-direction: column;
    width: 100%;
    height: auto;
    gap: 10px;
  }

  .sidebar-wrapper {
    min-width: unset;
    padding-top: 10px;
  }

  .layout-content-wrapper { padding-right: 0; }

  .layout-main-box {
    padding: 20px 15px;
    overflow-y: visible;
  }

  .sidebar { padding: 10px; }

  .sidebar-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .sidebar-menu a {
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .summary-item { min-width: 45%; }
  .summary-value { font-size: 1.1rem; }

  .btn {
    width: 100%;
    margin-bottom: 10px;
  }

  .field-row, .course-container .form-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .field-row label, .course-container .form-label { width: 100%; }

  .form-input, .form-select { max-width: 100%; }

  .courses-grid, .settings-grid { grid-template-columns: 1fr; }
}

/* ===============================
   ログイン画面のスマホ微調整
=============================== */
@media (max-width: 480px) {
  .main-brand-logo .logo-text { font-size: 1.8rem; }
  .login-card { padding: 30px 20px; }
}

/* ===============================
   Mobile Optimize: コース開始画面
=============================== */
@media (max-width: 480px) {
  .course-container .form-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 20px;
  }

  .course-container .form-label {
    width: 100%;
    margin-bottom: 4px;
    font-size: 0.9rem;
  }

  .form-input {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .course-container .form-actions {
    margin-left: 0;
    margin-top: 24px;
    display: flex;
    justify-content: center;
  }

  .btn {
    width: 90%;
    height: 50px;
    font-size: 1.1rem;
  }

  p.welcome-msg {
    text-align: center;
    margin: 15px 0;
  }
}

/* ===============================
   荷物登録画面：最終最適化
=============================== */
.form-actions-center {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

.section-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.05);
  margin: 30px 0;
}

.bottom-actions-container {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.end-odometer {
  margin-bottom: 24px;
  text-align: center;
}

.end-odometer .form-input {
  width: 160px !important;
  text-align: center;
  margin: 8px auto;
}

.vertical-button-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

/* ===============================
   荷物登録画面：最終調整（リスト対応版）
=============================== */
#list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.btn-group-mobile {
  display: flex;
  gap: 8px;
}

@media (max-width: 480px) {
  .btn-wide {
    width: 100% !important;
    display: flex !important;
    justify-content: center;
  }

  .end-odometer .form-input {
    width: 100% !important;
    max-width: 200px;
  }

  #list li {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }

  .stop-info {
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
  }

  .btn-group-mobile {
    width: 100%;
    justify-content: flex-end;
  }

  .btn-group-mobile .btn {
    padding: 8px 20px;
    font-size: 0.85rem;
    flex: 1;
    max-width: 100px;
  }
}
/* ===============================
   Sidebar：Logout(button_to) を link と同じ見た目にする
=============================== */

.sidebar-menu .logout-item form.button_to {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.sidebar-menu .logout-item button.logout-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  width: 100%;

  border-radius: 14px;
  color: #555;
  background: transparent;
  border: none;

  cursor: pointer !important;
  font: inherit;
  line-height: 1;
}

.sidebar-menu .logout-item button.logout-link:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #6abf69;
  padding-left: 20px;
}

.sidebar-menu .logout-item button.logout-link * {
  cursor: pointer !important;
}
