/* Farma Fajnor — Admin styles */
:root {
  --cream: #f7f2e9;
  --warm-white: #fdfaf4;
  --brown: #3d2b1f;
  --brown-mid: #6b4c38;
  --brown-light: #a0714f;
  --gold: #c9922a;
  --gold-light: #e8b96a;
  --green: #4a6741;
  --dark: #1e1610;
  --text: #3a2e24;
  --text-muted: #7a6a5a;
  --border: #ddd0be;
  --sidebar-w: 240px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', sans-serif;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(61,43,31,0.12);
  --transition: 0.3s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--warm-white); color: var(--text); font-size: 15px; }

/* ---- Login ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  padding: 24px;
}
.login-card {
  background: var(--warm-white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  text-align: center;
}
.login-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 20px;
  border: 3px solid rgba(201,146,42,0.4);
}
.login-card h1 {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--brown);
  margin-bottom: 6px;
}
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.login-error {
  padding: 12px;
  background: rgba(180,60,60,0.1);
  color: #b43c3c;
  border-radius: var(--radius);
  font-size: 13px;
  text-align: center;
}
.login-back {
  display: block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.login-back:hover { color: var(--gold); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; font-weight: 700;
  letter-spacing: 0.04em; border: 2px solid transparent;
  cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.btn--primary { background: var(--brown); color: var(--cream); border-color: var(--brown); }
.btn--primary:hover { background: var(--brown-mid); border-color: var(--brown-mid); }
.btn--ghost { background: transparent; color: var(--brown); border-color: var(--border); }
.btn--ghost:hover { background: var(--cream); }
.btn--outline { background: transparent; color: var(--brown-mid); border-color: var(--border); }
.btn--outline:hover { background: var(--cream); border-color: var(--brown-light); }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--full { width: 100%; justify-content: center; }
.btn--danger { background: #b43c3c; color: #fff; border-color: #b43c3c; }
.btn--danger:hover { background: #8f2d2d; }

/* ---- Fields ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brown-mid);
}
.field input, .field textarea, .field select {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: white; color: var(--text); font-family: var(--font-body); font-size: 14px;
  transition: border-color var(--transition); outline: none; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brown-mid);
  box-shadow: 0 0 0 3px rgba(106,76,56,0.1);
}

/* ---- Admin layout ---- */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(201,146,42,0.15);
}
.sidebar__brand img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(201,146,42,0.3);
}
.sidebar__brand span {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--cream);
}
.sidebar__brand em { font-style: italic; color: var(--gold-light); }
.sidebar__nav {
  flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
.sidebar__link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  color: rgba(247,242,233,0.6); font-size: 14px; font-weight: 700;
  transition: all var(--transition); text-decoration: none;
}
.sidebar__link:hover { background: rgba(247,242,233,0.08); color: var(--cream); }
.sidebar__link.active { background: rgba(201,146,42,0.15); color: var(--gold-light); }
.sidebar__footer {
  padding: 16px 12px; border-top: 1px solid rgba(247,242,233,0.08);
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar__footer .btn {
  color: rgba(247,242,233,0.8);
  border-color: rgba(247,242,233,0.25);
  background: transparent;
  justify-content: center;
}
.sidebar__footer .btn:hover {
  color: #fff;
  border-color: rgba(247,242,233,0.6);
  background: rgba(247,242,233,0.1);
}

/* ---- Main ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.tab-panel { display: none; flex: 1; flex-direction: column; }
.tab-panel.active { display: flex; }
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px 36px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.admin-header h2 {
  font-family: var(--font-display); font-size: 24px; color: var(--brown);
}
.admin-body { padding: 32px 36px; flex: 1; }

/* ---- CMS sections ---- */
.cms-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}
.cms-section__title {
  font-size: 16px; font-weight: 700; color: var(--brown);
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field--full { grid-column: 1 / -1; }

/* ---- Cards / Socials editor ---- */
.card-row, .social-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.card-row__fields { flex: 1; display: flex; gap: 8px; flex-wrap: wrap; }
.card-row__fields .field { flex: 1; min-width: 120px; }
.card-row__fields .field--icon { max-width: 80px; }
.remove-btn {
  background: none; border: none; cursor: pointer; font-size: 18px;
  color: #b43c3c; padding: 4px; border-radius: 4px; flex-shrink: 0;
  transition: background var(--transition);
}
.remove-btn:hover { background: rgba(180,60,60,0.1); }

/* ---- Gallery admin ---- */
.gallery-preview { margin-top: 20px; }
.gallery-preview h4 { font-size: 14px; font-weight: 700; color: var(--brown-mid); margin-bottom: 12px; }
.gallery-preview__grid, .admin-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.gallery-preview__item, .admin-gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  border: 2px solid var(--border);
  background: var(--cream);
}
.gallery-preview__item img, .admin-gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.gallery-preview__caption {
  padding: 6px 8px;
  background: rgba(0,0,0,0.7);
  position: absolute; bottom: 0; left: 0; right: 0;
}
.gallery-preview__caption input {
  width: 100%; background: none; border: none; color: white;
  font-size: 12px; outline: none; font-family: var(--font-body);
}
.gallery-preview__caption input::placeholder { color: rgba(255,255,255,0.5); }
.admin-gallery-item__remove {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px;
  background: rgba(180,60,60,0.9); color: white; border: none;
  border-radius: 50%; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition);
}
.admin-gallery-item:hover .admin-gallery-item__remove { opacity: 1; }
.upload-hint {
  background: rgba(201,146,42,0.06);
  border: 1px solid rgba(201,146,42,0.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}
.upload-hint p + p { margin-top: 6px; }

/* ---- Messages ---- */
.msgs-list { display: flex; flex-direction: column; gap: 12px; }
.msg-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.msg-card__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.msg-card__name { font-weight: 700; color: var(--brown); }
.msg-card__time { font-size: 12px; color: var(--text-muted); }
.msg-card__meta { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.msg-card__body { font-size: 14px; line-height: 1.7; color: var(--text); white-space: pre-wrap; }
.msgs-empty { text-align: center; padding: 40px; color: var(--text-muted); font-style: italic; }

/* ---- Toast ---- */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 12px 18px; border-radius: var(--radius);
  background: var(--brown); color: var(--cream);
  font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow); animation: slideIn 0.3s ease; max-width: 280px;
}
.toast--success { background: #4a6741; }
.toast--error { background: #b43c3c; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
