/* 輸送見積もりシステム カスタムCSS */

/* テーブル用スタイル */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table-header {
  padding: 12px 24px;
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

/* フォーム用スタイル */
.form-input {
  appearance: none;
  background-color: #ffffff;
  border-color: #d1d5db;
  border-width: 1px;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  width: 100%;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus {
  outline: 0;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #ffffff;
  border-color: #d1d5db;
  border-width: 1px;
  border-radius: 0.375rem;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  width: 100%;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-select:focus {
  outline: 0;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
  appearance: none;
  background-color: #ffffff;
  border-color: #d1d5db;
  border-width: 1px;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  width: 100%;
  resize: vertical;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-textarea:focus {
  outline: 0;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ボタンスタイル */
.btn-primary {
  background-color: #3b82f6;
  color: #ffffff;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-secondary {
  background-color: #ffffff;
  color: #374151;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.btn-secondary:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.btn-success {
  background-color: #10b981;
  color: #ffffff;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-outline {
  background-color: #ffffff;
  color: #6b7280;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.btn-outline:hover {
  background-color: #f9fafb;
  border-color: #6b7280;
  color: #374151;
}

/* モーダル用スタイル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none; /* デフォルトで非表示 */
  align-items: center;
  justify-content: center;
}

.modal.show,
.modal-backdrop.show {
  display: flex !important;
}

.modal.hidden,
.modal-backdrop.hidden {
  display: none !important;
}

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

.modal-content {
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 56rem; /* 32rem から 56rem に変更（プロジェクトフォーム用） */
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 1001;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #374151;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  gap: 0.75rem;
}

/* モーダル内のselect要素のz-index調整 */
.modal-content .form-select {
  position: relative;
  z-index: 1002;
}

/* selectのドロップダウンオプションの表示確保 */
.modal-content .form-select option {
  background-color: #ffffff;
  color: #374151;
  padding: 8px 12px;
}

/* モーダル内のselect要素のドロップダウン表示強化 */
.modal-backdrop .form-select {
  position: relative;
  z-index: 9999 !important;
}

/* select要素の親コンテナもz-indexを設定 */
.modal-backdrop .space-y-4 > div {
  position: relative;
  z-index: 9998;
}

/* モーダル全体のoverflow調整 */
#statusChangeModal .modal-content {
  overflow: visible;
}

/* ステータス変更モーダル専用の強化スタイル */
#statusChangeModal {
  z-index: 10000 !important;
}

#statusChangeModal .modal-content {
  z-index: 10001 !important;
  position: relative;
}

#statusChangeSelect {
  z-index: 10002 !important;
  position: relative !important;
}

/* Chrome, Safari, Edge用のselect要素最適化 */
#statusChangeSelect:focus {
  z-index: 10003 !important;
}

/* Firefox用のselect要素最適化 */
@-moz-document url-prefix() {
  #statusChangeSelect {
    appearance: menulist !important;
    z-index: 10004 !important;
  }
}

