/* ==================== ADMIN STYLES ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: transparent;
  --bg2: rgba(0, 0, 0, 0.4);
  --surface: rgba(255, 255, 255, 0.03);
  --surface2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --border2: rgba(255, 255, 255, 0.15);
  --gold: #c9a84c;
  --gold2: #e8c97a;
  --text: #e8e6df;
  --text2: #a8a49c;
  --text3: #5e5b54;
  --red: #e05555;
  --green: #4caf7d;
  --blue: #4a9eff;
  --radius: 16px;
  --radius-sm: 8px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --sidebar-w: 240px;
}
html, body { height: 100%; }
body {
  background: #050505;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  cursor: default;
}
a { color: var(--gold); text-decoration: none; }
input, textarea, select, button { font-family: var(--font-body); font-size: 14px; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }

/* ==================== LOGIN SCREEN ==================== */
#login-screen {
  position: fixed; inset: 0;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-card {
  width: 100%; max-width: 400px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), inset 0 0 20px rgba(255,255,255,0.05);
}
.login-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.25rem;
}
.login-subtitle {
  text-align: center;
  color: var(--text3);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}
.login-card h2 { display: none; }
.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 0.5rem;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}
.form-group small { display: block; color: var(--text3); font-size: 0.76rem; margin-top: 0.35rem; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select option { background: var(--surface); }
.form-group.full { width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row .full { grid-column: 1 / -1; }
.btn-primary {
  background: var(--gold);
  color: #050505;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  letter-spacing: 0.03em;
}
.btn-primary:hover { background: var(--gold2); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border2);
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { color: var(--text); border-color: var(--border2); }
.login-card .btn-primary { width: 100%; padding: 0.8rem; }
#login-error {
  background: rgba(224,85,85,0.12);
  border: 1px solid rgba(224,85,85,0.3);
  color: var(--red);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 1rem;
  display: none;
}

/* ==================== ADMIN APP LAYOUT ==================== */
#admin-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w);
  background: rgba(10, 13, 20, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.admin-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.admin-brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  display: block;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-brand-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
}
.admin-nav { padding: 1rem 0.75rem; flex: 1; }
.admin-nav-section { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text3); padding: 0.5rem 0.5rem 0.4rem; margin-top: 1rem; }
.admin-nav-link {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.18s;
  cursor: pointer;
  margin-bottom: 0.15rem;
}
.admin-nav-link:hover { background: var(--surface2); color: var(--text); }
.admin-nav-link.active { background: rgba(201,168,76,0.1); color: var(--gold); }
.admin-nav-link .nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 1rem 0.75rem; border-top: 1px solid var(--border); }
#logout-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border2);
  color: var(--text3);
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
#logout-btn:hover { color: var(--red); border-color: var(--red); }

/* Main Content */
.admin-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 13, 20, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
}
.admin-topbar-title { font-size: 0.8rem; color: var(--text3); font-weight: 500; letter-spacing: 0.05em; }
.admin-topbar-actions { display: flex; gap: 0.75rem; align-items: center; }
#admin-content { padding: 1.75rem; flex: 1; }

/* ==================== SECTION HEADER ==================== */
.admin-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap; gap: 1rem;
}
.admin-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
  font-weight: 700;
}

