/* ==========================================================================
   आदर्श न्यूज़ — Admin panel styles
   ========================================================================== */

:root {
  --ad-accent: #8f1d1d;
  --ad-accent-dark: #6b1313;
  --ad-ink: #1a1a1a;
  --ad-muted: #6b6b6b;
  --ad-line: #e3e3e3;
  --ad-bg: #f4f1ee;
  --ad-card: #ffffff;
  --ad-sidebar: #1f1212;
  --ad-sidebar-2: #2a1818;
  --ad-danger: #b00020;
  --ad-success: #1e7a33;
  --ad-warning: #a06a00;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.admin-body {
  font-family: "Mukta", "Noto Sans Devanagari", system-ui, sans-serif;
  background: var(--ad-bg);
  color: var(--ad-ink);
  font-size: 14.5px;
  line-height: 1.55;
}

.admin-shell { display: flex; min-height: 100vh; }

/* ---- Topbar ---- */
.admin-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--ad-line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  z-index: 50;
}
.admin-menu-btn {
  display: none;
  background: none; border: 1px solid var(--ad-line); border-radius: 6px;
  width: 36px; height: 36px; cursor: pointer; color: var(--ad-ink);
}
.admin-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ad-ink); font-weight: 800;
}
.admin-brand-mark {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--ad-accent); color: #fff;
  display: grid; place-items: center; font-family: serif; font-size: 19px;
}
.admin-brand em { color: var(--ad-accent); font-style: normal; }
.admin-topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 14px;
}
.admin-user { font-weight: 700; color: var(--ad-muted); font-size: 13px; }
.admin-link {
  text-decoration: none; color: var(--ad-accent); font-weight: 700; font-size: 13px;
}
.admin-link--danger { color: var(--ad-danger); }

