* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
}

body.login-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-box {
  background: white;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  font-size: 28px;
}

.form-group {
  margin-bottom: 25px;
}

.ebook-container .form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: 500;
  font-size: 16px;
}

.ebook-container .form-group label {
  font-size: 16px;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.error-message {
  color: #e74c3c;
  font-size: 14px;
  margin-bottom: 15px;
  min-height: 20px;
  text-align: center;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Ebook 페이지 스타일 */
.ebook-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 30px 60px;
  background: white;
  min-height: 100vh;
}

.ebook-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #667eea;
}

.ebook-header h1 {
  color: #333;
  font-size: 32px;
}

.section {
  margin-bottom: 30px;
  padding: 30px 40px;
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 26px;
  border-left: 4px solid #667eea;
  padding-left: 15px;
}

.form-container {
  max-width: 100%;
}

.title-input-group {
  display: flex;
  gap: 10px;
}

.title-input-group input {
  flex: 1;
}

.recommended-titles {
  margin-top: 15px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.recommended-titles h3 {
  margin-bottom: 12px;
  color: #555;
  font-size: 16px;
}

.recommended-titles-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
}

.recommended-title-item {
  display: inline-block;
  padding: 8px 16px;
  background: #f0f4ff;
  border: 1px solid #667eea;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
  color: #667eea;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.recommended-title-item:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(102, 126, 234, 0.3);
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.3s;
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* 표지 스타일 라디오 버튼 */
.cover-style-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 15px;
}

/* EPUB 변환 섹션의 챕터 표지 스타일은 3개만 표시 */
#epubSection .cover-style-options {
  grid-template-columns: repeat(3, 1fr);
}

.cover-style-item {
  position: relative;
}

.cover-style-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cover-style-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
}

.cover-style-label:hover {
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.cover-style-item input[type="radio"]:checked + .cover-style-label {
  border-color: #667eea;
  background: #f0f4ff;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.cover-style-image {
  width: auto;
  max-width: 150px;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  border-radius: 5px;
  flex-shrink: 0;
  aspect-ratio: auto;
}

.cover-style-label span {
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

/* 표지 이미지 섹션 */
.cover-container {
  text-align: center;
}

.cover-preview {
  margin-bottom: 20px;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-placeholder {
  width: 100%;
  max-width: 300px;
  height: 480px;
  background: #e9ecef;
  border: 2px dashed #adb5bd;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6c757d;
}

.cover-placeholder p {
  margin: 10px 0;
}

.cover-size {
  font-size: 12px;
  color: #999;
}

/* 챕터 섹션 */
.chapter-controls {
  margin-bottom: 20px;
}

.chapters-tree {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.chapter-tree-item {
  margin-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 15px;
}

.chapter-tree-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.chapter-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.tree-toggle {
  cursor: pointer;
  color: #667eea;
  font-size: 12px;
  width: 20px;
  text-align: center;
  user-select: none;
  transition: transform 0.2s;
}

.tree-toggle:hover {
  color: #764ba2;
}

.chapter-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  transition: border-color 0.3s;
}

.chapter-name-input:focus {
  outline: none;
  border-color: #667eea;
}

.chapter-sections {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 30px;
  display: none;
}

.chapter-sections.show {
  display: block;
}

.section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.section-item:last-child {
  border-bottom: none;
}

.section-name-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  color: #555;
  transition: border-color 0.3s;
}

.section-name-input:focus {
  outline: none;
  border-color: #667eea;
}

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #f0f0f0;
  color: #666;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: #667eea;
  color: white;
}

.add-section-btn {
  background: #e8f4fd;
  color: #667eea;
}

.add-section-btn:hover {
  background: #667eea;
  color: white;
}

.remove-section-btn {
  background: #ffe8e8;
  color: #e74c3c;
}

.remove-section-btn:hover {
  background: #e74c3c;
  color: white;
}

/* 원고 작성 섹션 */
.manuscript-controls {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.manuscript-style-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.manuscript-style-group label {
  margin: 0;
  font-weight: 500;
  color: #555;
  white-space: nowrap;
}

.manuscript-style-group select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  min-width: 150px;
  transition: border-color 0.3s;
}

.manuscript-style-group select:focus {
  outline: none;
  border-color: #667eea;
}

.manuscript-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  border: 1px solid #ddd;
  min-height: 400px;
}

.manuscript-chapter {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 2px solid #e9ecef;
}

.manuscript-chapter:last-child {
  border-bottom: none;
}

.manuscript-chapter h2 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 24px;
  border-left: none;
  padding-left: 0;
}

.manuscript-section {
  margin-bottom: 30px;
  padding-left: 20px;
  border-left: 2px solid #e9ecef;
}

.manuscript-section h3 {
  color: #764ba2;
  margin-bottom: 15px;
  font-size: 20px;
  font-weight: 600;
}

.manuscript-text {
  color: #333;
  line-height: 1.8;
}

.manuscript-text p {
  margin-bottom: 15px;
}

.manuscript-text-placeholder {
  padding: 30px;
  text-align: left;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #ddd;
}

.manuscript-text-placeholder.locked-section {
  background: #fff3cd;
  border-color: #ffc107;
}

.locked-message {
  color: #856404;
  font-size: 14px;
  margin: 0;
  font-weight: 500;
}

.generate-section-manuscript-btn {
  min-width: 120px;
}

/* EPUB 변환 섹션 */
.epub-container {
  text-align: center;
  padding: 20px;
}

.epub-container p {
  margin-bottom: 20px;
  color: #666;
  font-size: 16px;
}

.epub-result {
  margin-top: 30px;
  padding: 20px;
  background: white;
  border-radius: 8px;
  border: 2px solid #28a745;
}

.success-message {
  color: #28a745;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .ebook-container {
    padding: 10px;
  }

  .section {
    padding: 20px;
  }

  .title-input-group {
    flex-direction: column;
  }

  .chapters-list {
    grid-template-columns: 1fr;
  }
}
