/* Admin UI Styles */
.admin-shell {
  display: flex;
  min-height: 100vh;
  background: #F8FAFC;
  color: #0F172A;
}

.admin-sidebar {
  width: 270px;
  background: #FFFFFF;
  border-right: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.admin-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #F1F5F9;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 1.5rem;
  flex: 1;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #334155;
  transition: background-color 0.15s, color 0.15s;
}
.admin-nav-link:hover {
  background: rgba(12, 122, 197, 0.1);
  color: #0C7AC5;
}
.admin-nav-link.active {
  background: #0C7AC5;
  color: #FFFFFF;
}
.admin-nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.admin-badge {
  background: #DC2626;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
}
.admin-nav-link.active .admin-badge {
  background: #FFFFFF;
  color: #0C7AC5;
}

.admin-sidebar-footer {
  border-top: 1px solid #F1F5F9;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.admin-topbar {
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-content {
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
}

.admin-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.admin-page-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.admin-stat-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.admin-stat-label { font-size: 0.85rem; color: #64748B; font-weight: 500; }
.admin-stat-value { font-size: 2rem; font-weight: 700; color: #0F172A; }
.admin-stat-sub { font-size: 0.8rem; color: #0C7AC5; }

.admin-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.admin-input, .admin-select, .admin-textarea {
  width: 100%;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: #FFFFFF;
  color: #0F172A;
}
.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  outline: none;
  border-color: #0C7AC5;
}
.admin-textarea { min-height: 110px; resize: vertical; }

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  background: #FFFFFF;
  color: #0F172A;
  transition: all 0.15s;
}
.admin-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.admin-btn-primary { background: #0C7AC5; color: #FFFFFF; }
.admin-btn-primary:hover { background: #0b629c; }
.admin-btn-secondary { border-color: #CBD5E1; background: #FFFFFF; color: #334155; }
.admin-btn-secondary:hover { background: #F1F5F9; }
.admin-btn-danger { background: #FEE2E2; color: #B91C1C; }
.admin-btn-danger:hover { background: #FECACA; }
.admin-btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }

.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.admin-table th {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748B;
  border-bottom: 1px solid #E5E7EB;
  background: #F8FAFC;
}
.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.92rem;
  vertical-align: middle;
}
.admin-table tr:hover td { background: #F8FAFC; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-published { background: #DCFCE7; color: #166534; }
.status-draft { background: #F1F5F9; color: #475569; }
.status-scheduled { background: #DBEAFE; color: #1E40AF; }
.status-danger { background: #FEE2E2; color: #991B1B; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.form-col-full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label { font-size: 0.85rem; font-weight: 600; color: #334155; }

/* Rich Editor */
.editor-shell {
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  overflow: hidden;
  background: #FFFFFF;
}
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
}
.editor-tool-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.editor-tool-btn:hover { background: #E2E8F0; }
.editor-tool-btn.active { background: #0C7AC5; color: #FFFFFF; border-color: #0C7AC5; }
.editor-surface {
  min-height: 360px;
  padding: 1.25rem;
  outline: none;
  font-size: 1rem;
  line-height: 1.65;
}
.editor-surface h2, .editor-surface h3 { margin: 1rem 0 0.5rem; }
.editor-surface img { max-width: 100%; border-radius: 8px; }
.editor-source {
  width: 100%;
  min-height: 360px;
  border: none;
  padding: 1rem;
  font-family: Consolas, monospace;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
}

.tabs-row {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 1.5rem;
}
.tab-btn {
  padding: 0.7rem 1.25rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: #64748B;
  cursor: pointer;
}
.tab-btn.active {
  color: #0C7AC5;
  border-bottom-color: #0C7AC5;
}

.messages-split {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.message-list-item {
  padding: 1rem;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.message-list-item:hover { background: #F8FAFC; }
.message-list-item.selected { background: rgba(12, 122, 197, 0.08); border-left: 3px solid #0C7AC5; }
.message-list-item.unread strong { color: #0C7AC5; }

.admin-mobile-toggle { display: none; }

@media (max-width: 1024px) {
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid-2, .messages-split, .form-grid { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-mobile-toggle { display: inline-flex; }
}
@media (max-width: 640px) {
  .admin-stats-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 1.25rem; }
}
