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

:root {
  --a-bg:        #f0f2f5;
  --a-sidebar:   #1a1a2e;
  --a-sidebar-h: #16213e;
  --a-accent:    #f5a623;
  --a-accent-dk: #d4891a;
  --a-white:     #ffffff;
  --a-text:      #2c3e50;
  --a-muted:     #7f8c8d;
  --a-border:    #e0e6ed;
  --a-success:   #2ecc71;
  --a-danger:    #e74c3c;
  --a-info:      #3498db;
  --a-shadow:    0 2px 12px rgba(0,0,0,0.07);
  --a-radius:    10px;
}

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

body { font-family: 'Inter', sans-serif; background: var(--a-bg); color: var(--a-text); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ===== LAYOUT ===== */
.admin-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.admin-sidebar {
  width: 240px;
  background: var(--a-sidebar);
  color: rgba(255,255,255,0.8);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 200;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: white;
  font-weight: 700;
  font-size: 1rem;
}
.sidebar-logo .s-icon { color: var(--a-accent); font-size: 1.4rem; }
.sidebar-logo strong  { color: var(--a-accent); }

.sidebar-sep {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 20px 20px 8px;
}

.sidebar-menu { list-style: none; padding: 4px 10px; }
.sidebar-menu li { margin-bottom: 2px; }
.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.sidebar-menu a:hover,
.sidebar-menu a.active { background: rgba(245,166,35,0.15); color: var(--a-accent); }
.sidebar-menu .s-nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-divider { border: none; border-top: 1px solid rgba(255,255,255,0.07); margin: 12px 16px; }

.sidebar-bottom {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.76rem;
  color: rgba(255,255,255,0.3);
}

/* ===== MAIN ===== */
.admin-main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; }

/* ===== TOPBAR ===== */
.admin-topbar {
  background: var(--a-white);
  border-bottom: 1px solid var(--a-border);
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--a-shadow);
}

.topbar-left h2 { font-size: 1rem; font-weight: 700; }
.topbar-left p  { font-size: 0.78rem; color: var(--a-muted); margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--a-bg);
  border-radius: 30px;
  padding: 5px 14px 5px 5px;
  font-size: 0.82rem;
  color: var(--a-muted);
}
.user-dot {
  width: 30px; height: 30px;
  background: var(--a-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--a-sidebar);
}

/* ===== CONTENT ===== */
.admin-content { padding: 28px; flex: 1; }

.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.content-header h2 { font-size: 1.3rem; font-weight: 700; }
.content-header p  { font-size: 0.84rem; color: var(--a-muted); margin-top: 3px; }

/* ===== STAT CARDS ===== */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--a-white);
  border-radius: var(--a-radius);
  padding: 20px 22px;
  box-shadow: var(--a-shadow);
  border-left: 4px solid var(--a-accent);
}
.stat-card.green { border-left-color: var(--a-success); }
.stat-card.blue  { border-left-color: var(--a-info); }
.stat-card.red   { border-left-color: var(--a-danger); }

.sc-value { font-size: 2.2rem; font-weight: 800; color: var(--a-text); line-height: 1; }
.sc-label { font-size: 0.8rem; color: var(--a-muted); margin-top: 4px; font-weight: 500; }