/* ---- Sidebar ---- */
.admin-sidebar {
  position: fixed;
  top: 60px; left: 0; bottom: 0;
  width: 240px;
  background: linear-gradient(180deg, var(--ad-sidebar), var(--ad-sidebar-2));
  color: #f3e9e9;
  padding: 18px 12px;
  display: flex; flex-direction: column;
  overflow-y: auto;
  z-index: 40;
}
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #f3e9e9;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s;
}
.admin-nav-item svg { width: 18px; height: 18px; flex: none; }
.admin-nav-item:hover { background: rgba(255,255,255,.08); }
.admin-nav-item.is-active {
  background: var(--ad-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(143,29,29,.35);
}
.admin-sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.admin-sidebar-foot a { color: #c9a9a9; text-decoration: none; font-size: 13px; font-weight: 600; }
.admin-sidebar-foot a:hover { color: #fff; }

/* ---- Main ---- */
.admin-main {
  margin-left: 240px;
  margin-top: 60px;
  flex: 1;
  min-width: 0;
}
.admin-content { padding: 26px 28px 60px; max-width: 1280px; }

.admin-page-head { margin-bottom: 20px; }
.admin-page-head h1 {
  font-size: 26px; font-weight: 800; margin: 0 0 4px;
  font-family: "Noto Serif Devanagari", serif;
}
.admin-page-head p { margin: 0; color: var(--ad-muted); font-size: 13.5px; }

/* ---- Flash ---- */
.admin-flash {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  font-weight: 600; font-size: 13.5px;
  border-left: 4px solid var(--ad-success);
  background: #eaf5ec; color: #1b5e20;
}
.admin-flash.is-error { border-left-color: var(--ad-danger); background: #fbe9ec; color: #8b1220; }
.admin-flash.is-warning { border-left-color: var(--ad-warning); background: #fbf4e4; color: #7a5a00; }

/* ---- Cards / stats ---- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.admin-stat {
  background: var(--ad-card); border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
  border: 1px solid var(--ad-line);
}
.admin-stat .label { font-size: 11.5px; font-weight: 700; color: var(--ad-muted); text-transform: uppercase; letter-spacing: .05em; }
.admin-stat .value { font-size: 28px; font-weight: 800; color: var(--ad-accent); margin-top: 4px; font-family: "Noto Serif Devanagari", serif; }
.admin-stat .hint { font-size: 11.5px; color: var(--ad-muted); margin-top: 6px; }

.admin-card {
  background: var(--ad-card); border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
  border: 1px solid var(--ad-line);
  margin-bottom: 20px;
}
.admin-card h2 {
  font-size: 16px; font-weight: 800; margin: 0 0 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--ad-line);
  font-family: "Noto Serif Devanagari", serif;
}

/* ---- Buttons ---- */
.admin-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--ad-line);
  background: #fff; color: var(--ad-ink);
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.admin-btn:hover { border-color: var(--ad-accent); color: var(--ad-accent); }
.admin-btn--primary {
  background: var(--ad-accent); color: #fff; border-color: var(--ad-accent);
}
.admin-btn--primary:hover { background: var(--ad-accent-dark); color: #fff; }
.admin-btn--danger { background: var(--ad-danger); color: #fff; border-color: var(--ad-danger); }
.admin-btn--danger:hover { background: #8a0018; color: #fff; }
.admin-btn--ghost { background: transparent; }
.admin-btn--sm { padding: 5px 10px; font-size: 12px; }
.admin-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---- Forms ---- */
.admin-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-form .row--single { grid-template-columns: 1fr; }
.admin-field { margin-bottom: 14px; }
.admin-field label {
  display: block; font-size: 12.5px; font-weight: 700;
  color: var(--ad-ink); margin-bottom: 5px;
}
.admin-field input[type="text"],
.admin-field input[type="email"],
.admin-field input[type="password"],
.admin-field input[type="url"],
.admin-field input[type="number"],
.admin-field select,
.admin-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ad-line);
  border-radius: 8px;
  font-family: inherit; font-size: 14px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.admin-field input:focus, .admin-field select:focus, .admin-field textarea:focus {
  outline: none; border-color: var(--ad-accent);
  box-shadow: 0 0 0 3px rgba(143,29,29,.12);
}
.admin-field textarea { min-height: 90px; resize: vertical; }
.admin-field .hint { font-size: 11.5px; color: var(--ad-muted); margin-top: 4px; }
.admin-field .char-count { float: right; font-size: 11px; color: var(--ad-muted); font-weight: 600; }
.admin-checkbox { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.admin-checkbox input { width: 16px; height: 16px; accent-color: var(--ad-accent); }

/* ---- Rich text editor ---- */
.rte-wrap { border: 1px solid var(--ad-line); border-radius: 10px; overflow: hidden; background: #fff; }
.rte-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px; background: #faf7f6;
  border-bottom: 1px solid var(--ad-line);
}
.rte-btn {
  width: 32px; height: 32px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 14px; font-weight: 700;
  color: var(--ad-ink); display: grid; place-items: center;
}
.rte-btn:hover { background: #fff; border-color: var(--ad-line); }
.rte-btn.is-active { background: var(--ad-accent); color: #fff; }
.rte-sep { width: 1px; background: var(--ad-line); margin: 4px 2px; }
.rte-editor {
  min-height: 320px; padding: 16px 18px;
  font-family: "Noto Serif Devanagari", serif; font-size: 17px; line-height: 1.75;
  outline: none;
}
.rte-editor:empty::before { content: attr(data-placeholder); color: #aaa; }
.rte-source {
  display: none; width: 100%; min-height: 320px;
  padding: 16px 18px; border: none; resize: vertical;
  font-family: "Consolas", "Courier New", monospace; font-size: 13px; line-height: 1.6;
}
.rte-wrap.is-source .rte-editor { display: none; }
.rte-wrap.is-source .rte-source { display: block; }

/* ---- Tables ---- */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.admin-table th, .admin-table td {
  padding: 11px 12px; text-align: left;
  border-bottom: 1px solid var(--ad-line);
  vertical-align: middle;
}
.admin-table th {
  background: #faf7f6; font-weight: 800; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--ad-muted);
}
.admin-table tr:hover td { background: #fafafa; }
.admin-table .thumb {
  width: 52px; height: 38px; object-fit: cover; border-radius: 6px;
}
.admin-table .actions { display: flex; gap: 6px; }
.admin-table .title-cell { max-width: 340px; }
.admin-table .title-cell strong { font-weight: 700; }
.admin-table .title-cell small { display: block; color: var(--ad-muted); font-size: 11.5px; margin-top: 2px; }

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
}
.badge--published { background: #eaf5ec; color: #1b5e20; }
.badge--draft { background: #f0f0f0; color: #555; }
.badge--featured { background: #fdecea; color: var(--ad-accent); }

/* ---- Media grid ---- */
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.media-tile {
  background: #fff; border: 1px solid var(--ad-line); border-radius: 10px;
  overflow: hidden; cursor: pointer; position: relative;
}
.media-tile img { width: 100%; height: 120px; object-fit: cover; display: block; }
.media-tile .meta {
  padding: 8px; font-size: 11px; color: var(--ad-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-tile .del {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center; font-size: 14px;
}
.media-tile:hover .del { background: var(--ad-danger); }

.media-upload-box {
  border: 2px dashed var(--ad-line); border-radius: 12px;
  padding: 24px; text-align: center; background: #fafafa;
  margin-bottom: 18px;
}
.media-upload-box input[type="file"] { margin: 8px 0; }

/* ---- Modal ---- */
.admin-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(10,8,8,.6); z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
}
.admin-modal.is-open { display: flex; }
.admin-modal-card {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 820px; max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.admin-modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--ad-line);
  display: flex; align-items: center; justify-content: space-between;
}
.admin-modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.admin-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.admin-modal-foot { padding: 14px 20px; border-top: 1px solid var(--ad-line); text-align: right; }

/* ---- Login ---- */
.admin-login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #2a1212, #8f1d1d);
}
.admin-login-card {
  background: #fff; border-radius: 16px;
  padding: 34px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.admin-login-card h1 {
  font-size: 22px; margin: 0 0 6px; text-align: center;
  font-family: "Noto Serif Devanagari", serif;
}
.admin-login-card .sub { text-align: center; color: var(--ad-muted); font-size: 13px; margin-bottom: 20px; }
.admin-login-card .brand-mark {
  width: 56px; height: 56px; border-radius: 12px;
  background: var(--ad-accent); color: #fff;
  display: grid; place-items: center; font-family: serif; font-size: 30px;
  margin: 0 auto 14px;
}

/* ---- Misc ---- */
.admin-empty {
  text-align: center; padding: 40px 20px;
  color: var(--ad-muted); font-size: 14px;
}
.admin-empty strong { display: block; font-size: 16px; color: var(--ad-ink); margin-bottom: 6px; }
.admin-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-toolbar input[type="search"] {
  padding: 8px 11px; border: 1px solid var(--ad-line); border-radius: 8px;
  font-family: inherit; font-size: 13.5px; min-width: 220px;
}
.admin-toolbar select { padding: 8px 11px; border: 1px solid var(--ad-line); border-radius: 8px; font-family: inherit; font-size: 13.5px; }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--ad-line); }
.admin-tab {
  padding: 9px 14px; border: none; background: transparent;
  font-family: inherit; font-weight: 700; font-size: 13.5px;
  color: var(--ad-muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.admin-tab.is-active { color: var(--ad-accent); border-bottom-color: var(--ad-accent); }

code, .code { font-family: "Consolas", monospace; font-size: 12.5px; background: #f4f1ee; padding: 1px 5px; border-radius: 4px; }

@media (max-width: 880px) {
  .admin-menu-btn { display: grid; }
  .admin-sidebar {
    transform: translateX(-100%); transition: transform .2s;
  }
  .admin-sidebar.is-open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 20px 16px 40px; }
  .admin-form .row { grid-template-columns: 1fr; }
}
