/* ====================================================================
   FastBunny Admin Dashboard — styles.css
   Dark-mode premium design
   ==================================================================== */

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

/* ── Reset & Tokens ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f14;
  --surface:   #151820;
  --surface2:  #1c202e;
  --border:    #262a3a;
  --accent:    #f97316;   /* FastBunny orange */
  --accent2:   #f59e0b;
  --blue:      #3b82f6;
  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #eab308;
  --purple:    #a855f7;
  --text:      #f1f5f9;
  --muted:     #64748b;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --transition: .22s cubic-bezier(.4,0,.2,1);
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { display: block; }

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Login Page ─────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 20%, rgba(249,115,22,.15) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(59,130,246,.1) 0%, transparent 50%),
              var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  animation: fadeUp .5s ease;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo .bunny-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo span { color: var(--accent); }
.login-logo p { font-size: 12px; color: var(--muted); }

.login-label { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; display: block; }
.login-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition);
  margin-bottom: 20px;
}
.login-input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px;
  transition: opacity var(--transition), transform var(--transition);
}
.login-btn:hover { opacity: .9; transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }

.login-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ── App Shell ──────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: 248px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo .bunny-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.sidebar-logo h2 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.sidebar-logo span { color: var(--accent); }
.sidebar-logo small { color: var(--muted); font-size: 11px; font-weight: 400; display: block; }

.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  border-radius: 0;
  color: var(--muted);
  font-size: 14px; font-weight: 500;
  transition: color var(--transition), background var(--transition);
  position: relative;
}
.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active {
  color: var(--accent);
  background: rgba(249,115,22,.1);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }
.nav-item .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid var(--border);
}
.logout-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; background: none; border: none; color: var(--muted);
  font-size: 14px; font-weight: 500; padding: 10px 0;
  transition: color var(--transition);
}
.logout-btn:hover { color: var(--red); }

/* ── Main Content ────────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: 248px;
  padding: 32px;
  min-height: 100vh;
}

/* ── Top Bar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
}
.topbar h1 { font-size: 26px; font-weight: 700; }
.topbar p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.admin-badge {
  background: rgba(249,115,22,.15);
  border: 1px solid rgba(249,115,22,.3);
  color: var(--accent);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Stat Cards ─────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.stat-card .icon-wrap {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat-card .trend { font-size: 12px; margin-top: 8px; }
.stat-card .trend.up { color: var(--green); }
.stat-card .trend.neutral { color: var(--muted); }

/* ── Section Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-header p { font-size: 13px; color: var(--muted); }
.card-body { padding: 24px; }

/* ── Table ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  white-space: nowrap;
}
td { padding: 14px 16px; border-bottom: 1px solid rgba(38,42,58,.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-pending  { background: rgba(234,179,8,.15);  color: var(--yellow); }
.badge-approved { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-rejected { background: rgba(239,68,68,.15);  color: var(--red); }
.badge-published{ background: rgba(59,130,246,.15); color: var(--blue); }
.badge-draft    { background: rgba(100,116,139,.15);color: var(--muted); }
.badge-active   { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-suspended{ background: rgba(239,68,68,.15);  color: var(--red); }
.badge-admin    { background: rgba(168,85,247,.15); color: var(--purple); }
.badge-author   { background: rgba(249,115,22,.15); color: var(--accent); }
.badge-reader   { background: rgba(59,130,246,.15); color: var(--blue); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; border: none;
  transition: opacity var(--transition), transform var(--transition);
}
.btn:hover { opacity: .85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red);   color: #fff; }
.btn-warning { background: var(--yellow);color: #000; }
.btn-ghost   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Avatar ─────────────────────────────────────────────────────────── */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ── User row ────────────────────────────────────────────────────────── */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell strong { display: block; font-weight: 600; }
.user-cell small { color: var(--muted); font-size: 12px; }

/* ── Document Preview ────────────────────────────────────────────────── */
.doc-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--blue); font-size: 13px; font-weight: 500;
}
.doc-link:hover { text-decoration: underline; }

/* ── Empty State ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── Finance Stat Row ────────────────────────────────────────────────── */
.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.finance-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.finance-item .fi-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.finance-item .fi-value { font-size: 22px; font-weight: 700; }
.finance-item .fi-value.green { color: var(--green); }
.finance-item .fi-value.orange { color: var(--accent); }
.finance-item .fi-value.blue  { color: var(--blue); }
.finance-item .fi-value.yellow{ color: var(--yellow); }

/* ── Loading spinner ─────────────────────────────────────────────────── */
.spinner {
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 28px; height: 28px;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ─────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px;
  min-width: 260px;
  box-shadow: var(--shadow);
  animation: fadeUp .3s ease;
  border-left: 4px solid var(--accent);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }

/* ── Animations ─────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar-logo h2, .sidebar-logo small, .nav-item span:not(.icon),
  .nav-section-label, .logout-btn span { display: none; }
  .sidebar-logo { justify-content: center; }
  .nav-item { justify-content: center; padding: 12px; }
  .main { margin-left: 64px; padding: 20px; }
}
