/* view.php専用のスタイル */

/* 画面表示時のレイアウト */
body {
  background: #f5f5f5 !important;
  margin: 0;
  padding: 0;
}

/* ツールバーのカスタマイズ - 詳細度を上げる */
body .toolbar {
  max-width: 920px !important;
  margin: 20px auto !important;
  padding: 15px 60px !important;
  position: relative !important;
  top: auto !important;
  background: #fff !important;
  border-bottom: 1px solid #eee !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
  display: flex !important;
  gap: 8px !important;
  z-index: 10 !important;
}

/* メインコンテンツエリア - 詳細度を上げる */
body .print-wrapper .print-content {
  max-width: 800px !important;
  margin: 20px auto !important;
  padding: 40px 60px !important;
  background: white !important;
  box-shadow: 0 0 10px rgba(0,0,0,0.1) !important;
  border-radius: 8px !important;
  display: block !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  color: #3b3b3b !important;
}

/* 見出しスタイル - 詳細度を上げる */
body .print-wrapper .print-content h1 {
  font-size: 32px !important;
  font-weight: bold !important;
  margin: 40px 0 24px 0 !important;
  padding-bottom: 12px !important;
  border-bottom: 2px solid #eee !important;
  line-height: 1.4 !important;
  color: #3b3b3b !important;
}

body .print-wrapper .print-content h1:first-child {
  margin-top: 0 !important;
}

body .print-wrapper .print-content h2 {
  font-size: 24px !important;
  font-weight: bold !important;
  margin: 32px 0 16px 0 !important;
  line-height: 1.4 !important;
  color: #3b3b3b !important;
}

body .print-wrapper .print-content h3 {
  font-size: 20px !important;
  font-weight: bold !important;
  margin: 24px 0 12px 0 !important;
  line-height: 1.4 !important;
  color: #3b3b3b !important;
}

/* 段落とリスト - 詳細度を上げる */
body .print-wrapper .print-content p {
  margin: 16px 0 !important;
  line-height: 1.8 !important;
  color: #3b3b3b !important;
}

body .print-wrapper .print-content ul, 
body .print-wrapper .print-content ol {
  margin: 16px 0 !important;
  padding-left: 30px !important;
  line-height: 1.8 !important;
  color: #3b3b3b !important;
}

body .print-wrapper .print-content li {
  margin: 8px 0 !important;
  line-height: 1.8 !important;
  color: #3b3b3b !important;
}

/* コードブロック */
.print-content pre {
  background-color: #f6f8fa;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  color: #3b3b3b;
}

.print-content code {
  background-color: #f6f8fa;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 90%;
  color: #3b3b3b;
}

.print-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* テーブル */
.print-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
}

.print-content th, 
.print-content td {
  border: 1px solid #ddd;
  padding: 12px;
  text-align: left;
}

.print-content th {
  background-color: #f6f8fa;
  font-weight: bold;
}

/* 画像 */
.print-content img {
  max-width: 100%;
  height: auto;
  margin: 20px 0;
  display: block;
}

/* 引用 */
.print-content blockquote,
body .print-wrapper .print-content blockquote {
  margin: 20px 0;
  padding-left: 20px;
  border-left: 4px solid #ddd;
  color: #666;
  word-wrap: break-word !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

/* blockquote内の全要素にも適用 */
.print-content blockquote *,
body .print-wrapper .print-content blockquote * {
  word-wrap: break-word !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}

/* blockquote内のpタグに特に適用 */
.print-content blockquote p,
body .print-wrapper .print-content blockquote p,
.page-content blockquote p {
  word-wrap: break-word !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
}

/* アラート */
.alert-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 800px;
  width: 90%;
}

.alert {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 12px 20px;
  border-radius: 4px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  word-wrap: break-word;
  max-width: 100%;
}

.alert-warning {
  background: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.alert-icon {
  font-size: 20px;
}

.alert-close {
  margin-left: auto;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.alert-close:hover {
  opacity: 1;
}

/* ボタンスタイル */
.btn-danger {
  background: #dc3545;
}

.btn-danger:hover {
  background: #c82333;
}

/* モーダル */
.modal {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10000;
}

.modal-header {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #dc3545;
}

.modal-body {
  margin-bottom: 20px;
  color: #333;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* 画像エラー時のスタイル */
.img-error {
  display: inline-block;
  padding: 40px;
  background: #f8f9fa;
  border: 3px dashed #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  min-width: 300px;
  min-height: 150px;
  position: relative;
  margin: 10px 0;
}

.img-error:hover {
  background: #e8e8e8;
  border-color: #999;
}

.img-error::before {
  content: "📷";
  font-size: 48px;
  display: block;
  margin-bottom: 10px;
}

.img-error::after {
  content: "クリックして画像をアップロード";
  font-size: 14px;
  color: #666;
}

/* アップロードモーダル */
.upload-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
}

.upload-modal.show {
  display: flex;
}

.upload-modal-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  position: relative;
}

.upload-zone {
  border: 2px dashed #007bff;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.dragover {
  background: #f0f8ff;
  border-color: #0056b3;
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-progress {
  display: none;
  margin-top: 20px;
}

.progress-bar {
  height: 20px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #007bff;
  width: 0%;
  transition: width 0.3s;
}

/* 印刷時は画面表示用スタイルを無効化 */
@media print {
  body {
    background: white;
  }
  
  .print-content {
    max-width: none;
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
  }
  
  .toolbar,
  .alert-container,
  .modal,
  .upload-modal {
    display: none !important;
  }
}