/* ===================================================
   SOTAI — news.css
   News list, detail, create/edit form pages.
   Uses vars from main.css.
   =================================================== */

:root {
  --news-accent-l: #eef4ff;
  --news-accent-b: #c8ddf7;
  --news-danger-bg: rgba(239,68,68,.08);
  --news-danger-border: rgba(239,68,68,.22);
  --news-danger-color: #b91c1c;
}

[data-theme="dark"] {
  --news-accent-l: #1c2e58;
  --news-accent-b: #2a4478;
  --news-danger-bg: rgba(239,68,68,.12);
  --news-danger-border: rgba(239,68,68,.3);
  --news-danger-color: #fca5a5;
}

/* ===== PAGE WRAPPER ===== */
.news-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.news-page--detail,
.news-page--form {
  max-width: 760px;
}

/* ===== HEADER ===== */
.news-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.news-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: 8px;
  transition: color .3s;
}

.news-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.news-h1 {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -.3px;
  margin: 0 0 4px;
  transition: color .3s;
}

.news-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  transition: color .3s;
}

/* ===== BUTTONS ===== */
.news-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .15s, background .3s;
  white-space: nowrap;
}

.news-btn-add svg { width: 14px; height: 14px; stroke: #fff; }
.news-btn-add:hover { opacity: .9; color: #fff; }

.news-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, background .3s;
}

.news-btn-primary:hover { opacity: .9; }

.news-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background .3s, color .3s;
}

.news-btn-secondary:hover { border-color: var(--text-muted); color: var(--text-primary); }

.news-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--news-danger-bg);
  color: var(--news-danger-color);
  border: 1px solid var(--news-danger-border);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .15s;
}

.news-btn-danger:hover { opacity: .85; }

/* ===== BACK LINK ===== */
.news-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .15s;
}

.news-back svg { width: 14px; height: 14px; stroke: currentColor; }
.news-back:hover { color: var(--accent); }

/* ===== NEWS GRID ===== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) { .news-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .news-grid { grid-template-columns: 1fr; } }

/* ===== NEWS CARD ===== */
.news-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: background .3s, border-color .3s, transform .15s, box-shadow .15s;
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* Cover */
.news-card__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-toolbar);
}

.news-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.news-card:hover .news-card__cover img { transform: scale(1.03); }

.news-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-card__cover--placeholder svg {
  width: 36px;
  height: 36px;
  stroke: var(--text-muted);
}

/* Body */
.news-card__body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.news-card__date {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: color .3s;
}

.news-card__title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
  transition: color .3s;
}

.news-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color .15s;
}

.news-card__title a:hover { color: var(--accent); }

.news-card__summary {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  transition: color .3s;
}

/* Footer */
.news-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  transition: border-color .3s;
}

.news-card__read {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  transition: gap .15s;
}

.news-card__read svg { width: 13px; height: 13px; stroke: var(--accent); }
.news-card__read:hover { gap: 8px; }

/* Admin actions */
.news-card__actions {
  display: flex;
  gap: 6px;
}

.news-action {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-toolbar);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}

.news-action svg { width: 14px; height: 14px; }

.news-action--edit svg   { stroke: var(--accent); }
.news-action--delete svg { stroke: var(--news-danger-color); }

.news-action--edit:hover   { background: var(--news-accent-l); border-color: var(--news-accent-b); }
.news-action--delete:hover { background: var(--news-danger-bg); border-color: var(--news-danger-border); }

/* ===== EMPTY STATE ===== */
.news-empty {
  padding: 48px 24px;
  border-radius: 16px;
  border: 1.5px dashed var(--border);
  background: var(--bg-toolbar);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: all .3s;
}

.news-empty__icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--news-accent-l);
  border: 1px solid var(--news-accent-b);
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-empty__icon svg {
  width: 24px; height: 24px;
  stroke: var(--accent);
}

.news-empty p {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ===== ARTICLE DETAIL ===== */
.news-article {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: background .3s, border-color .3s;
}

.news-article__cover {
  width: 100%;
  max-height: 400px;
  overflow: hidden;
}

.news-article__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-article__header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  transition: border-color .3s;
}

.news-article__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color .3s;
}

.news-article__sep { opacity: .5; }

.news-article__title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -.3px;
  margin: 0 0 12px;
  line-height: 1.3;
  transition: color .3s;
}

.news-article__lead {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  font-style: italic;
  transition: color .3s;
}

.news-article__body {
  padding: 24px 32px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  transition: color .3s;
}

.news-article__body p { margin-bottom: 14px; }

.news-article__admin-bar {
  display: flex;
  gap: 10px;
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  background: var(--bg-toolbar);
  transition: background .3s, border-color .3s;
}

/* ===== FORM ===== */
.news-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: background .3s, border-color .3s;
}

.news-form-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: border-color .3s;
}

.news-form-card__head::before {
  content: '';
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.news-form-card__title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  transition: color .3s;
}

.news-form-card__hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-toolbar);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: all .3s;
}

.news-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.news-form__field--check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.news-form__label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  transition: color .3s;
}

.news-form__label--check {
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.news-form__req { color: #ef4444; }

/* Override Django widget classes */
.news-form__input,
textarea.news-form__input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color .2s, box-shadow .2s, background .3s, color .3s;
}

.news-form__textarea { min-height: 320px; }

.news-form__input::placeholder { color: var(--text-muted); font-weight: 400; }

.news-form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,79,163,.12);
}

[data-theme="dark"] .news-form__input:focus {
  box-shadow: 0 0 0 3px rgba(77,136,224,.18);
}

.news-form__checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

.news-form__error {
  font-size: 12px;
  color: var(--news-danger-color);
  padding: 4px 8px;
  background: var(--news-danger-bg);
  border-radius: 6px;
}

.news-form__current-img {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.news-form__current-img img {
  width: 80px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.news-form__current-img span {
  font-size: 12px;
  color: var(--text-muted);
}

.news-form__actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}
