* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  color: #000;
  line-height: 1.6;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

header {
  border-bottom: 1px solid #ccc;
  padding: 20px 0;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 400;
}

header h1 a {
  color: #000;
  text-decoration: none;
}

nav a {
  color: #000;
  text-decoration: none;
  border: 1px solid #000;
  border-radius: 30px;
  padding: 8px 20px;
  margin-left: 10px;
  transition: all 0.2s ease;
  display: inline-block;
}

nav a:hover {
  background: #000;
  color: #fff;
}

h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 10px;
}

.date {
  color: #666;
  font-size: 0.9rem;
  margin: 5px 0;
}

/* Главная: превью постов */
.post-preview {
  border-bottom: 1px solid #eee;
  padding: 20px 0;
}

.post-preview:last-child {
  border-bottom: none;
}

.post-preview h2 a {
  color: #000;
  font-weight: 600;
  text-decoration: none;
}

.post-preview h2 a:hover {
  text-decoration: underline;
}

.preview {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.preview img {
  max-width: 150px;
  height: auto;
  border: 1px solid #ddd;
}

.preview p {
  flex: 1;
  margin: 0;
}

.read-more {
  display: inline-block;
  margin-top: 10px;
  color: #000;
}

/* Страница поста */
.post-header {
  margin-bottom: 30px;
}

.post-header h2 {
  font-size: 2rem;
  font-weight: 600;
}

.post-image {
  margin: 20px 0;
  text-align: center;
}

.post-image img {
  max-width: 100%;
  border: 1px solid #ddd;
}

.post-content {
  font-size: 1.1rem;
  line-height: 1.7;
  font-family: 'Geologica', 'Times New Roman', serif; /* Добавьте эту строку */
}

.post-content strong { font-weight: 600; }
.post-content em { font-style: italic; }
.post-content u { text-decoration: underline; }
.post-content a { color: #000; }
.post-content img { max-width: 100%; margin: 10px 0; }
.post-content pre {
  background: #f5f5f5;
  padding: 15px;
  overflow-x: auto;
  border-left: 3px solid #000;
  margin: 20px 0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 4px;
}
.post-content code {
  background: #f5f5f5;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}
.post-content blockquote { border-left: 3px solid #ccc; padding-left: 15px; color: #444; margin: 10px 0; }

footer {
  margin-top: 50px;
  border-top: 1px solid #ccc;
  padding: 20px 0;
  text-align: center;
}

/* Формы */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 5px;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  font-size: 1rem;
  font-family: inherit;
}

input[type="file"] {
  padding: 5px 0;
}

button, .btn {
  display: inline-block;
  padding: 10px 25px;
  background: #000;
  color: #fff;
  border: 1px solid #000;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

button:hover, .btn:hover {
  background: #fff;
  color: #000;
}

.error {
  background: #fdd;
  color: #a00;
  padding: 10px;
  margin-bottom: 20px;
  text-align: center;
}

.back {
  text-align: center;
  margin-top: 20px;
}

.back a {
  color: #000;
}

/* Админка */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

th {
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

.post-title {
  font-weight: 500;
}

.delete-form {
  display: inline;
}

.delete-btn {
  background: none;
  border: 1px solid #000;
  border-radius: 30px;
  color: #000;
  padding: 5px 15px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.delete-btn:hover {
  background: #000;
  color: #fff;
}

.actions {
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .preview {
    flex-direction: column;
  }
  .preview img {
    max-width: 100%;
  }
}

/* Стили для редактора поста */
.mode-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.mode-btn {
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 30px;
  padding: 8px 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: #000;
  color: #fff;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
  padding: 10px;
  background: #f5f5f5;
  border: 1px solid #ddd;
}

.toolbar-btn {
  background: #fff;
  color: #000;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 6px 12px;
  min-width: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background: #e0e0e0;
}

.button-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

#previewBtn {
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 30px;
  padding: 10px 25px;
  transition: all 0.2s ease;
}

#previewBtn:hover {
  background: #000;
  color: #fff;
}

/* Стили для области предпросмотра */
.preview-area {
  margin-top: 40px;
  padding: 20px;
  border: 2px solid #000;
  background: #fafafa;
}

.preview-area h3 {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
}

.post-cut {
  text-align: center;
  color: #666;
  font-style: italic;
  margin: 20px 0;
  padding: 10px;
  background: #f0f0f0;
  border: 1px dashed #999;
}

#closePreview {
  margin-top: 20px;
  width: 100%;
  padding: 10px 25px;
  background: #000;
  color: #fff;
  border: 1px solid #000;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#closePreview:hover {
  background: #fff;
  color: #000;
}

/* Для HTML режима - изображения */
.post-content img {
  max-width: 100%;
  height: auto;
  margin: 10px 0;
}

/* Индикация кат-тега в редакторе */
textarea {
  font-family: monospace;
  line-height: 1.5;
}

.edit-btn {
  background: none;
  border: 1px solid #000;
  border-radius: 30px;
  color: #000;
  padding: 5px 15px;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s ease;
  display: inline-block;
}

.edit-btn:hover {
  background: #000;
  color: #fff;
}

.hidden-post {
  opacity: 0.6;
  background-color: #f9f9f9;
}

.status-hidden {
  color: #999;
  font-style: italic;
}

.status-visible {
  color: #000;
  font-weight: 500;
  font-size: 10px;
}

.hide-btn {
  background: none;
  border: 1px solid #ff9800;
  border-radius: 30px;
  color: #ff9800;
  padding: 5px 15px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.hide-btn:hover {
  background: #ff9800;
  color: #fff;
}

.show-btn {
  background: none;
  border: 1px solid #4caf50;
  border-radius: 30px;
  color: #4caf50;
  padding: 5px 15px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.show-btn:hover {
  background: #4caf50;
  color: #fff;
}