/* ===================================================
   office-chat.css - 工程管理側チャット（報告欄）共通スタイル
   全ページ共通で使用
   =================================================== */

/* ===== 右上チャットボタン ===== */
.office-chat-toggle-btn {
  position: fixed;
  top: 10px;
  right: 15px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  border: none;
  border-radius: 20px;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(245,158,11,0.4);
}
.office-chat-toggle-btn:hover {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,158,11,0.5);
}
.office-chat-icon { font-size: 16px; }

/* 未読バッジ */
.office-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 9px;
  animation: office-pulse 1s infinite;
}
@keyframes office-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== チャットパネル ===== */
.office-chat-panel {
  position: fixed;
  top: 50px;
  right: 15px;
  width: 420px;
  max-height: 560px;
  z-index: 999;
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  overflow: hidden;
  font-family: "Segoe UI", "Meiryo UI", "Noto Sans JP", sans-serif;
}
.office-chat-panel.open { display: flex; }

/* ヘッダー */
.office-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
}
.office-chat-header h3 {
  margin: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.office-chat-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.office-chat-target {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}
.office-chat-target strong { color: #fff; }

.office-chat-close-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.office-chat-close-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* 工場タブ */
.office-factory-tabs {
  display: flex;
  gap: 0;
  padding: 0;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}
.office-factory-tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  position: relative;
}
.office-factory-tab:hover {
  background: #e2e8f0;
  color: #334155;
}
.office-factory-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #fff;
  font-weight: 600;
}
.office-factory-tab .tab-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 8px;
  margin-left: 4px;
}

/* メッセージ欄 */
.office-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  max-height: 340px;
  background: #f8fafc;
}
.office-chat-messages::-webkit-scrollbar { width: 5px; }
.office-chat-messages::-webkit-scrollbar-track { background: #f1f5f9; }
.office-chat-messages::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }

.office-no-messages {
  color: #94a3b8;
  text-align: center;
  padding: 30px;
  font-size: 13px;
}

/* メッセージバブル */
.office-chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  animation: office-slideIn 0.2s ease-out;
}
@keyframes office-slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.office-chat-msg.from-factory {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #334155;
  border-bottom-left-radius: 4px;
}
.office-chat-msg.from-office {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.office-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
  font-size: 10px;
}
.office-msg-sender { font-weight: 700; }
.office-chat-msg.from-factory .office-msg-sender { color: #2563eb; }
.office-chat-msg.from-office .office-msg-sender { color: rgba(255,255,255,0.85); }

.office-msg-time { color: #94a3b8; }
.office-chat-msg.from-office .office-msg-time { color: rgba(255,255,255,0.6); }

.office-msg-factory-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: #dbeafe;
  color: #1d4ed8;
  margin-left: 6px;
}

.office-msg-text { word-break: break-word; }

/* 入力エリア */
.office-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
.office-chat-input-area textarea {
  flex: 1;
  min-height: 36px;
  max-height: 80px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #334155;
  font-size: 13px;
  font-family: "Segoe UI", "Meiryo UI", "Noto Sans JP", sans-serif;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.office-chat-input-area textarea:focus { border-color: #2563eb; }
.office-chat-input-area textarea::placeholder { color: #94a3b8; }

.office-chat-send-btn {
  padding: 8px 18px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.office-chat-send-btn:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  transform: scale(1.02);
}
.office-chat-send-btn:active { transform: scale(0.98); }

/* 通知ハイライト */
.office-chat-toggle-btn.has-notification {
  animation: office-glow 0.5s ease-in-out 3;
}
@keyframes office-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(245,158,11,0.4); }
  50% { box-shadow: 0 2px 20px rgba(239,68,68,0.6); }
}