/* style.css - 워프툴 스타일 (다중 블로그 지원) */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, sans-serif;
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.6;
}

/* ===========================================
   블로그 래퍼 및 블록 구조
   =========================================== */

.blog-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.blog-block {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 30px;
  padding: 25px;
  border: 1px solid #e9ecef;
}

.blog-block:first-child {
  margin-top: 0;
}

.main-wrapper {
  /* 기본 블로그 블록용 추가 스타일 */
}

/* ===========================================
   블로그 연결 섹션
   =========================================== */

.blog-connection-container {
  margin-bottom: 25px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 6px;
}

.blog-type-selector {
  margin-bottom: 15px;
}

.blog-type-selector label {
  display: inline-block;
  margin-right: 20px;
  font-weight: 500;
}

.blog-type-selector input[type="radio"] {
  margin-right: 8px;
}

.blog-connection-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.blog-connection-form input[type="text"],
.blog-connection-form input[type="password"] {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.connect-button {
  padding: 8px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.connect-button:hover {
  background: #0056b3;
}

.connection-message {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
}

.success-message {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ===========================================
   발행 설정 섹션
   =========================================== */

.publish-settings-container {
  margin-bottom: 25px;
  padding: 15px;
  background: #fff3cd;
  border-radius: 6px;
  border: 1px solid #ffeaa7;
}

.publish-interval-selector {
  margin-bottom: 10px;
  font-weight: 500;
}

.publish-interval-selector label {
  display: inline-block;
  margin-right: 15px;
  margin-left: 10px;
  font-weight: normal;
}

.publish-interval-selector input[type="radio"] {
  margin-right: 5px;
}

.internal-link-option {
  font-weight: 500;
}

.internal-link-option input[type="checkbox"] {
  margin-right: 8px;
}

/* ========================================
   예약 발행 & 옵션 박스 스타일
======================================== */

/* 예약 발행 박스 */
.schedule-box {
  background: #fffbeb;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
}

.schedule-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #fbbf24;
}

.schedule-header label {
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
}

.schedule-header input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  cursor: pointer;
}

.schedule-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.schedule-row label:first-child {
  min-width: 80px;
  font-weight: 500;
}

.schedule-row input[type="date"] {
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
}

.schedule-row input[type="number"] {
  width: 50px;
  padding: 5px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
}

.time-slots {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.time-slots label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.time-slots label:hover {
  background: #f3f4f6;
  border-color: #fbbf24;
}

.time-slots input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* 내부링크 박스 */
.option-box {
  background: #e0f2fe;
  border: 2px solid #0ea5e9;
  border-radius: 8px;
  padding: 12px 15px;
  margin: 15px 0;
}

.option-box label {
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
}

.option-box input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  cursor: pointer;
}

.option-icon {
  margin-right: 5px;
}

.option-text {
  color: #0369a1;
}

/* 발행 간격 비활성화 시 */
.publish-interval-selector.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.publish-interval-selector {
  transition: opacity 0.3s;
}

/* ===========================================
   콘텐츠 제어 섹션 (3단 레이아웃)
   =========================================== */

.content-control-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

@media (max-width: 1024px) {
  .content-control-container {
    grid-template-columns: 1fr;
  }
}

/* 파일 제어 섹션 (왼쪽) */
.file-control-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.file-upload-area {
  margin-bottom: 20px;  /* 키워드 진행 상태바와의 간격 줄임 */
}

.file-upload-area .file-upload-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.file-delete-button {
  background: #dc3545;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.2s;
  margin-top: 15px;
  display: block;
}

.file-delete-button:hover:not(:disabled) {
  background: #c82333;
}

.file-delete-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.file-upload-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 10px;
  font-weight: 500;
  transition: background 0.2s;
}

.file-upload-button:hover {
  background: #1e7e34;
}

.file-upload-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

#selected-file-display,
[id*="selected-file-display"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
}

/* 키워드 진행 상태 컨테이너 - 키워드 입력창 안에 오버레이로 표시 */
.keyword-progress-container {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(2px);
  z-index: 10;
  display: none; /* 기본적으로 숨김 */
}

/* 키워드가 있을 때만 표시 */
.keyword-progress-container.has-keywords {
  display: block;
}

.keyword-progress-container:empty {
  display: none;
}

.keyword-progress-item {
  margin-bottom: 8px;
}

.keyword-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 13px;
}

