/* ============================================================
   ভোরের আলো — Admin Panel CSS (Fully Responsive)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&display=swap');

:root {
  --sidebar-w: 240px;
  --ar: #c0392b;
  --ar-dark: #96281b;
  --a-dark: #2c3e50;
  --a-darker: #1a252f;
  --a-bg: #f0f2f5;
  --a-white: #fff;
  --a-border: #dee2e6;
  --a-text: #2d3748;
  --a-muted: #718096;
  --a-success: #27ae60;
  --a-warning: #f39c12;
  --a-info: #2980b9;
  --a-font: 'Hind Siliguri', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--a-font); background: var(--a-bg); color: var(--a-text); }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
input, textarea, select, button { font-family: var(--a-font); }

/* ---- LAYOUT ---- */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--a-dark);
  color: #ccc;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: transform .3s ease;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: #444; }

.sidebar-brand {
  background: var(--a-darker);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  cursor: pointer;
  text-decoration: none;
}
.sidebar-brand:hover { background: rgba(255,255,255,.05); }
.sidebar-brand .logo { font-size: 18px; font-weight: 700; color: var(--ar); }
.sidebar-brand .sub { font-size: 10px; color: #888; letter-spacing: 1px; margin-top: 2px; }

.sidebar-nav { padding: 8px 0 80px; }
.nav-section {
  font-size: 10px; color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 16px 4px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: #bbb; font-size: 14px;
  border-left: 3px solid transparent;
  transition: background .15s;
  white-space: nowrap;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.07);
  color: #fff;
  border-left-color: var(--ar);
}
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---- MAIN AREA ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOP BAR ---- */
.admin-topbar {
  background: var(--a-white);
  border-bottom: 1px solid var(--a-border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 40;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  gap: 12px;
}
.admin-topbar .page-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.admin-topbar .topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.admin-topbar .user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--a-muted); }
.admin-topbar .user-info img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }

#sidebarToggle {
  background: none; border: none; cursor: pointer;
  padding: 6px; display: none; flex-shrink: 0;
  color: var(--a-text);
}

