/*main.css*/
* {
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

body {
  margin: 0;
  background: #f4f4f4;
  color: #222;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  background: #222;
  color: #fff;
}

.header a {
  color: #fff;
  float: right;
  text-decoration: none;
}

/* Общие стили контейнера постов */
.posts-list {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Шапка "таблицы" */
.posts-row.header-row {
    background: #eee;
    font-weight: bold;
    display: flex;
}

/* Строка поста */
.posts-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.posts-row:last-child { border-bottom: none; }

/* Колонки */
.cell {
    padding: 12px;
    flex: 1;
}

.cell.id { flex: 0 0 60px; }
.cell.preview { flex: 0 0 110px; text-align: center; }
.cell.status { flex: 0 0 100px; text-align: center; }
.cell.date { flex: 0 0 160px; font-size: 0.85em; }

/* Адаптивность под мобилки */
@media (max-width: 800px) {
    .posts-row.header-row { display: none; } /* Скрываем заголовки */

    .posts-row {
        flex-direction: column;
        padding: 15px;
        position: relative;
    }

    .cell {
        width: 100%;
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border-bottom: 1px solid #f5f5f5;
    }

    .cell::before {
        content: attr(data-label);
        font-weight: bold;
        color: #777;
    }

    .cell.id, .cell.preview, .cell.status, .cell.date {
        flex: none; /* Сбрасываем фиксированную ширину */
        text-align: right;
    }

    .cell.preview { 
        justify-content: space-between; 
        align-items: center;
    }
}

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.login-box {
  background: #fff;
  padding: 30px;
  width: 300px;
}

.login-box input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
}

.login-box button {
  width: 100%;
  padding: 10px;
}

.error {
  background: #fdd;
  padding: 8px;
  margin-bottom: 10px;
}

form label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
}

form input, form textarea {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
}

form button {
  margin-top: 15px;
  padding: 10px 15px;
}

.posts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.btn-add {
  background: #28a745;
  color: #fff;
  padding: 8px 15px;
  text-decoration: none;
  border-radius: 4px;
}

.btn-add:hover {
  background: #218838;
}

.thumb {
  max-width: 80px;
  cursor: zoom-in;
  border-radius: 4px;
  transition: transform .15s ease;
}

.thumb:hover {
  transform: scale(1.05);
}

.img-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.img-overlay img {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.view-container { max-width: 800px; margin: 0 auto; }

.view-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    align-items: center;
}

.post-card {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.post-title { margin-top: 0; margin-bootom: 5px; border-bottom: 2px solid #f4f4f4; padding-bottom: 0px; font-size: 20px; text-align: center;}

.post-image-box { text-align: center; margin: 20px 0 0; background: #fafafa; padding: 10px; border-radius: 5px; }
.post-image-box img { max-width: 100%; height: auto; border-radius: 4px; }

.post-description { line-height: 1.6; white-space: pre-wrap; margin: -50px 16px -50px 16px}

.post-link-box { 
    background: #e9f5ff; 
    padding: 15px; 
    border-radius: 5px; 
    margin: 15px 0 25px 0;
}

.external-link { color: #007bff; text-decoration: none; word-break: break-all; }

/* Кнопки и Группа */
.action-group { 
    display: flex; 
    gap: 10px; 
    align-items: flex-end; /* Выравнивание по нижнему краю */
}

.btn-edit, .btn-publish, .btn-delete {
    /* Унификация размеров */
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    /* Сброс стандартных стилей */
    padding: 0 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    line-height: 1; /* Чтобы текст не прыгал */
    box-sizing: border-box;
}

.btn-edit { background: #ffc107; color: #000; }
.btn-publish { background: #28a745; color: #fff; }
.btn-delete { background: #dc3545; color: #fff; }

/* Ховеры для красоты */
.btn-edit:hover { background: #e0a800; }
.btn-publish:hover { background: #218838; }
.btn-delete:hover { background: #c82333; }

.btn-back { 
    text-decoration: none; 
    color: #666; 
    height: 35px;
    display: inline-flex;
    align-items: center;
}

.settings-section {
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    background: #fdfdfd;
}

.settings-section h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.settings-form label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
    font-size: 0.9em;
}

.settings-section.disabled {
    opacity: 0.6;
    background: #f9f9f9;
}

.status-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: bold;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot.green { background-color: #28a745; box-shadow: 0 0 5px #28a745; }
.dot.red { background-color: #dc3545; box-shadow: 0 0 5px #dc3545; }
.dot.gray { background-color: #adb5bd; }

/* Стили для тумблера */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #1cbf0b; /* Твой фирменный зеленый */
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

/* Контейнер для индикаторов в таблице */
.status-indicators-mini {
  display: flex;
  gap: 4px;
}

/* Общий стиль фонаря */
.status-indicators-mini .dot {
  font-size: 9px;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 3px;
  color: #fff;
  cursor: help;
  text-transform: uppercase;
  min-width: 20px;
  text-align: center;
}

/* Цвета статусов */
.status-indicators-mini .dot.gray { background-color: #e0e0e0; color: #9e9e9e; }
.status-indicators-mini .dot.green { background-color: #4caf50; }
.status-indicators-mini .dot.red { background-color: #f44336; }

/* Адаптив для ячейки */
.cell.social {
  width: 100px;
  display: flex;
  align-items: center;
}

.status-indicators-row {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}
.status-mini-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.status-mini-item small {
  font-size: 8px;
  margin-bottom: 2px;
  color: #888;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
}
.dot.green { background-color: #28a745; }
.dot.red   { background-color: #dc3545; }
.dot.gray  { background-color: #bbb; }

.status-item.clickable {
    cursor: pointer;
    transition: transform 0.2s;
    padding: 5px 10px;
    border-radius: 4px;
}
.status-item.clickable:hover {
    background: #eef2ff;
    transform: translateY(-2px);
}

  .btn-page {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: 0.2s;
  }
  .btn-page:hover {
    background: #f5f5f5;
    border-color: #7B1FA2;
    color: #7B1FA2;
  }
  .btn-page.active {
    background: #7B1FA2;
    color: #fff;
    border-color: #7B1FA2;
    box-shadow: 0 2px 4px rgba(123, 31, 162, 0.3);
  }