/* Whitebox Admin — self-contained styles, no framework dependency */

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

:root {
  --sidebar-width: 220px;
  --sidebar-bg: #1e2a38;
  --sidebar-text: #c8d6e5;
  --sidebar-active: #ffffff;
  --sidebar-hover: #2d3f54;
  --accent: #4a90d9;
  --body-bg: #f5f7fa;
  --body-text: #212529;
  --border: #dee2e6;
  --radius: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--body-text);
  background: var(--body-bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────── */

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--sidebar-active);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar ul {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}

.sidebar ul li a {
  display: block;
  padding: 0.55rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.15s;
  font-size: 0.9rem;
}

.sidebar ul li a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
}

.sidebar ul li a.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.82rem;
  color: var(--sidebar-text);
}

.sidebar-footer a { color: var(--sidebar-text); }

.main-content {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  max-width: 1100px;
}

/* ── Page header ─────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

/* ── Flash messages ──────────────────────────────────────────────────── */

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Tables ──────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

thead th {
  background: #f0f3f6;
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── Buttons ─────────────────────────────────────────────────────────── */

button, .btn, input[type="submit"] {
  display: inline-block;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
  font-family: var(--font);
  line-height: 1.5;
}

.btn-primary, input[type="submit"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover, input[type="submit"]:hover { opacity: 0.88; color: #fff; text-decoration: none; }

.btn-secondary {
  background: #6c757d;
  color: #fff;
  border-color: #6c757d;
}

.btn-secondary:hover { opacity: 0.88; color: #fff; text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover { background: var(--accent); color: #fff; text-decoration: none; }

.btn-danger {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

.btn-danger:hover { opacity: 0.88; color: #fff; text-decoration: none; }

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* ── Forms ───────────────────────────────────────────────────────────── */

.form-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  max-width: 600px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: #495057;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  display: block;
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--body-text);
  font-family: var(--font);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-check label { margin: 0; font-size: 0.9rem; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.form-errors {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ── Badges ──────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.2em 0.55em;
  border-radius: 3px;
  font-size: 0.77rem;
  font-weight: 600;
}

.badge-success  { background: #28a745; color: #fff; }
.badge-secondary { background: #6c757d; color: #fff; }
.badge-warning  { background: #ffc107; color: #212529; }

/* ── Filter form ─────────────────────────────────────────────────────── */

.filter-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filter-form .form-group { margin-bottom: 0; }

/* ── Dashboard stats ─────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* ── Login page ──────────────────────────────────────────────────────── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--body-bg);
}

.login-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  text-align: center;
}

.login-card h2 { margin: 0 0 1.5rem; font-size: 1.4rem; }

/* ── Utility ─────────────────────────────────────────────────────────── */

.text-muted { color: #6c757d; font-size: 0.88rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.gap-1 { gap: 0.5rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Cron help tooltip ───────────────────────────────────────────────── */

.cron-help-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: default;
  margin-left: 0.35rem;
  vertical-align: middle;
  user-select: none;
}

.cron-help-box {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--body-text);
  white-space: nowrap;
  z-index: 100;
  line-height: 1.7;
}

.cron-help-box code {
  background: #f0f3f6;
  border-radius: 3px;
  padding: 0.05em 0.3em;
  font-family: monospace;
  font-size: 0.9em;
}

.cron-help-trigger:hover .cron-help-box {
  display: block;
}