/* ---- CONTENT ---- */
.admin-content { padding: 20px; flex: 1; min-width: 0; }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--a-white); border-radius: 8px;
  padding: 18px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex; align-items: center; gap: 14px;
  border-left: 4px solid transparent;
  min-width: 0;
}
.stat-card.red   { border-left-color: var(--ar); }
.stat-card.green { border-left-color: var(--a-success); }
.stat-card.blue  { border-left-color: var(--a-info); }
.stat-card.orange{ border-left-color: var(--a-warning); }
.stat-card .icon { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-card.red   .icon { background: #fdecea; }
.stat-card.green .icon { background: #eafaf1; }
.stat-card.blue  .icon { background: #eaf4fb; }
.stat-card.orange.icon { background: #fef9e7; }
.stat-card .stat-num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: 12px; color: var(--a-muted); margin-top: 2px; }

/* ---- CARD ---- */
.card {
  background: var(--a-white);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--a-border);
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

/* ---- TABLE ---- */
.admin-table { width: 100%; border-collapse: collapse; min-width: 0; }
.admin-table th,
.admin-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--a-border);
  font-size: 13.5px;
  white-space: nowrap;
}
.admin-table td:nth-child(2) { white-space: normal; }
.admin-table th {
  background: var(--a-bg);
  font-weight: 600;
  color: var(--a-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- BADGES ---- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.badge-success   { background: #eafaf1; color: #1e8449; }
.badge-warning   { background: #fef9e7; color: #d68910; }
.badge-danger    { background: #fdecea; color: #c0392b; }
.badge-info      { background: #eaf4fb; color: #1a5276; }
.badge-secondary { background: #f0f2f5; color: #6c757d; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 4px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; border: none;
  font-family: var(--a-font);
  transition: .15s; white-space: nowrap;
}
.btn-primary   { background: var(--ar);       color: #fff; }
.btn-primary:hover { background: var(--ar-dark); color: #fff; }
.btn-secondary { background: var(--a-bg);    color: var(--a-text); border: 1px solid var(--a-border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success   { background: var(--a-success); color: #fff; }
.btn-success:hover { background: #219a52; color: #fff; }
.btn-danger    { background: #e74c3c; color: #fff; }
.btn-danger:hover  { background: #c0392b; color: #fff; }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-icon{ padding: 6px; width: 32px; height: 32px; justify-content: center; }

/* ---- FORMS ---- */
.form-group   { margin-bottom: 16px; }
.form-label   { display: block; font-size: 13px; font-weight: 600; color: var(--a-text); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--a-border);
  border-radius: 4px; font-size: 14px;
  font-family: var(--a-font);
  background: var(--a-white); color: var(--a-text);
  outline: none; transition: .15s;
}
.form-control:focus { border-color: var(--ar); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--a-muted); margin-top: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ---- IMAGE UPLOAD ---- */
.img-upload-wrap {
  border: 2px dashed var(--a-border);
  border-radius: 4px; padding: 20px;
  text-align: center; cursor: pointer;
  transition: .2s; position: relative;
}
.img-upload-wrap:hover { border-color: var(--ar); background: rgba(192,57,43,.03); }
.img-upload-wrap .preview { max-width: 100%; max-height: 200px; margin: 10px auto; border-radius: 4px; display: none; }
.img-upload-wrap .preview.show { display: block; }

/* ---- TOGGLE ---- */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 24px; cursor: pointer; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--ar); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- FILTERS BAR ---- */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters-bar .form-control { width: auto; }

/* ---- PAGINATION ---- */
.admin-pagination { display: flex; gap: 4px; justify-content: flex-end; padding: 12px 0; flex-wrap: wrap; }
.admin-pagination a,
.admin-pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 6px; border: 1px solid var(--a-border); font-size: 13px; border-radius: 3px; color: var(--a-text); }
.admin-pagination a:hover { border-color: var(--ar); color: var(--ar); }
.admin-pagination .current { background: var(--ar); color: #fff; border-color: var(--ar); }

/* ---- REVISION ---- */
.revision-item { padding: 12px 0; border-bottom: 1px solid var(--a-border); font-size: 13px; }
.revision-item:last-child { border-bottom: none; }
.revision-item .rev-meta { color: var(--a-muted); margin-bottom: 4px; }

/* ---- OVERLAY (mobile sidebar backdrop) ---- */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 49; }
.sidebar-overlay.show { display: block; }

/* ---- LOGO/FAVICON PREVIEW ---- */
.logo-preview { max-height: 60px; max-width: 220px; margin-top: 8px; border-radius: 3px; border: 1px solid var(--a-border); }
.favicon-preview { max-height: 32px; max-width: 32px; margin-top: 8px; border: 1px solid var(--a-border); }

/* ============================================================
   RESPONSIVE — TABLET (768–1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   RESPONSIVE — MOBILE (< 768px)
   ============================================================ */
@media (max-width: 767px) {
  /* Sidebar hidden off-screen */
  .admin-sidebar {
    transform: translateX(-100%);
    z-index: 51;
    width: 260px;
  }
  .admin-sidebar.open { transform: translateX(0); }

  /* Main takes full width */
  .admin-main { margin-left: 0 !important; }

  /* Show hamburger */
  #sidebarToggle { display: flex !important; }

  /* Stats 2 col */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; }
  .stat-card .stat-num { font-size: 18px; }

  /* Forms single col */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }

  /* Content padding */
  .admin-content { padding: 12px; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* Topbar */
  .admin-topbar { padding: 0 12px; height: 50px; }
  .admin-topbar .page-title { font-size: 14px; }
  .user-info .badge { display: none; }

  /* Table scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table th, .admin-table td { padding: 8px 10px; font-size: 12px; }

  /* Filters wrap */
  .filters-bar { gap: 6px; }
  .filters-bar .form-control { font-size: 13px; }
  .filters-bar .btn { padding: 7px 12px; font-size: 13px; }

  /* Article form 2-col grid article layout */
  .article-form-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn { font-size: 13px; }
}