.keyword {
  font-weight: 500;
  min-width: 70px;
  flex-shrink: 0;
  font-size: 12px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.progress-fill.completed {
  background: #28a745;
}

.progress-fill.failed {
  background: #dc3545;
}

.progress-fill.processing {
  background: #ffc107;
}

.progress-fill.waiting {
  background: #6c757d;
}

.status {
  min-width: 50px;
  text-align: center;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  color: white;
}

.status.completed {
  background: #28a745;
}

.status.failed {
  background: #dc3545;
}

.status.processing {
  background: #ffc107;
  color: #000;
}

.status.waiting {
  background: #6c757d;
}

/* 키워드 입력창 컨테이너 - 상대 위치 설정 */
.keyword-input-container {
  position: relative;
  margin-bottom: 15px;
}

.keyword-input-field {
  width: 100%;
  height: 300px;     /* 높이 줄임 */
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* 키워드 입력창에 포커스가 있을 때 상태바 투명도 조정 */
.keyword-input-field:focus + .keyword-progress-container,
.keyword-input-field:hover + .keyword-progress-container {
  background: rgba(255, 255, 255, 0.85);
}

.publish-control-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.publish-button {
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
  font-size: 14px;
}

.start-button {
  background: #007bff;
  color: white;
}

.start-button:hover:not(:disabled) {
  background: #0056b3;
}

.pause-button {
  background: #ffc107;
  color: #000;
  margin-left: 75px;
}

.pause-button:hover:not(:disabled) {
  background: #e0a800;
}

.reset-button {
  background: #dc3545;
  color: white;
}

.reset-button:hover:not(:disabled) {
  background: #c82333;
}

.publish-button:disabled {
  background: #6c757d !important;
  color: #fff !important;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 상태 모니터링 섹션 (가운데) */
.status-monitoring-section {
  background: #e3f2fd;
  padding: 20px;
  border-radius: 6px;
  border: 1px solid #bbdefb;
}

.status-monitoring-section h3 {
  margin-bottom: 15px;
  color: #1976d2;
}

.status-monitoring-section p {
  margin-bottom: 15px;
  font-weight: 500;
}

.status-display-list {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.status-section {
  margin-bottom: 15px;
}

.status-section h4 {
  font-size: 14px;
  margin-bottom: 8px;
  padding: 5px 8px;
  border-radius: 4px;
}

.failed-section h4 {
  background: #f8d7da;
  color: #721c24;
}

.current-section h4 {
  background: #d4edda;
  color: #155724;
}

.completed-section h4 {
  background: #cce5ff;
  color: #004085;
}

.status-item {
  padding: 8px;
  margin-bottom: 5px;
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.status-item.failed {
  background: #f8d7da;
  border-left: 4px solid #dc3545;
}

.status-item.in-progress,
.status-item.waiting {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
}

.status-item.completed {
  background: #d4edda;
  border-left: 4px solid #28a745;
}

.item-keyword {
  font-weight: 600;
  color: #495057;
  min-width: 80px;
  flex-shrink: 0;
}

.item-title {
  flex: 1;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-status {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #6c757d;
  color: white;
  min-width: 50px;
  text-align: center;
}

/* 이미지 옵션 섹션 (오른쪽) */
.image-options-section {
  background: #f0f8f0;
  padding: 20px;
  border-radius: 6px;
  border: 1px solid #c3e6cb;
}

.preview-input-area {
  margin-bottom: 15px;
  display: flex;
  gap: 8px;
}

.preview-keyword-field {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.preview-generate-button {
  padding: 8px 12px;
  background: #17a2b8;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.preview-generate-button:hover {
  background: #117a8b;
}

.image-preview-area {
  margin-bottom: 20px;
  text-align: center;
}

.preview-image-container {
  margin-bottom: 10px;
}

#preview-canvas,
[id*="preview-canvas"] {
  border: 2px solid #ddd;
  border-radius: 4px;
  background: white;
}

.load-background-button {
  padding: 8px 12px;
  background: #6f42c1;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.load-background-button:hover {
  background: #5a32a3;
}

.image-options-area label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
}

.image-options-area input[type="range"] {
  width: 100%;
  margin-top: 5px;
}

.image-options-area input[type="color"] {
  width: 50px;
  height: 30px;
  border: none;
  border-radius: 4px;
  margin-left: 8px;
  cursor: pointer;
}

.image-options-area select {
  width: 100%;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 5px;
  font-size: 14px;
}

.save-options-button {
  width: 100%;
  padding: 10px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 15px;
  transition: background 0.2s;
}

.save-options-button:hover {
  background: #1e7e34;
}

/* ===========================================
   블로그 관리 섹션
   =========================================== */

.blog-management-container {
  text-align: center;
  margin: 30px 0;
}

.add-blog-button,
.btn-add-blog {
  padding: 12px 24px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s;
}

.add-blog-button:hover,
.btn-add-blog:hover {
  background: #0056b3;
}

/* 삭제 버튼 */
.btn-delete {
  background: #dc3545 !important;
  color: white !important;
  border: none !important;
  padding: 5px 10px !important;
  margin: 10px 0 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: background 0.2s !important;
  float: right;
}

.btn-delete:hover {
  background: #c82333 !important;
}

/* ===========================================
   반응형 디자인
   =========================================== */

@media (max-width: 768px) {
  .blog-wrapper {
    padding: 15px;
  }
  
  .blog-block {
    padding: 15px;
  }
  
  .blog-connection-form {
    flex-direction: column;
  }
  
  .blog-connection-form input {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .publish-control-buttons {
    justify-content: center;
  }
  
  .preview-input-area {
    flex-direction: column;
  }
  
  .status-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .item-keyword,
  .item-title,
  .item-status {
    min-width: auto;
    width: 100%;
  }
  
  .keyword-input-field {
    height: 250px; /* 모바일에서 높이 조정 */
  }
}

/* ===========================================
   스크롤바 스타일링
   =========================================== */

.keyword-progress-container::-webkit-scrollbar,
.status-display-list::-webkit-scrollbar {
  width: 6px;
}

.keyword-progress-container::-webkit-scrollbar-track,
.status-display-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.keyword-progress-container::-webkit-scrollbar-thumb,
.status-display-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.keyword-progress-container::-webkit-scrollbar-thumb:hover,
.status-display-list::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* 연결 상태 표시 스타일 */
.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 10px;
}

.connection-status.connected {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.connection-status.disconnected {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.connection-status.connecting {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.connected .status-indicator {
  background: #28a745;
}

.disconnected .status-indicator {
  background: #dc3545;
}

.connecting .status-indicator {
  background: #ffc107;
}