/* ===== CARD ===== */
.admin-card { background: var(--a-white); border-radius: var(--a-radius); box-shadow: var(--a-shadow); overflow: hidden; }
.admin-card-hd {
  padding: 16px 22px;
  border-bottom: 1px solid var(--a-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-card-hd h3 { font-size: 0.95rem; font-weight: 700; }

/* ===== TABLE ===== */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left;
  padding: 11px 18px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--a-muted);
  border-bottom: 1px solid var(--a-border);
  background: #fafbfc;
}
.admin-table td {
  padding: 13px 18px;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--a-border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #fafbfc; }

.td-title { font-weight: 600; color: var(--a-text); max-width: 260px; }
.td-sub   { font-size: 0.76rem; color: var(--a-muted); margin-top: 2px; }
.td-actions { display: flex; gap: 6px; flex-wrap: nowrap; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
}
.badge-published { background: rgba(46,204,113,0.15); color: #27ae60; }
.badge-draft     { background: rgba(127,140,141,0.12); color: #7f8c8d; }

/* ===== BUTTONS ===== */
.btn-a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-a-primary  { background: var(--a-accent); color: var(--a-sidebar); }
.btn-a-primary:hover  { background: var(--a-accent-dk); }
.btn-a-success  { background: var(--a-success); color: white; }
.btn-a-success:hover  { background: #27ae60; }
.btn-a-danger   { background: var(--a-danger); color: white; }
.btn-a-danger:hover   { background: #c0392b; }
.btn-a-outline  { background: transparent; border: 1.5px solid var(--a-border); color: var(--a-text); }
.btn-a-outline:hover  { border-color: var(--a-accent); color: var(--a-accent); }
.btn-a-ghost    { background: transparent; color: var(--a-muted); }
.btn-a-ghost:hover    { color: var(--a-danger); }
.btn-a-sm       { padding: 5px 11px; font-size: 0.76rem; }

/* ===== EDITOR FORM ===== */
.editor-grid { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }

.form-block { margin-bottom: 18px; }
.f-label { font-size: 0.82rem; font-weight: 600; color: var(--a-text); display: block; margin-bottom: 6px; }
.f-hint  { font-size: 0.75rem; color: var(--a-muted); margin-top: 4px; }

.f-input, .f-select, .f-textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--a-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--a-text);
  outline: none;
  transition: border-color 0.18s;
  background: white;
}
.f-input:focus, .f-select:focus, .f-textarea:focus {
  border-color: var(--a-accent);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.1);
}
.f-textarea { resize: vertical; min-height: 80px; }

/* Quill overrides */
#editor-content { border-radius: 0 0 6px 6px; font-size: 0.95rem; min-height: 360px; }
.ql-toolbar { border-radius: 6px 6px 0 0; border-color: var(--a-border) !important; background: #fafbfc; }
.ql-container { border-color: var(--a-border) !important; border-radius: 0 0 6px 6px; }

.editor-sidebar-card {
  background: var(--a-white);
  border-radius: var(--a-radius);
  box-shadow: var(--a-shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.editor-sidebar-card h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 14px; }

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--a-bg);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.toggle-row span { font-size: 0.88rem; font-weight: 600; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: 0.3s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.switch input:checked + .slider { background: var(--a-success); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Image preview */
.cover-preview {
  width: 100%;
  height: 140px;
  border-radius: 8px;
  border: 2px dashed var(--a-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--a-bg);
  margin-top: 8px;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: none; }
.cover-preview-text { font-size: 0.8rem; color: var(--a-muted); text-align: center; }

/* ===== TOAST ===== */
.a-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--a-sidebar);
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  border-left: 4px solid var(--a-accent);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.28s ease;
  z-index: 9999;
  max-width: 320px;
}
.a-toast.show { transform: translateY(0); opacity: 1; }
.a-toast.ok   { border-left-color: var(--a-success); }
.a-toast.err  { border-left-color: var(--a-danger); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--a-muted); }
.empty-state .es-icon { font-size: 3rem; margin-bottom: 14px; }
.empty-state h3 { font-size: 1.05rem; color: var(--a-text); margin-bottom: 8px; }
.empty-state p  { font-size: 0.85rem; margin-bottom: 20px; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--a-sidebar);
  background-image: radial-gradient(circle at 30% 40%, rgba(245,166,35,0.08) 0%, transparent 60%);
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 44px 40px 40px;
  width: 400px;
  max-width: 92vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-brand .lb-icon { font-size: 2.2rem; color: var(--a-accent); display: block; margin-bottom: 8px; }
.login-brand .lb-name { font-size: 1.25rem; font-weight: 800; }
.login-brand .lb-name strong { color: var(--a-accent); }
.login-brand .lb-sub { font-size: 0.84rem; color: var(--a-muted); margin-top: 4px; }

.login-error {
  background: rgba(231,76,60,0.08);
  border: 1px solid rgba(231,76,60,0.25);
  color: var(--a-danger);
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 0.84rem;
  margin-bottom: 16px;
  display: none;
}
.login-form .f-label { margin-bottom: 6px; display: block; font-size: 0.84rem; font-weight: 600; }
.login-form .f-input { width: 100%; padding: 12px 14px; margin-bottom: 14px; }
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--a-accent);
  color: var(--a-sidebar);
  border: none;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}
.login-btn:hover { background: var(--a-accent-dk); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.login-back { text-align: center; margin-top: 20px; font-size: 0.83rem; color: var(--a-muted); }
.login-back a { color: var(--a-accent); font-weight: 600; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-sidebar { width: 220px; transform: translateX(-100%); transition: transform 0.3s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}
