/* /admin/assets/admin.css — Cozzian Enterprises Blog Admin
   Matches the public site's dark-gradient brand (#667eea / #764ba2). */

:root {
  --primary: #667eea;
  --primary-dark: #5a6fd8;
  --secondary: #764ba2;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --dark: #1a1a2e;
  --dark-2: #22223a;
  --light: #f5f6fa;
  --white: #ffffff;
  --border: #e2e4ec;
  --text: #2b2d3e;
  --text-light: #8a8d9f;
  --success: #2ecc71;
  --success-bg: #eafaf1;
  --warning: #f5a623;
  --warning-bg: #fef7e8;
  --danger: #e74c3c;
  --danger-bg: #fdecea;
  --info: #667eea;
  --info-bg: #eef0fd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 8px 30px rgba(26, 26, 46, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--light);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 { margin: 0; color: var(--text); }

/* ---------- Layout ---------- */
.admin-container {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--dark);
  background-image: linear-gradient(180deg, var(--dark) 0%, var(--dark-2) 100%);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-header h1 {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.admin-sidebar-header p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-nav-section {
  margin: 18px 0 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav-item i {
  font-style: normal;
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-nav-item.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
}

.admin-user-info {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-user-name {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-user-role {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
  text-transform: capitalize;
  margin-bottom: 10px;
}

.admin-main {
  flex: 1;
  min-width: 0;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  padding: 22px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.admin-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
}

.admin-content {
  padding: 28px 32px 60px;
  max-width: 1200px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  text-decoration: none;
  line-height: 1.2;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
}
.btn-primary:hover { color: #fff; box-shadow: 0 6px 18px rgba(102, 126, 234, 0.45); }

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text); border-color: var(--primary); background: var(--info-bg); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { color: #fff; opacity: 0.9; }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: var(--light);
}

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  border-left: 4px solid var(--primary);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.info { border-left-color: var(--info); }

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 8px;
  color: var(--text);
}

.form-label.required::after {
  content: " *";
  color: var(--danger);
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 6px;
}

.char-counter {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
}
.char-counter.warning { color: var(--warning); }
.char-counter.danger { color: var(--danger); }

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ---------- Markdown editor ---------- */
.markdown-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.editor-panel:first-child {
  border-right: 1px solid var(--border);
}

.editor-header {
  padding: 12px 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: var(--light);
  border-bottom: 1px solid var(--border);
}

.editor-content {
  flex: 1;
  display: flex;
}

.editor-content textarea {
  flex: 1;
  border: none;
  border-radius: 0;
  resize: none;
  padding: 20px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.7;
}

.editor-content textarea:focus {
  box-shadow: none;
}

#preview-content {
  padding: 20px;
  overflow-y: auto;
  width: 100%;
}

#preview-content h1,
#preview-content h2,
#preview-content h3 {
  margin-top: 1.2em;
}

#preview-content p { margin: 0 0 1em; }

/* ---------- Table ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: var(--light);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--light); }

/* ---------- Alerts ---------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.alert-danger { background: var(--danger-bg); color: #a83226; }
.alert-success { background: var(--success-bg); color: #1e8449; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .admin-container { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: relative; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .markdown-editor { grid-template-columns: 1fr; }
  .editor-panel:first-child { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .admin-content { padding: 20px 16px 40px; }
}
