/**
 * 日報管理システム - 共通コンポーネントスタイル
 * 
 * このCSSファイルは、JavaScriptライブラリに関連するUIコンポーネントのスタイルを提供します。
 * アプリケーション全体で一貫したUIを確保するために使用されます。
 */

/* --------------- フォント設定 --------------- */
@font-face {
    font-family: 'FORMUDPGothic';
    src: url('../fonts/FORMUDPGothic-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'FORMUDPGothic';
    src: url('../fonts/FORMUDPGothic-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

/* 共通コンポーネントのフォント設定 */
.notification,
.form-feedback,
.file-upload-text,
.pdf-container {
    font-family: 'FORMUDPGothic', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
}

/* --------------- 通知関連 --------------- */

/* 通知コンテナ */
.notification-container {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
  width: 100%;
}

/* 通知位置 */
.notification-top-right {
  top: 20px;
  right: 20px;
}

.notification-top-left {
  top: 20px;
  left: 20px;
}

.notification-bottom-right {
  bottom: 20px;
  right: 20px;
}

.notification-bottom-left {
  bottom: 20px;
  left: 20px;
}

.notification-top-center {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.notification-bottom-center {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
}

/* 通知スタイル */
.notification {
  padding: 15px;
  border-radius: 5px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  margin-bottom: 10px;
  position: relative;
  animation: slide-in 0.3s ease-out forwards;
  display: flex;
  align-items: flex-start;
}

.notification-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  position: absolute;
  top: 5px;
  right: 5px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: 20px;
  height: 20px;
  line-height: 1;
}

.notification-message {
  flex-grow: 1;
  margin-right: 15px;
}

/* 通知タイプ */
.notification-info {
  background-color: #3498db;
  color: white;
}

.notification-success {
  background-color: #2ecc71;
  color: white;
}

.notification-warning {
  background-color: #f39c12;
  color: white;
}

.notification-error {
  background-color: #e74c3c;
  color: white;
}

/* 通知アニメーション */
@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* --------------- フォーム関連 --------------- */

/* フォームフィードバック */
.form-feedback {
  margin-top: 15px;
  padding: 10px 15px;
  border-radius: 4px;
  display: none;
}

.is-processing {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  color: #6c757d;
}

.is-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.is-error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

/* フォーム自動保存関連 */
.form-restore-banner {
  margin-bottom: 20px;
  padding: 10px 15px;
  border-radius: 4px;
  background-color: #cce5ff;
  border: 1px solid #b8daff;
  color: #004085;
}

.form-autosave-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 15px;
  border-radius: 4px;
  color: white;
  font-size: 14px;
  z-index: 9999;
  transition: opacity 0.3s ease-in-out;
  opacity: 0;
  pointer-events: none;
}

/* アップロード要素 */
.file-upload-container {
  position: relative;
  border: 2px dashed #ddd;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-upload-container:hover {
  border-color: #aaa;
}

.file-upload-container.dragover {
  border-color: #4e73df;
  background-color: rgba(78, 115, 223, 0.05);
}

.file-upload-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

.file-upload-text {
  color: #6c757d;
}

.file-preview {
  width: 100%;
  height: 100px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  margin-top: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.file-preview.has-image {
  border: 1px solid #4e73df;
}

/* --------------- ページネーション関連 --------------- */

/* ローディングインジケーター */
.loading {
  position: relative;
  min-height: 100px;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ソート可能なヘッダー */
th[data-sort] {
  cursor: pointer;
  position: relative;
  padding-right: 20px;
}

th[data-sort]::after {
  content: "⇅";
  position: absolute;
  right: 5px;
  color: #aaa;
}

th[data-sort].sort-asc::after {
  content: "↑";
  color: #333;
}

th[data-sort].sort-desc::after {
  content: "↓";
  color: #333;
}

/* --------------- 検索関連 --------------- */

/* 検索ボックス */
.search-box {
  position: relative;
  margin-bottom: 20px;
}

.search-input {
  padding-right: 40px;
}

.search-button {
  position: absolute;
  top: 0;
  right: 40px;
  height: 100%;
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
}

.clear-button {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
}

/* フィルターパネル */
.filter-panel {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
}

.filter-panel .form-group {
  margin-bottom: 10px;
}

/* 検索結果 */
.search-results {
  min-height: 200px;
}

.search-results.loading {
  position: relative;
}

.search-results.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.7);
}

.search-results.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

/* --------------- PDF関連 --------------- */

/* PDF表示コンテナ */
.pdf-container {
  border: 1px solid #ddd;
  margin-top: 20px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
}

.pdf-preview {
  min-height: 500px;
  margin-top: 15px;
  border: 1px solid #ddd;
  background-color: white;
  display: none;
}

/* ロゴ・印影アップロード */
.company-logo-upload,
.company-seal-upload {
  width: 100%;
  height: 150px;
  border: 2px dashed #ddd;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.company-logo-upload:hover,
.company-seal-upload:hover {
  border-color: #4e73df;
}

.logo-preview,
.seal-preview {
  width: 100%;
  height: 100px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  margin-top: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.logo-preview.has-image,
.seal-preview.has-image {
  border: 1px solid #4e73df;
}

.pdf-error-message {
  color: #e74c3c;
  margin-top: 10px;
  display: none;
}

/* PDF操作ボタン */
.pdf-button-group {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}
