/* 計装工事 施工管理システム カスタムスタイル */

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --secondary: #0f766e;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
}

* { box-sizing: border-box; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
  background: #f1f5f9;
}

/* ローディング */
.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3); display: flex; align-items: center;
  justify-content: center; z-index: 9999;
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid #fff; border-top-color: #3b82f6;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* サイドバー */
#sidebar {
  width: 240px; min-height: 100vh;
  background: linear-gradient(180deg, #1e3a5f 0%, #1e40af 100%);
  position: fixed; left: 0; top: 0; z-index: 100;
  transition: transform 0.3s ease;
}
#sidebar .logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
#sidebar .logo h1 {
  font-size: 14px; font-weight: 700; color: #fff; line-height: 1.4;
}
#sidebar .logo p { font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 2px; }

#sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; color: rgba(255,255,255,0.8);
  text-decoration: none; font-size: 14px;
  transition: all 0.2s; border-left: 3px solid transparent;
}
#sidebar nav a:hover, #sidebar nav a.active {
  background: rgba(255,255,255,0.1); color: #fff;
  border-left-color: #60a5fa;
}
#sidebar nav a i { width: 20px; text-align: center; font-size: 15px; }

/* メインコンテンツ */
#main-content {
  margin-left: 240px; min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* ヘッダー */
#header {
  background: #fff; padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
#header .page-title { font-size: 18px; font-weight: 600; color: #1e293b; }
#header .user-info { display: flex; align-items: center; gap: 12px; }
#header .user-name { font-size: 14px; color: #64748b; }

/* ページコンテンツ */
#page-content { padding: 24px; }

/* カード */
.card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #f0f4f8;
}

/* ステータスバッジ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-planning  { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #e2e8f0; color: #475569; }
.badge-suspended { background: #fee2e2; color: #dc2626; }
.badge-pending   { background: #fef9c3; color: #854d0e; }
.badge-installed { background: #dbeafe; color: #1d4ed8; }
.badge-tested    { background: #d1fae5; color: #065f46; }
.badge-pass      { background: #dcfce7; color: #15803d; }
.badge-fail      { background: #fee2e2; color: #dc2626; }

/* 進捗バー */
.progress-bar-wrap {
  width: 100%; height: 8px; background: #e2e8f0;
  border-radius: 4px; overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  transition: width 0.4s ease;
}

/* テーブル */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  background: #f8fafc; padding: 10px 14px;
  text-align: left; font-weight: 600; color: #374151;
  border-bottom: 2px solid #e5e7eb; white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td { padding: 10px 14px; color: #374151; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 14px;
  font-weight: 500; cursor: pointer; border: none;
  transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-secondary:hover { background: #4b5563; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: #374151; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* フォーム */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 14px; color: #1f2937;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.form-control:focus {
  outline: none; border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-control.error { border-color: #ef4444; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }

/* モーダル */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); display: flex; align-items: center;
  justify-content: center; z-index: 1000; padding: 16px;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%;
  max-width: 680px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: #1e293b; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #e5e7eb;
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: #9ca3af; font-size: 20px; padding: 0 4px;
}
.modal-close:hover { color: #374151; }

/* ログイン */
.login-container {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 50%, #0f766e 100%);
}
.login-box {
  background: #fff; border-radius: 20px; padding: 40px;
  width: 100%; max-width: 400px; box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.login-box h1 { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.login-box p { font-size: 13px; color: #64748b; margin-bottom: 28px; }
.login-icon {
  width: 56px; height: 56px; background: linear-gradient(135deg, #1e40af, #3b82f6);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.login-icon i { color: #fff; font-size: 24px; }

/* アラート */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }

/* 統計カード */
.stat-card {
  background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08); border: 1px solid #f0f4f8;
}
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1e293b; line-height: 1; }
.stat-card .stat-label { font-size: 13px; color: #64748b; margin-top: 4px; }

/* タブ */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid #e5e7eb; margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; font-size: 14px; font-weight: 500;
  color: #6b7280; background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }
.tab-btn:hover:not(.active) { color: #374151; }

/* レスポンシブ */
#sidebar-toggle {
  display: none; background: none; border: none;
  font-size: 20px; cursor: pointer; color: #374151; padding: 4px;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 99;
}

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  #sidebar-toggle { display: block; }
  .sidebar-overlay.show { display: block; }
  #page-content { padding: 16px; }
  .modal { max-width: 100%; margin: 0; }
  .data-table { font-size: 12px; }
  .data-table thead th, .data-table tbody td { padding: 8px 10px; }
}

/* フォームグリッド */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* 写真グリッド */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo-card { border-radius: 10px; overflow: hidden; border: 1px solid #e5e7eb; cursor: pointer; transition: transform 0.2s; }
.photo-card:hover { transform: scale(1.02); }
.photo-card img { width: 100%; height: 160px; object-fit: cover; }
.photo-card .photo-info { padding: 8px 10px; background: #fff; }
.photo-card .photo-info p { font-size: 12px; color: #374151; }

/* トースト通知 */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 250px;
  animation: slideIn 0.3s ease;
}
.toast-success { background: #1e293b; color: #fff; }
.toast-error { background: #dc2626; color: #fff; }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 空状態 */
.empty-state {
  text-align: center; padding: 48px 24px; color: #9ca3af;
}
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* 検索バー */
.search-bar { position: relative; }
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.search-bar input { padding-left: 36px; }

/* ガンットチャート */
.gantt-phase-row { font-weight: 700; }
.gantt-task-row:hover { cursor: pointer; }

#gantt-scroll-area::-webkit-scrollbar,
#overview-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
#gantt-scroll-area::-webkit-scrollbar-thumb,
#overview-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#gantt-scroll-area::-webkit-scrollbar-track,
#overview-scroll::-webkit-scrollbar-track { background: #f1f5f9; }

/* ガンットチャートコンテナのフル高さ対応 */
#gantt-container { overflow: hidden; }