/* アニメーション */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ステータスバッジ */
.status-badge {
  display: inline-flex;
  align-items: center;
  px: 0.5rem;
  py: 0.25rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-blue {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-yellow {
  background-color: #fef3c7;
  color: #92400e;
}

.status-orange {
  background-color: #fed7aa;
  color: #c2410c;
}

.status-green {
  background-color: #d1fae5;
  color: #065f46;
}

.status-red {
  background-color: #fecaca;
  color: #991b1b;
}

.status-gray {
  background-color: #f3f4f6;
  color: #374151;
}

/* ステータス履歴用のカラースタイル */
.text-blue-600 { color: #2563eb; }
.text-yellow-600 { color: #d97706; }
.text-orange-600 { color: #ea580c; }
.text-green-600 { color: #16a34a; }
.text-red-600 { color: #dc2626; }
.text-gray-600 { color: #4b5563; }

.border-blue-500 { border-left-color: #3b82f6; }
.border-yellow-500 { border-left-color: #eab308; }
.border-orange-500 { border-left-color: #f97316; }
.border-green-500 { border-left-color: #22c55e; }
.border-red-500 { border-left-color: #ef4444; }
.border-gray-500 { border-left-color: #6b7280; }

/* カスタムドロップダウンスタイル */
#customStatusDropdown {
  z-index: 2147483646 !important;
  position: relative !important;
  isolation: isolate !important;
}

/* ドロップダウンメニューの背景を完全に不透明に */
#statusDropdownMenu::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background-color: #ffffff !important;
  background: #ffffff !important;
  z-index: -1 !important;
  border-radius: 0.5rem !important;
  box-shadow: 0 0 0 10px #ffffff !important;
}

/* さらなる背景強化 */
#statusDropdownMenu::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ffffff !important;
  background: #ffffff !important;
  z-index: -1 !important;
  border-radius: 0.375rem !important;
}

#statusDropdownButton {
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.15s ease-in-out !important;
  /* 従来のform-selectの矢印アイコンを完全に無効化 */
  background-image: none !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.5rem !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  /* form-selectクラスの影響を完全に除去 */
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
}

#statusDropdownButton:hover {
  border-color: #3b82f6 !important;
  background-color: #f8fafc !important;
}

#statusDropdownButton:focus {
  outline: 2px solid #3b82f6 !important;
  outline-offset: 2px !important;
  border-color: #3b82f6 !important;
}

#statusDropdownMenu {
  z-index: 2147483647 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
  border: 3px solid #d1d5db !important;
  background-color: #ffffff !important;
  background: #ffffff !important;
  opacity: 1 !important;
  position: fixed !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  /* 強力な背景設定 */
  background-clip: padding-box !important;
  isolation: isolate !important;
}

.status-option {
  transition: background-color 0.15s ease-in-out !important;
  border-bottom: 1px solid #f3f4f6 !important;
  background-color: #ffffff !important;
  background: #ffffff !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: inherit !important;
  isolation: isolate !important;
}

.status-option:last-child {
  border-bottom: none !important;
}

.status-option:hover {
  background-color: #eff6ff !important;
  background: #eff6ff !important;
  transform: translateX(2px) !important;
  opacity: 1 !important;
  z-index: inherit !important;
}

.status-option:active {
  background-color: #dbeafe !important;
  background: #dbeafe !important;
  opacity: 1 !important;
  z-index: inherit !important;
}

.status-option .w-3.h-3 {
  flex-shrink: 0 !important;
}

/* モーダルz-index修正 */
.modal-backdrop { 
  z-index: 1000 !important; 
}

.modal-content { 
  z-index: 1001 !important; 
  position: relative !important; 
}

/* ステータス変更モーダル専用のz-index強化 */
#statusChangeModal {
  z-index: 1000 !important;
}

#statusChangeModal .modal-content {
  z-index: 1001 !important;
  position: relative !important;
}

/* コメント欄のz-indexを強制的に下げる */
#statusChangeComment {
  z-index: -1 !important;
  position: relative !important;
}

/* ステータス変更モーダル内のすべての要素のz-indexを制御 */
#statusChangeModal textarea {
  z-index: -1 !important;
  position: relative !important;
}

#statusChangeModal .form-textarea {
  z-index: -1 !important;
  position: relative !important;
}

/* ドロップダウンが開いている間、コメント欄を強制的に最背面に */
#statusChangeModal.dropdown-open textarea,
#statusChangeModal.dropdown-open .form-textarea,
#statusChangeModal.dropdown-open #statusChangeComment {
  z-index: -999999 !important;
  position: relative !important;
}

/* プログレスバーの完了ステップのホバー効果 */
.step-completed {
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.step-completed:hover {
  transform: scale(1.05);
  opacity: 0.8;
}

.step-completed .step-circle:hover {
  background-color: #059669 !important;
}

.step-completed .step-text:hover {
  color: #047857 !important;
}

/* プロジェクトモーダル専用スタイル - TailwindCSSの max-w-4xl を確実に適用 */
#projectModal .modal-content {
  max-width: 56rem !important; /* TailwindCSS の max-w-4xl と同じ（56rem = 896px） */
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
  .modal-content {
    width: 95%;
    margin: 0.5rem;
  }
  
  /* プロジェクトモーダルもスマホで適切に表示 */
  #projectModal .modal-content {
    max-width: 95% !important;
    width: 95% !important;
  }
  
  #statusDropdownMenu {
    position: fixed !important;
    left: 1rem !important;
    right: 1rem !important;
    width: auto !important;
  }
}