* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 0;
}

/* Login section */
.login-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: white;
  padding: 32px;
  border-radius: 8px;
  min-width: 360px;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.login-box h1 {
  margin-bottom: 4px;
}

.login-subtitle {
  color: #888;
  margin-bottom: 20px;
}

.login-error {
  color: #d32f2f;
  font-size: 14px;
  min-height: 20px;
  margin-bottom: 8px;
}

.login-box form input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 12px;
}

.login-box form input:focus {
  outline: none;
  border-color: #4a90d9;
}

.login-box form button[type="submit"] {
  width: 100%;
  margin-top: 4px;
}

.auth-switch {
  font-size: 14px;
  color: #888;
  margin-top: 16px;
}

.auth-switch a {
  color: #4a90d9;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.confirm-message {
  color: #666;
  margin-bottom: 12px;
}

/* App header with logout */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 0 0;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.user-bar span {
  font-size: 14px;
  color: #666;
}

.logout-btn {
  background: #666;
  padding: 6px 14px;
  font-size: 13px;
}

.logout-btn:hover {
  background: #555;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 20px;
}

h1 {
  color: #333;
  margin-bottom: 5px;
}

p {
  color: #666;
  margin-top: 0;
}

.drop-zones {
  display: flex;
  gap: 20px;
  margin: 20px 0;
}

.drop-zone {
  flex: 1;
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.drop-zone:hover {
  border-color: #999;
  background: #fafafa;
}

.drop-zone.dragover {
  border-color: #4a90d9;
  background: #e8f0fe;
}

.drop-zone.has-file {
  border-color: #4caf50;
  border-style: solid;
  background: #e8f5e9;
}

.drop-zone label {
  display: block;
  cursor: pointer;
}

.drop-zone .label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.drop-zone .filename {
  display: block;
  color: #888;
  font-size: 14px;
  word-break: break-all;
}

.drop-zone.has-file .filename {
  color: #2e7d32;
}

button {
  background: #4a90d9;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover:not(:disabled) {
  background: #357abd;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#combineBtn {
  display: block;
  width: 100%;
  margin: 20px 0;
}

.output-section {
  display: none;
  margin-top: 30px;
}

.output-section.visible {
  display: block;
}

.output-section h2 {
  color: #333;
  margin-bottom: 10px;
}

#output {
  width: 100%;
  height: 300px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 13px;
  resize: vertical;
  background: #fff;
}

.output-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.output-actions button {
  flex: 1;
}

#copyBtn {
  background: #666;
}

#copyBtn:hover {
  background: #555;
}

#downloadBtn {
  background: #4caf50;
}

#downloadBtn:hover {
  background: #43a047;
}

.ghost-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.title-select {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-select > label {
  font-weight: 600;
  color: #666;
}

.title-controls {
  flex: 1;
  display: flex;
  gap: 10px;
}

#titleSelect {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

#titleSelect:focus {
  outline: none;
  border-color: #8e44ad;
}

#customTitle {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

#customTitle:focus {
  outline: none;
  border-color: #8e44ad;
}

.excerpt-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.excerpt-field label {
  font-weight: 600;
  color: #666;
}

#excerptInput {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f9f9f9;
  color: #666;
}

.tag-select {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tag-label {
  font-weight: 600;
  color: #666;
  padding-top: 4px;
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #f0f0f0;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.tag-option:hover {
  background: #e0e0e0;
}

.tag-option input[type="checkbox"] {
  margin: 0;
}

.tag-option input[type="checkbox"]:checked + span {
  color: #8e44ad;
  font-weight: 600;
}

#ghostBtn {
  background: #8e44ad;
  white-space: nowrap;
  align-self: flex-end;
}

#ghostBtn:hover:not(:disabled) {
  background: #7d3c98;
}

.template-select {
  display: flex;
  align-items: center;
  gap: 10px;
}

.template-select label {
  font-weight: 600;
  color: #666;
}

#templateSelect {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

#templateSelect:focus {
  outline: none;
  border-color: #8e44ad;
}

.image-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-select > label {
  font-weight: 600;
  color: #666;
}

.image-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

#imageSelect {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

#imageSelect:focus {
  outline: none;
  border-color: #8e44ad;
}

.image-drop-zone {
  padding: 8px 12px;
  border: 1px dashed #ccc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #888;
  transition: all 0.2s;
  white-space: nowrap;
}

.image-drop-zone:hover {
  border-color: #8e44ad;
  color: #8e44ad;
}

.image-drop-zone.dragover {
  border-color: #8e44ad;
  background: #f5eef8;
}

.image-preview {
  display: none;
  margin-top: 8px;
}

.image-preview img {
  max-width: 200px;
  max-height: 120px;
  border-radius: 6px;
  border: 1px solid #ddd;
}

/* Add buttons */
.add-btn {
  padding: 6px 12px;
  font-size: 16px;
  font-weight: bold;
  background: #4caf50;
  min-width: 36px;
}

.add-btn:hover {
  background: #43a047;
}

/* Modal styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: white;
  padding: 24px;
  border-radius: 8px;
  min-width: 350px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal h3 {
  margin: 0 0 16px 0;
  color: #333;
}

.modal input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 12px;
}

.modal input:focus {
  outline: none;
  border-color: #4a90d9;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.modal-cancel {
  background: #666;
}

.modal-cancel:hover {
  background: #555;
}

.modal-save {
  background: #4caf50;
}

.modal-save:hover {
  background: #43a047;
}
