
/* styles.css — общий стиль контент-панели marinet.tech */

/* === Сброс и базовое === */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1f2937;
  background: #f7f8fa;
}

a {
  color: #2563eb;
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }

p  { margin: 0 0 12px; }

/* === Шапка (видна на всех экранах кроме логина) === */

.topbar {
  background: #1f3a5f;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar__brand {
  font-weight: 600;
  font-size: 16px;
}
.topbar__nav {
  display: flex;
  gap: 16px;
}
.topbar__nav a {
  color: #cbd5e1;
  font-size: 14px;
}
.topbar__nav a.active,
.topbar__nav a:hover { color: #fff; text-decoration: none; }

.topbar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #cbd5e1;
}
.topbar__logout {
  background: transparent;
  border: 1px solid #4b6685;
  color: #cbd5e1;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.topbar__logout:hover { background: #2c4a70; color: #fff; }

/* === Контейнер контента === */

.container {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 24px;
}

/* === Карточки и блоки === */

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 16px;
}

/* === Формы === */

.form-row {
  margin-bottom: 14px;
}
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 4px;
}
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="date"],
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font: inherit;
  background: #fff;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* === Кнопки === */

.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  cursor: pointer;
}
.btn:hover { background: #f3f4f6; }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.btn--primary:hover { background: #1d4ed8; }

.btn--danger {
  background: #fff;
  border-color: #dc2626;
  color: #dc2626;
}
.btn--danger:hover { background: #fef2f2; }

.btn--small {
  padding: 4px 10px;
  font-size: 13px;
}

/* === Сообщения (ошибка / успех) === */

.alert {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.alert--success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* === Экран логина === */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f8fa;
}
.login-card {
  width: 380px;
  max-width: 92vw;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.login-card h1 {
  text-align: center;
  margin-bottom: 8px;
}
.login-card .subtitle {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 24px;
}

/* === Утилиты === */

.text-muted { color: #6b7280; }
.text-small { font-size: 13px; }
.spacer-12  { height: 12px; }
.flex       { display: flex; gap: 12px; align-items: center; }
.flex-end   { display: flex; gap: 12px; justify-content: flex-end; }

/* === HTML-редактор (contenteditable) === */

.editor {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
.editor:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.editor__toolbar {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.editor__btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: #1f2937;
  cursor: pointer;
}
.editor__btn:hover {
  background: #fff;
  border-color: #d1d5db;
}
.editor__btn:active {
  background: #e5e7eb;
}

.editor__area {
  min-height: 200px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
  line-height: 1.5;
}
.editor__area p { margin: 0 0 10px; }
.editor__area p:last-child { margin-bottom: 0; }
.editor__area a { color: #2563eb; }
.editor__area ul,
.editor__area ol { margin: 0 0 10px; padding-left: 24px; }
.editor__area:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
}

/* === Галерея фото в форме события === */

.gallery {
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 12px;
  background: #f9fafb;
}

.gallery__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.gallery__counter {
  font-size: 13px;
  color: #6b7280;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.gallery__item {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery__item--uploading {
  opacity: 0.6;
}
.gallery__item--uploading::after {
  content: 'Загрузка...';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.7);
  font-size: 13px;
  color: #1f2937;
}

.gallery__controls {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
}
.gallery__btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 3px;
  background: rgba(255,255,255,0.92);
  color: #1f2937;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery__btn:hover { background: #fff; }
.gallery__btn--danger { color: #dc2626; }
.gallery__btn:disabled { opacity: 0.4; cursor: not-allowed; }

.gallery__pos {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}

.gallery__add {
  margin-top: 10px;
}
.gallery__add input[type="file"] {
  display: none;
}
.gallery__add-btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px dashed #9ca3af;
  border-radius: 4px;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  font-size: 14px;
}
.gallery__add-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}
.gallery__add-btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
