/* ============================================
   OBEC ADMIN PANEL – Stylesheet
   ============================================ */

:root {
  --blue-900: #0a1628;
  --blue-800: #0d2041;
  --blue-700: #0f2d5e;
  --blue-600: #1a3f7a;
  --blue: #1e4fa0;
  --blue-light: #2563c7;
  --blue-accent: #3b82f6;
  --blue-pale: #dbeafe;
  --blue-faint: #eff6ff;
  --gold: #c9a227;
  --white: #ffffff;
  --off-white: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --sidebar-w: 260px;
  --shadow: 0 2px 12px rgba(10,22,40,0.1);
  --radius: 8px;
  --transition: 0.22s ease;
  --font-body: 'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
  --font-mono: 'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font-body); background: var(--gray-100); color: var(--gray-900); display: flex; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ---- Sidebar ---- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--blue-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo img { height: 36px; }
.sidebar-logo-text { display: flex; flex-direction: column; }
.sidebar-logo-name { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; color: var(--white); }
.sidebar-logo-sub { font-size: 0.65rem; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.06em; }

.sidebar-section { padding: 20px 0 8px; }
.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.3);
  padding: 0 20px;
  margin-bottom: 4px;
}
.sidebar-nav li a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  font-size: 0.87rem;
  color: rgba(255,255,255,0.6);
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
}
.sidebar-nav li a i { width: 18px; font-size: 0.95rem; }
.sidebar-nav li a:hover { color: var(--white); background: rgba(255,255,255,0.06); }
.sidebar-nav li a.active {
  color: var(--white);
  background: rgba(59,130,246,0.18);
  border-right: 3px solid var(--blue-accent);
}
.sidebar-nav li a .badge {
  margin-left: auto;
  background: var(--blue-accent);
  color: var(--white);
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 100px;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 16px 20px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
  width: 36px; height: 36px;
  background: var(--blue-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; color: var(--white); }
.sidebar-user-role { font-size: 0.72rem; color: rgba(255,255,255,0.4); }
.sidebar-user a { color: rgba(255,255,255,0.4); font-size: 0.82rem; transition: color var(--transition); }
.sidebar-user a:hover { color: #ef4444; }

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

/* ---- Topbar ---- */
.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.admin-topbar h1 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--blue-700); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-actions a {
  font-size: 0.82rem;
  color: var(--gray-500);
  display: flex; align-items: center; gap: 6px;
  transition: color var(--transition);
}
.topbar-actions a:hover { color: var(--blue-light); }

/* ---- Page Body ---- */
.admin-page { padding: 28px; flex: 1; }

/* ---- Stat Cards ---- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 22px 24px;
  border: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-card-icon.blue { background: var(--blue-faint); color: var(--blue-light); }
.stat-card-icon.green { background: #dcfce7; color: #16a34a; }
.stat-card-icon.orange { background: #fef3c7; color: #d97706; }
.stat-card-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-card-num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-card-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }

/* ---- Panels ---- */
.panel {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.panel-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--blue-700); }
.panel-body { padding: 24px; }

/* ---- Table ---- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.admin-table th {
  text-align: left;
  padding: 11px 16px;
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--gray-200);
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--blue-faint); }
.admin-table .thumb { width: 52px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--gray-200); }
.admin-table .thumb-placeholder { width: 52px; height: 40px; border-radius: 6px; background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.5); font-size: 0.8rem; }

/* ---- Badges ---- */
.badge-cat {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-building { background: var(--blue-faint); color: var(--blue-light); }
.badge-writing { background: #f3e8ff; color: #7c3aed; }
.badge-featured { background: #fef3c7; color: #b45309; }
.badge-unread { background: #fee2e2; color: #991b1b; }
.badge-read { background: #f1f5f9; color: var(--gray-500); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.84rem; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid transparent;
  line-height: 1;
}
.btn-primary { background: var(--blue-light); color: var(--white); border-color: var(--blue-light); }
.btn-primary:hover { background: var(--blue-700); border-color: var(--blue-700); }
.btn-outline { background: transparent; color: var(--blue-light); border-color: var(--blue-light); }
.btn-outline:hover { background: var(--blue-light); color: var(--white); }
.btn-danger { background: #dc2626; color: white; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; border-color: #16a34a; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--gray-900);
  background: var(--white);
  transition: all var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue-accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
textarea { resize: vertical; min-height: 100px; }
.checkbox-group { display: flex; align-items: center; gap: 10px; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue-light); cursor: pointer; }
.form-hint { font-size: 0.78rem; color: var(--gray-500); margin-top: 5px; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.88rem; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--blue-faint); color: var(--blue-700); border: 1px solid var(--blue-pale); }

/* ---- Upload Preview ---- */
.img-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.img-upload-area:hover { border-color: var(--blue-accent); background: var(--blue-faint); }
.img-upload-area i { font-size: 2.2rem; color: var(--gray-300); margin-bottom: 10px; }
.img-upload-area p { font-size: 0.87rem; color: var(--gray-500); }
.img-upload-area input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-preview { margin-top: 12px; }
.img-preview img { max-height: 180px; border-radius: 8px; object-fit: cover; margin: 0 auto; }

/* ---- Login ---- */
.login-body { background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%); display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
.login-card { background: var(--white); border-radius: 20px; padding: 48px; width: 100%; max-width: 420px; box-shadow: 0 32px 80px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 56px; margin: 0 auto 12px; }
.login-logo h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--blue-700); }
.login-logo p { font-size: 0.82rem; color: var(--gray-500); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}
