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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  min-height: 100vh;
}

.container { max-width: 700px; margin: 0 auto; padding: 40px 20px; }
header { text-align: center; margin-bottom: 40px; }
header h1 { font-size: 2rem; font-weight: 700; color: #16213e; }
.subtitle { margin-top: 8px; color: #6b7280; font-size: 1.05rem; }

/* Form */
.generator-form { background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; }
.required { color: #e53e3e; }

input[type="text"], textarea, input[type="datetime-local"] {
  width: 100%; padding: 12px 14px; border: 1.5px solid #d1d5db; border-radius: 10px;
  font-size: 1rem; transition: border-color 0.2s; font-family: inherit;
}
input[type="text"]:focus, textarea:focus, input[type="datetime-local"]:focus {
  outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* Mode toggle */
.mode-toggle { display: flex; gap: 4px; background: #f3f4f6; border-radius: 10px; padding: 4px; }
.mode-btn {
  flex: 1; padding: 10px 16px; border: none; border-radius: 8px; font-size: 0.9rem;
  font-weight: 600; cursor: pointer; background: transparent; color: #6b7280; transition: all 0.2s;
}
.mode-btn.active { background: #fff; color: #6366f1; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.mode-btn:hover:not(.active) { color: #374151; }
.lock-icon { font-size: 0.8rem; }

/* Tone chips */
.tone-selector { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tone-option input { display: none; }
.tone-chip {
  display: inline-block; padding: 8px 16px; border: 1.5px solid #d1d5db; border-radius: 20px;
  cursor: pointer; font-size: 0.9rem; transition: all 0.2s; user-select: none;
}
.tone-option input:checked + .tone-chip { background: #6366f1; color: #fff; border-color: #6366f1; }
.tone-chip:hover { border-color: #6366f1; }

/* Buttons */
.btn-generate {
  width: 100%; padding: 14px; background: #6366f1; color: #fff; border: none;
  border-radius: 12px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-generate:hover { background: #4f46e5; }
.btn-generate:disabled { opacity: 0.7; cursor: wait; }

/* Result block */
.result-block { margin-top: 32px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.result-block h2 { margin-bottom: 16px; font-size: 1.3rem; }

.post-preview {
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; margin-bottom: 16px;
  transition: border-color 0.2s;
}
.post-preview.editing { border-color: #6366f1; background: #fafaff; }
.post-title { font-size: 1.15rem; margin-bottom: 10px; }
.post-body { line-height: 1.6; color: #374151; white-space: pre-wrap; }
.post-title[contenteditable="true"], .post-body[contenteditable="true"] {
  outline: none; cursor: text;
}
.post-title[contenteditable="true"]:focus, .post-body[contenteditable="true"]:focus {
  background: #fff; border-radius: 6px;
}

/* Action buttons */
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.btn-action {
  padding: 10px 16px; border: 1.5px solid #d1d5db; border-radius: 10px; font-size: 0.9rem;
  font-weight: 600; cursor: pointer; background: #fff; transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.btn-edit { color: #6366f1; border-color: #6366f1; }
.btn-edit:hover { background: #6366f1; color: #fff; }
.btn-edit.active { background: #6366f1; color: #fff; }
.btn-edit .icon { font-size: 1.1rem; }
.btn-copy { color: #10b981; border-color: #10b981; }
.btn-copy:hover { background: #10b981; color: #fff; }
.btn-fav { color: #f59e0b; border-color: #f59e0b; }
.btn-fav:hover { background: #f59e0b; color: #fff; }

.copy-success { display: none; margin-top: 8px; color: #10b981; font-weight: 600; }
.success-message { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; border-radius: 10px; padding: 16px; font-weight: 500; }
.error-message { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 16px; font-weight: 500; }

/* Publish section */
.publish-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5e7eb; }
.publish-section h3 { font-size: 1rem; margin-bottom: 12px; color: #374151; }
.publish-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-publish {
  padding: 12px 24px; background: #4a76a8; color: #fff; border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-publish:hover { background: #3b6490; }
.btn-schedule-toggle {
  padding: 12px 20px; background: #fff; color: #6366f1; border: 1.5px solid #6366f1;
  border-radius: 10px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-schedule-toggle:hover { background: #6366f1; color: #fff; }
.btn-schedule {
  padding: 12px 24px; background: #8b5cf6; color: #fff; border: none; border-radius: 10px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-schedule:hover { background: #7c3aed; }

.schedule-form { margin-top: 16px; padding: 16px; background: #f9fafb; border-radius: 10px; border: 1px solid #e5e7eb; }

.vk-hint {
  margin-top: 16px; padding: 14px; background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: 10px; font-size: 0.9rem; color: #9a3412;
}
.vk-hint code { background: #fff; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }

.badge-ai {
  display: inline-block; background: #8b5cf6; color: #fff; font-size: 0.7rem;
  padding: 2px 8px; border-radius: 6px; vertical-align: middle; margin-left: 6px;
  font-weight: 700; letter-spacing: 0.5px;
}

/* Favorites */
.favorites-block { margin-top: 32px; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.favorites-block h2 { font-size: 1.2rem; margin-bottom: 16px; }
.favorites-list { display: flex; flex-direction: column; gap: 10px; }
.favorite-item {
  display: flex; justify-content: space-between; align-items: center; padding: 14px;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; gap: 12px;
}
.fav-content { flex: 1; min-width: 0; }
.fav-content strong { display: block; margin-bottom: 4px; font-size: 0.95rem; }
.fav-content p { font-size: 0.85rem; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-fav-use, .btn-fav-delete {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff;
  cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.btn-fav-use { color: #6366f1; border-color: #6366f1; }
.btn-fav-use:hover { background: #6366f1; color: #fff; }
.btn-fav-delete { color: #ef4444; border-color: #ef4444; }
.btn-fav-delete:hover { background: #ef4444; color: #fff; }

/* Scheduled */
.scheduled-block { margin-top: 32px; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.scheduled-block h2 { font-size: 1.2rem; margin-bottom: 16px; }
.scheduled-list { display: flex; flex-direction: column; gap: 10px; }
.scheduled-item { padding: 14px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; }
.scheduled-item.status-scheduled { border-left: 4px solid #6366f1; }
.scheduled-item.status-published { border-left: 4px solid #10b981; }
.scheduled-item.status-error { border-left: 4px solid #ef4444; }
.sched-info { display: flex; gap: 12px; margin-bottom: 6px; font-size: 0.85rem; }
.sched-status { font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.scheduled-item.status-scheduled .sched-status { color: #6366f1; }
.scheduled-item.status-published .sched-status { color: #10b981; }
.scheduled-item.status-error .sched-status { color: #ef4444; }
.sched-time { color: #6b7280; }
.scheduled-item p { font-size: 0.9rem; color: #374151; }
