/* =============================================
   SchoolMS Admin Dashboard — admin.css
   Theme: Light mode, matches school_web brand
   ============================================= */

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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #00b376;
  --primary-dark:  #008f5e;
  --primary-light: #e6f9f2;
  --accent:        #0F172A;
  --bg:            #f8fafc;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --text:          #0F172A;
  --text-muted:    #64748b;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --blue:          #3b82f6;
  --sidebar-w:     260px;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 14px; }

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

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
  flex-shrink: 0;
}

.brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.brand-sub  { font-size: 11px; color: rgba(255,255,255,0.45); }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.sidebar-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.admin-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0;
}

.admin-info { flex: 1; min-width: 0; }
.admin-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-role { font-size: 11px; color: rgba(255,255,255,0.45); }

.logout-btn {
  color: rgba(255,255,255,0.45);
  transition: color 0.2s;
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--danger); }
.logout-btn svg { width: 18px; height: 18px; }

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

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-heading { font-size: 20px; font-weight: 700; color: var(--text); }

.content-area { padding: 28px 32px; flex: 1; }

/* ---- Flash messages ---- */
.flash-success {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 500;
}

.flash-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 500;
}

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 32px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.blue   { background: #eff6ff; color: var(--blue); }
.stat-icon.green  { background: var(--primary-light); color: var(--primary); }
.stat-icon.orange { background: #fffbeb; color: var(--warning); }

.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ---- Section header ---- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 700; }
.btn-link { color: var(--primary); text-decoration: none; font-size: 13px; font-weight: 500; }
.btn-link:hover { text-decoration: underline; }

/* ---- Table Card ---- */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f1f5f9;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px; color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.row-unread { background: #fefce8 !important; }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 16px !important; font-size: 14px; }
.empty-state a { color: var(--primary); }

/* ---- Badges ---- */
.badge-published { background: var(--primary-light); color: var(--primary-dark); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-draft     { background: #f1f5f9; color: var(--text-muted); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-read      { background: #f1f5f9; color: var(--text-muted); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-unread    { background: #fef3c7; color: #92400e; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-count     { background: var(--primary-light); color: var(--primary-dark); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.demo-slot-badge { display: inline-flex; align-items: center; background: #f0fdf9; border: 1px solid #00b376; color: #047857; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; margin-bottom: 6px; }

/* ---- Actions ---- */
.actions-cell { white-space: nowrap; }
.btn-edit   { background: #eff6ff; color: var(--blue); border: none; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; margin-right: 6px; display: inline-block; }
.btn-edit:hover { background: #dbeafe; }
.btn-delete { background: #fef2f2; color: var(--danger); border: none; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-delete:hover { background: #fee2e2; }

/* ---- Buttons ---- */
.btn-primary-sm {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.2s;
}
.btn-primary-sm:hover { background: var(--primary-dark); }

.btn-cancel {
  background: #f1f5f9; color: var(--text-muted);
  border: none; padding: 10px 20px;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-cancel:hover { background: var(--border); }

/* ---- Forms ---- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.hint { color: var(--text-muted); font-weight: 400; font-size: 11px; }

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,179,118,0.1); }

.form-group input[type="file"] {
  padding: 8px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  width: 100%;
  font-size: 13px;
  cursor: pointer;
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-actions { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

.current-image { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.current-image img { width: 60px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ---- SEO Section ---- */
.seo-section {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.seo-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 18px;
}
.seo-header svg { width: 16px; height: 16px; color: var(--primary); }

/* ---- Settings Section ---- */
.settings-section { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.settings-section:last-of-type { border-bottom: none; }
.settings-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; margin-bottom: 18px; color: var(--text);
}
.settings-section-title svg { width: 16px; height: 16px; color: var(--primary); }

/* ---- Blog table ---- */
.blog-title-cell { display: flex; align-items: center; gap: 10px; }
.table-thumb { width: 44px; height: 30px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.msg-cell { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: #475569; }

/* ---- Login ---- */
.login-body { background: linear-gradient(135deg, #0F172A 0%, #1e293b 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrapper { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: #fff; border-radius: 20px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo { width: 60px; height: 60px; background: var(--primary); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: #fff; margin: 0 auto 14px; }
.login-brand h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-brand p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
.btn-login { width: 100%; background: var(--primary); color: #fff; border: none; padding: 13px; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background 0.2s; margin-top: 8px; }
.btn-login:hover { background: var(--primary-dark); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .content-area { padding: 20px 16px; }
  .top-bar { padding: 16px; }
}
