/* ============================================
   BUL ADMIN PANEL — Premium Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #0f1117;
  --bg-surface: #181c27;
  --bg-card: #1e2235;
  --bg-hover: #252b40;
  --accent: #e91e8c;
  --accent-light: #ff4db0;
  --accent-glow: rgba(233, 30, 140, .18);
  --text-primary: #f0f2f8;
  --text-secondary: #94a3b8;
  --text-muted: #5a6482;
  --border: #2a3050;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
  --header-h: 64px;
  --transition: .2s ease;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

/* ---- LAYOUT ---- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent), #b91c7a);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
  letter-spacing: .3px;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 8px 24px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-link.active {
  color: var(--accent-light);
  background: var(--accent-glow);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  width: 100%;
}

.btn-logout:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOP BAR ---- */
.topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}

.topbar-title span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 14px;
  margin-left: 8px;
}

/* ---- PAGE BODY ---- */
.page-body {
  padding: 32px;
  flex: 1;
}

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.stat-icon {
  width: 52px;
  height: 52px;
  background: var(--accent-glow);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent-light);
  flex-shrink: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #b91c7a);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.2);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(1.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  justify-content: center;
}

/* ---- TABLE ---- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody td {
  padding: 12px 16px;
  vertical-align: middle;
}

.td-img {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

.actions {
  display: flex;
  gap: 8px;
}

/* ---- BADGE ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: rgba(34, 197, 94, .15);
  color: var(--success);
}

.badge-muted {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.badge-accent {
  background: var(--accent-glow);
  color: var(--accent-light);
}

/* ---- FORMS ---- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control option {
  background: var(--bg-card);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* ---- QUILL EDITOR ---- */
#editor-container {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  min-height: 320px;
  color: var(--text-primary);
}

.ql-toolbar {
  background: var(--bg-hover);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
}

.ql-toolbar .ql-stroke {
  stroke: var(--text-secondary) !important;
}

.ql-toolbar .ql-fill {
  fill: var(--text-secondary) !important;
}

.ql-toolbar button:hover .ql-stroke {
  stroke: var(--accent-light) !important;
}

.ql-toolbar button:hover .ql-fill {
  fill: var(--accent-light) !important;
}

.ql-toolbar .ql-picker-label {
  color: var(--text-secondary) !important;
}

.ql-container {
  font-family: 'Inter', sans-serif !important;
  font-size: 15px !important;
}

/* ---- IMAGE GRID ---- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.image-card {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  group: true;
  transition: border-color var(--transition);
}

.image-card:hover {
  border-color: var(--accent);
}

.image-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.image-card-info {
  padding: 8px 10px;
}

.image-card-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

/* ---- UPLOAD ZONE ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-zone i {
  font-size: 36px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: block;
}

.upload-zone p {
  color: var(--text-muted);
  font-size: 14px;
}

.upload-zone strong {
  color: var(--text-secondary);
}

#file-input {
  display: none;
}

/* ---- PAGE EDITOR SECTIONS ---- */
.page-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.page-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.page-section-title {
  font-size: 15px;
  font-weight: 600;
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(233, 30, 140, .12) 0%, transparent 60%);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), #b91c7a);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 0 24px var(--accent-glow);
}

.login-logo-text h2 {
  font-size: 22px;
  font-weight: 700;
}

.login-logo-text p {
  font-size: 13px;
  color: var(--text-muted);
}

.login-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* Password toggle */
.pass-wrap {
  position: relative;
}

.pass-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
}

.login-error {
  background: rgba(239, 68, 68, .15);
  border: 1px solid rgba(239, 68, 68, .4);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-error.show {
  display: block;
}

/* ---- TOOLBAR ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar-gap {
  flex: 1;
}

/* ---- ALERTS ---- */
.alert {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert.show {
  display: block;
}

.alert-success {
  background: rgba(34, 197, 94, .12);
  border: 1px solid rgba(34, 197, 94, .3);
  color: #86efac;
}

.alert-danger {
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .3);
  color: #fca5a5;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  opacity: .4;
}

.empty-state p {
  font-size: 15px;
}

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}

.modal-box h3 {
  margin-bottom: 8px;
}

.modal-box p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- MISC ---- */
.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-8 {
  margin-top: 32px;
}

.mb-4 {
  margin-bottom: 16px;
}

.gap-12 {
  gap: 12px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.fw-600 {
  font-weight: 600;
}

a {
  color: inherit;
}

/* ---- RESPONSIVE (hide sidebar on mobile) ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: none;
  }

  .main-content {
    margin-left: 0;
  }

  .page-body {
    padding: 20px 16px;
  }

  .topbar {
    padding: 0 16px;
  }
}

/* ---- BLOG EDITOR ---- */
.cover-preview {
  max-width: 320px;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
  display: none;
}

.cover-preview.show {
  display: block;
}

.editor-columns {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

@media (max-width: 900px) {
  .editor-columns {
    grid-template-columns: 1fr;
  }
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.settings-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 14px;
}

.status-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border-radius: 99px;
  cursor: pointer;
  transition: .3s;
  border: 1px solid var(--border);
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: .3s;
}

input:checked+.toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

input:checked+.toggle-slider:before {
  transform: translateX(20px);
  background: #fff;
}

.cover-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.cover-tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all .2s;
}

.cover-tab.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-light);
}

.publish-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.preview-link-full {
  width: 100%;
  justify-content: center;
}

/* Gallery thumb grid */
.gallery-thumbs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 8px;
}

.gallery-thumb {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: .2s;
}

/* FAQeditor items */
.faq-editor-item {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.faq-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.faq-editor-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Shared small utilities */
.text-muted-sm {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-copy {
  font-size: 11px;
  padding: 4px 8px;
}

.sidebar-user-icon {
  margin-right: 6px;
}

/* Notice banner (shared across site pages) */
.site-notice {
  background: linear-gradient(90deg, #e91e8c, #b91c7a);
  color: #fff;
  text-align: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  display: none;
}

.site-notice.show {
  display: block;
}