/* ==================== STATS ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover { border-color: var(--gold); box-shadow: 0 0 15px rgba(212, 175, 55, 0.2); }
.stat-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.stat-label { font-size: 0.78rem; color: var(--text3); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.dashboard-actions { display: flex; gap: 0.75rem; margin-bottom: 2rem; flex-wrap: wrap; }

/* ==================== TABLES ==================== */
.recent-posts-table h3 {
  font-size: 1rem;
  color: var(--text2);
  margin-bottom: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
}
table { width: 100%; border-collapse: collapse; }
.posts-table { width: 100%; border-collapse: collapse; }
thead th {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text3);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
tbody td { padding: 0.75rem 0.9rem; vertical-align: middle; }
.td-title { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; font-size: 0.88rem; color: var(--text); }
.td-date { color: var(--text3); font-size: 0.8rem; white-space: nowrap; }
.td-actions { display: flex; gap: 0.4rem; align-items: center; white-space: nowrap; }
.btn-edit, .btn-delete {
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  font-size: 0.75rem;
  border: 1px solid;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-edit { background: rgba(74,158,255,0.1); border-color: rgba(74,158,255,0.3); color: var(--blue); }
.btn-edit:hover { background: var(--blue); color: var(--bg); }
.btn-delete { background: rgba(224,85,85,0.1); border-color: rgba(224,85,85,0.3); color: var(--red); }
.btn-delete:hover { background: var(--red); color: #fff; }
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge-cat { background: rgba(201,168,76,0.12); color: var(--gold); }
.badge-type.article { background: rgba(74,158,255,0.12); color: var(--blue); }
.badge-type.video { background: rgba(224,85,85,0.12); color: var(--red); }
.badge-type.gallery { background: rgba(76,175,125,0.12); color: var(--green); }
.status-dot {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; font-weight: 600;
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.published { color: var(--green); }
.status-dot.published::before { background: var(--green); }
.status-dot.draft { color: var(--text3); }
.status-dot.draft::before { background: var(--text3); }
.no-posts { color: var(--text3); text-align: center; padding: 2rem; }

/* ==================== FILTERS ==================== */
.posts-filter { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.posts-filter select {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text2);
  padding: 0.5rem 0.9rem;
  outline: none;
  cursor: pointer;
}
.posts-filter select:focus { border-color: var(--gold); }

/* ==================== POST FORM ==================== */
.post-form { max-width: 900px; }
.post-form .form-group { margin-bottom: 1.25rem; }
.post-form .form-group label { display: block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text3); margin-bottom: 0.5rem; }
.post-form input[type="text"], .post-form select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.post-form input:focus, .post-form select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.08); }
.post-form small { display: block; color: var(--text3); font-size: 0.76rem; margin-top: 0.35rem; }
#f-content {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--text);
  padding: 0.75rem;
  resize: vertical;
  outline: none;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  min-height: 260px;
}
#f-content:focus { border-color: var(--gold); }
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-toolbar button {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}
.editor-toolbar button:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.preview-toggle { margin-top: 0.5rem; }
.preview-toggle button {
  background: none; border: 1px solid var(--border2);
  color: var(--text3); padding: 0.35rem 0.9rem;
  border-radius: var(--radius-sm); font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s;
}
.preview-toggle button:hover { color: var(--gold); border-color: var(--gold); }
.content-preview {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text2);
  max-height: 400px;
  overflow-y: auto;
}
.content-preview h2, .content-preview h3 { color: var(--text); margin: 1.5rem 0 0.75rem; font-family: var(--font-display, serif); }
.content-preview p { margin-bottom: 1rem; }
.content-preview img { max-width: 100%; border-radius: 6px; margin: 1rem 0; }
.content-preview blockquote { border-left: 3px solid var(--gold); padding: 0.5rem 1rem; background: var(--bg2); margin: 1rem 0; }
.checkboxes { display: flex; gap: 2rem; align-items: center; margin-bottom: 1.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.88rem; color: var(--text2); }
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--gold); cursor: pointer; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }

/* ==================== CATEGORIES ==================== */
.add-cat-form { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.add-cat-form input {
  flex: 1; min-width: 200px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  outline: none;
}
.add-cat-form input:focus { border-color: var(--gold); }
.cat-list { display: flex; flex-direction: column; gap: 0.5rem; max-width: 600px; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  gap: 1rem;
}
.cat-info { display: flex; align-items: center; gap: 0.75rem; }
.cat-item-name { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.cat-item-slug { color: var(--text3); font-size: 0.8rem; font-family: monospace; }
.badge-default { background: rgba(74,158,255,0.1); color: var(--blue); font-size: 0.68rem; padding: 0.1rem 0.45rem; border-radius: 10px; font-weight: 600; letter-spacing: 0.05em; }
.cat-item-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.text-muted { color: var(--text3); font-size: 0.8rem; }
.cat-note { margin-top: 1.5rem; font-size: 0.82rem; color: var(--text3); padding: 0.75rem 1rem; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border); max-width: 600px; }

/* ==================== SETTINGS ==================== */
.settings-form { max-width: 600px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.settings-form h3 { font-size: 1rem; color: var(--text2); margin-bottom: 1.25rem; font-family: var(--font-body); font-weight: 600; }

/* ==================== TOAST ==================== */
.admin-toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  background: var(--green);
  color: #fff;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.admin-toast.show { transform: translateY(0); opacity: 1; }

/* ==================== MOBILE ==================== */
@media (max-width: 768px) {
  #admin-app { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; flex-direction: row; flex-shrink: 0; overflow-x: auto; overflow-y: hidden; }
  .admin-brand { display: none; }
  .admin-nav { display: flex; flex-direction: row; padding: 0.5rem; gap: 0.25rem; overflow-x: auto; white-space: nowrap; }
  .admin-nav-section { display: none; }
  .admin-nav-link { margin-bottom: 0; white-space: nowrap; }
  .sidebar-footer { display: flex; align-items: center; border-top: none; border-left: 1px solid var(--border); padding: 0.5rem; }
  #logout-btn { padding: 0.4rem 0.6rem; white-space: nowrap; }
  .admin-main { height: 0; flex: 1; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  table { font-size: 0.8rem; }
  td, th { padding: 0.5rem; }
  .td-title { max-width: 120px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  #admin-content { padding: 1rem; }
}
