/* ============================================================
   AI Blog Publisher - Premium Admin Theme
   Inspired by Preskool Dashboard Template
   Built with industry-standard design patterns
   ============================================================ */

/* ==================== GOOGLE FONTS ==================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Container Utilities */
.container-fluid { width: 100%; padding: 0; }

/* ==================== CSS VARIABLES ==================== */
:root {
  --primary:       #f08624;
  --primary-dark:  #d97214;
  --primary-light: rgba(240,134,36,0.12);
  --secondary:     #6FCCD8;
  --success:       #1ABE17;
  --success-light: rgba(26,190,23,0.12);
  --info:          #0F65CD;
  --info-light:    rgba(15,101,205,0.12);
  --warning:       #EAB300;
  --warning-light: rgba(234,179,0,0.12);
  --danger:        #E82646;
  --danger-light:  rgba(232,38,70,0.12);

  --bg:            #F4F6FA;
  --bg-card:       #FFFFFF;
  --sidebar-bg:    #FFFFFF;
  --sidebar-width: 260px;

  --text:          #202C4B;
  --text-muted:    #6A7287;
  --text-light:    #A0A8C0;
  --heading:       #202C4B;
  --border:        #E9EDF4;
  --border-dark:   #D4DAE8;

  --header-height: 65px;
  --shadow-sm:     0 1px 4px rgba(32,44,75,0.08);
  --shadow-md:     0 4px 16px rgba(32,44,75,0.12);
  --shadow-lg:     0 8px 32px rgba(32,44,75,0.16);
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;

  --transition:    all 0.25s ease;
}

/* ==================== BASE RESET ==================== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}
html {
    overflow-y: scroll;
}
body {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    background-color: var(--bg);
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

ul { list-style: none; padding: 0; margin: 0; }

h1,h2,h3,h4,h5,h6 { color: var(--heading); font-weight: 600; line-height: 1.4; margin: 0; }


/* ==================== CIRCULAR CLASSIC LOADER ==================== */
#page-loader-spinner {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(244, 246, 250, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease;
  opacity: 0;
}

[data-theme="dark"] #page-loader-spinner {
  background: rgba(15, 23, 42, 0.5);
}

#page-loader-spinner.is-loading {
  display: flex;
  opacity: 1;
}

.spinner-circular {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-dark);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin-loader 0.8s linear infinite;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@keyframes spin-loader {
  to { transform: rotate(360deg); }
}

/* ==================== LAYOUT ==================== */
.main-wrapper { display: flex; width: 100%; min-height: 100vh; }

/* ==================== HEADER ==================== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 1.5rem 0 0;
  z-index: 1040;
  gap: 0;
}

.header-left {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-right: 1px solid var(--border);
  height: 100%;
  flex-shrink: 0;
}

.header-left .logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.header-left .logo i {
  font-size: 1.6rem;
  color: var(--primary);
  flex-shrink: 0;
}

.header-left .logo span {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
  white-space: nowrap;
}

.header-left .logo-small { display: none; }

/* Toggle Button */
#toggle_btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  margin-left: 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
  flex-shrink: 0;
  text-decoration: none;
}
#toggle_btn:hover { background: var(--bg); color: var(--primary); }

/* Header Right / Topbar Actions */
.header .topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  transition: width 0.3s ease, transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-inner { padding: 1.25rem 0 2rem; }

.sidebar-menu { padding: 0; }

.menu-title {
  padding: 0.5rem 1.5rem;
  margin-bottom: 0.25rem;
}
.menu-title span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
}

.sidebar-menu > ul > li { position: relative; }

.sidebar-menu > ul > li > a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-menu > ul > li > a i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
  transition: var(--transition);
}

.sidebar-menu > ul > li > a span {
  flex: 1;
  transition: var(--transition);
}

.sidebar-menu > ul > li > a:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
}

.sidebar-menu > ul > li > a:hover i { opacity: 1; }

.sidebar-menu > ul > li.active > a {
  color: var(--primary);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-menu > ul > li.active > a i { opacity: 1; }

/* Sidebar Dropdown/Submenu Styling */
.sidebar-menu .submenu-item > a {
  cursor: pointer;
}
.sidebar-menu .submenu-item .dropdown-arrow {
  font-size: 0.75rem;
  transition: transform 0.25s ease;
  opacity: 0.7;
}
.sidebar-menu .submenu-item.open .dropdown-arrow {
  transform: rotate(180deg);
}

.sidebar-menu .submenu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.015);
  border-left: 1px solid var(--border);
  margin-left: 1.5rem;
}
[data-theme="dark"] .sidebar-menu .submenu-list {
  background: rgba(255, 255, 255, 0.01);
}

.sidebar-menu .submenu-list li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  border-radius: 6px;
  margin: 2px 8px;
}

.sidebar-menu .submenu-list li a i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  opacity: 0.7;
  transition: var(--transition);
}

.sidebar-menu .submenu-list li a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.sidebar-menu .submenu-list li.active a {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.sidebar-menu .submenu-list li.active a i {
  opacity: 1;
}

/* Adjust mini-sidebar behavior for submenus */
body.mini-sidebar .sidebar-menu .submenu-list {
  display: none !important; /* Hide expanded submenus in mini-sidebar mode */
}
body.mini-sidebar .sidebar-menu .submenu-item.open .dropdown-arrow {
  transform: none;
}

/* ==================== PAGE WRAPPER ==================== */
.page-wrapper {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: margin-left 0.3s ease;
}

.content {
  padding: 1.75rem;
  flex: 1;
}

/* ==================== PAGE HEADER ==================== */
.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}

.page-header .row { margin: 0; align-items: center; }

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.3rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin: 0;
}
.breadcrumb-item { display: flex; align-items: center; gap: 0.35rem; }
.breadcrumb-item:not(:last-child)::after { content: '/'; color: var(--text-light); }
.breadcrumb-item a { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-muted); }

/* ==================== FOOTER ==================== */
footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  text-align: center;
}
footer p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  transition: var(--transition);
  overflow: hidden;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-body { padding: 1.5rem; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.card-header .card-title,
.card-header h4,
.card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--heading);
  margin: 0;
}

.card-chart .card-body { padding: 1rem 1.5rem 1.5rem; }

.card > form.card-form,
.card > .card-form {
  padding: 1.5rem 1.75rem;
}

.card-form-narrow {
  max-width: 820px;
}

.card-header + .table-responsive {
  padding: 0 1.5rem 1.25rem;
}

.card > .table-responsive {
  padding: 0 1.5rem 1.25rem;
}

.card > .table {
  margin-left: 1.5rem;
  margin-right: 1.5rem;
  margin-bottom: 1.25rem;
  width: calc(100% - 3rem);
}

.card > form:not(.card-form) {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.card > form:not(.card-form):first-of-type {
  padding-top: 1rem;
}

.card > form:not(.card-form):last-of-type {
  padding-bottom: 1.25rem;
}

.card > .empty-state,
.card > p.empty-state {
  padding: 2rem 1.5rem;
}

/* Colored cards */
.card.bg-primary  { background: var(--primary) !important; border-color: var(--primary-dark); }
.card.bg-success  { background: var(--success) !important; border-color: #16a614; }
.card.bg-info     { background: var(--info) !important;    border-color: #0d56b0; }
.card.bg-warning  { background: var(--warning) !important; border-color: #c99c00; }

/* ==================== DASHBOARD WIDGETS ==================== */
.dash-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.dash-widget-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.dash-widget-icon.bg-white { background: rgba(255,255,255,0.9) !important; box-shadow: var(--shadow-sm); }

.dash-count h3 {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.dash-widget-info h6 {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9) !important;
  margin: 0;
}

/* ==================== TABLES ==================== */
.table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  color: var(--text);
}

.table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.9rem 1rem;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

.table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  text-align: left;
}

.table thead th:last-child,
.table tbody td:last-child {
  text-align: left;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover td { background: var(--primary-light); }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table-sm thead th, .table-sm tbody td { padding: 0.6rem 0.85rem; }

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Bootstrap 5 compatible */
.bg-success { background-color: var(--success) !important; }
.bg-danger  { background-color: var(--danger) !important; }
.bg-warning { background-color: var(--warning) !important; }
.bg-info    { background-color: var(--info) !important; }
.bg-primary { background-color: var(--primary) !important; }

/* Legacy badge classes */
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-agent   { background: rgba(240,134,36,0.15); color: var(--primary); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.855rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff !important; }

.btn-secondary {
  background: #6A7287;
  color: #fff !important;
  border-color: #6A7287;
}
.btn-secondary:hover { background: #5a6275; color: #fff !important; }

.btn-success {
  background: var(--success);
  color: #fff !important;
  border-color: var(--success);
}
.btn-success:hover { background: #16a614; color: #fff !important; }

.btn-danger {
  background: var(--danger);
  color: #fff !important;
  border-color: var(--danger);
}
.btn-danger:hover { background: #c91f3c; color: #fff !important; }

.btn-warning {
  background: var(--warning);
  color: #fff !important;
  border-color: var(--warning);
}

.btn-info {
  background: var(--info);
  color: #fff !important;
  border-color: var(--info);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-dark);
  color: var(--text) !important;
}
.btn-outline:hover { background: var(--bg); color: var(--primary) !important; }

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.7rem 1.75rem;
  font-size: 0.95rem;
}

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.form-control,
.form-select,
textarea.form-control {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

/* Dropdown arrow for select elements */
.form-select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%236A7287' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 16px;
  cursor: pointer;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(240,134,36,0.15);
}

.form-control-sm, .form-select-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.form-check-label { font-size: 0.875rem; color: var(--text); }
.form-check-input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

.input-group-cron { display: flex; gap: 0.75rem; }
.input-group-cron .form-control { flex: 1; }

/* Password wrap */
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 3rem; }
.password-toggle {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 3rem; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s;
  z-index: 5;
  -webkit-appearance: none;
  appearance: none;
}
.password-toggle:hover { color: var(--primary); }
.password-toggle:focus { outline: none; color: var(--primary); }

/* ==================== ROW / GRID ==================== */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.75rem;
}

.row > [class*="col-"] {
  padding: 0 0.75rem;
  margin-bottom: 1.5rem;
}

.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6  { flex: 0 0 50%; max-width: 50%; }
.col-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-3  { flex: 0 0 25%; max-width: 25%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-lg-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-lg-6 { flex: 0 0 50%; max-width: 50%; }
.col-lg-8 { flex: 0 0 66.6667%; max-width: 66.6667%; }
.col-lg-12 { flex: 0 0 100%; max-width: 100%; }
.col-xl-3 { flex: 0 0 25%; max-width: 25%; }
.col-sm-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }
.col { flex: 1; }

.d-flex { display: flex !important; }
.flex-fill { flex: 1 1 auto !important; }
.flex-column { flex-direction: column !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.justify-content-end { justify-content: flex-end !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.ms-auto { margin-left: auto !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-3 { margin-left: 1rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.p-0 { padding: 0 !important; }
.pt-3 { padding-top: 1rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.w-100 { width: 100% !important; }
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }
.text-muted { color: var(--text-muted) !important; }
.text-white { color: #fff !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-info    { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }
.small { font-size: 0.8rem !important; }
.fw-bold { font-weight: 700 !important; }
.fw-600 { font-weight: 600 !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.border { border: 1px solid var(--border) !important; }
.border-top { border-top: 1px solid var(--border) !important; }
.border-bottom { border-bottom: 1px solid var(--border) !important; }
.d-none { display: none !important; }

/* ==================== TOPBAR ACTIONS ==================== */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  padding: 0 1rem;
}

/* Clock */
.header-clock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text);
}
.header-clock i { color: var(--primary); font-size: 1rem; }
.header-clock-text { display: flex; flex-direction: column; line-height: 1.2; }
.header-clock-text #clock-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.header-clock-text small { color: var(--text-muted); font-size: 0.68rem; }

/* Theme Toggle */
.theme-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-muted); font-size: 1rem;
  transition: var(--transition);
}
.theme-toggle:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* Profile Menu */
.profile-menu { position: relative; }

.profile-trigger {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.35rem 0.75rem;
  color: var(--text); cursor: pointer; transition: var(--transition);
}
.profile-trigger:hover { background: var(--primary-light); border-color: var(--primary); }
.profile-avatar { font-size: 1.3rem; color: var(--primary); }
.profile-name { font-size: 0.85rem; font-weight: 500; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.profile-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 200px;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: all 0.25s ease; z-index: 200;
}
.profile-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-dropdown a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1.1rem; color: var(--text); font-size: 0.875rem;
  transition: var(--transition);
}
.profile-dropdown a:hover { background: var(--primary-light); color: var(--primary); }
.profile-dropdown a.text-danger { color: var(--danger) !important; }
.profile-dropdown a.text-danger:hover { background: var(--danger-light); color: var(--danger) !important; }
.profile-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 0.25rem 0; }

/* ==================== ALERTS / FLASH ==================== */
.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.alert-message { flex: 1; }
.alert-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.1rem; padding: 0; line-height: 1; color: inherit; opacity: 0.7;
  transition: opacity 0.2s;
}
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-light); border-color: var(--success); color: var(--success); }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: var(--info); }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #8a6900; }

/* ==================== MEDIA GRID ==================== */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
}

.media-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.media-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.media-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.media-item .meta {
  padding: 0.75rem;
  font-size: 0.8rem;
}
.media-item .meta strong {
  display: block;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.5rem;
}
.media-item .meta .btn { margin-top: 0.3rem; }

/* ==================== AGENT ICON ==================== */
.agent-icon {
  display: inline-flex;
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  align-items: center; justify-content: center;
  font-size: 9px; color: #fff; font-weight: 700;
  margin-right: 0.35rem;
  vertical-align: middle;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==================== CRON TUTORIAL ==================== */
.cron-tutorial .card-body { padding: 1.5rem; }
.cron-tutorial p { color: var(--text-muted); margin-bottom: 1rem; }
.cron-code, .cron-tutorial pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: var(--text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.cron-steps h6 { font-size: 0.9rem; font-weight: 600; color: var(--heading); margin: 1.25rem 0 0.5rem; }
.cron-steps ol, .cron-steps ul { padding-left: 1.25rem; }
.cron-steps li { margin-bottom: 0.35rem; color: var(--text-muted); font-size: 0.875rem; list-style: decimal; }
.cron-steps ul li { list-style: disc; }
.cron-steps code {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--primary);
}

/* ==================== SCHEDULE FIELDS ==================== */
.schedule-fields { display: none; }
.schedule-fields.active { display: block; }

.seo-keyword-count-wrap.is-hidden { display: none; }

/* Blog hero image grid (compact, max ~200px tall) */
.aiblog-hero-grid {
  display: grid;
  gap: 6px;
  max-height: 200px;
  margin: 0 0 1.25rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
}
.aiblog-hero-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}
.aiblog-hero-grid--layout-1 {
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.aiblog-hero-grid--layout-1 .aiblog-hero-grid__cell--1 {
  grid-row: 1 / span 2;
}
.aiblog-hero-grid--layout-2 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}
.aiblog-hero-grid--layout-2 .aiblog-hero-grid__cell--1 {
  grid-column: 1 / span 2;
  max-height: 90px;
}
.aiblog-hero-grid--layout-3 {
  grid-template-columns: 1fr 0.8fr;
  grid-template-rows: 1fr 1fr;
}
.aiblog-hero-grid--layout-3 .aiblog-hero-grid__cell--1 {
  grid-column: 1 / span 2;
  max-height: 85px;
}

.aiblog-faq {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.aiblog-faq h2 { margin-bottom: 1rem; font-size: 1.15rem; }
.aiblog-faq h3 { font-size: 1rem; margin: 1rem 0 0.35rem; color: var(--heading); }
.aiblog-faq p { margin-bottom: 0.75rem; color: var(--text-muted); }

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  align-items: center; justify-content: center;
  padding: 1rem 1.5rem;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem; color: var(--text);
  text-decoration: none; transition: var(--transition);
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination span.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* ==================== MODAL (Agent Modal) ==================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(32,44,75,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; opacity: 0; visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 95%; max-width: 540px; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.animate-modal { animation: modalIn 0.3s ease; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h5 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 1.4rem;
  color: var(--text-muted); cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.25rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 0.5rem; padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.agent-progress-bar {
  height: 5px; background: var(--border);
  border-radius: 4px; overflow: hidden; margin-bottom: 1rem;
}
.agent-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0; transition: width 0.4s ease;
}
.agent-steps-list { max-height: 240px; overflow-y: auto; }
.agent-steps-list li {
  display: flex; gap: 0.5rem; align-items: flex-start;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.875rem; animation: fadeInUp 0.3s ease;
}
.agent-steps-list li:last-child { border-bottom: none; }
.step-time { color: var(--text-muted); font-size: 0.72rem; min-width: 52px; margin-top: 2px; }
.step-success { color: var(--success); }
.step-error   { color: var(--danger); }
.step-info    { color: var(--text-muted); }

.agent-result { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-top: 0.75rem; }
.agent-result.success { background: var(--success-light); color: var(--success); }
.agent-result.error   { background: var(--danger-light);  color: var(--danger); }
.hidden { display: none !important; }

/* ==================== AUTH PAGES ==================== */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f4f6fa 0%, #e9edf4 100%);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.auth-card .auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-card .auth-logo i {
  font-size: 2.5rem;
  color: var(--primary);
}
.auth-card .auth-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading);
  margin-top: 0.5rem;
}
.auth-card h2, .auth-card h1 { color: var(--heading); }

/* ==================== API TEST ==================== */
.api-test-result {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: none;
}
.api-test-result.show { display: block; }
.api-test-result.ok   { background: var(--success-light); color: var(--success); }
.api-test-result.fail { background: var(--danger-light);  color: var(--danger); }

/* ==================== BLOG CONTENT ==================== */
.blog-content {
  color: var(--text);
  line-height: 1.8;
  font-size: 0.9rem;
}
.blog-content h2, .blog-content h3 { color: var(--heading); margin: 1.25rem 0 0.75rem; }
.blog-content p { margin-bottom: 1rem; }
.blog-content ul, .blog-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================== SIDEBAR COLLAPSED ==================== */
body.mini-sidebar .sidebar { width: 60px; }
body.mini-sidebar .sidebar .menu-title { display: none; }
body.mini-sidebar .sidebar-menu > ul > li > a span { display: none; }
body.mini-sidebar .sidebar-menu > ul > li > a { justify-content: center; padding: 0.85rem; border-left: none; border-radius: 0; }
body.mini-sidebar .sidebar-menu > ul > li > a i { width: auto; font-size: 1.2rem; }
body.mini-sidebar .page-wrapper { margin-left: 60px; }
body.mini-sidebar .header-left { min-width: 60px; width: 60px; }
body.mini-sidebar .header-left .logo span { display: none; }
body.mini-sidebar .header-left .logo { justify-content: center; }

/* Expand on hover when mini */
body.mini-sidebar.expand-menu .sidebar { width: var(--sidebar-width); }
body.mini-sidebar.expand-menu .sidebar .menu-title { display: block; }
body.mini-sidebar.expand-menu .sidebar-menu > ul > li > a span { display: inline; }
body.mini-sidebar.expand-menu .sidebar-menu > ul > li > a { justify-content: flex-start; padding: 0.75rem 1.5rem; }

/* ==================== MOBILE ==================== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(32,44,75,0.5);
  z-index: 1025;
}
#mobile_btn {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  text-decoration: none;
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1035;
  }
  .main-wrapper.slide-nav .sidebar { transform: translateX(0); }
  .main-wrapper.slide-nav .sidebar-overlay { display: block; }
  .page-wrapper { margin-left: 0; }
  .header-left { min-width: auto; width: auto; border-right: none; }
  #toggle_btn { display: none; }
  #mobile_btn { display: flex; }
}

@media (max-width: 768px) {
  .col-xl-3, .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-6 { flex: 0 0 100%; max-width: 100%; }
  .col-lg-4, .col-lg-6, .col-lg-8 { flex: 0 0 100%; max-width: 100%; }
  .content { padding: 1rem; }
  .header-clock { display: none; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 575px) {
  .col-xl-3, .col-sm-6 { flex: 0 0 100%; max-width: 100%; }
  .topbar-actions { gap: 0.4rem; }
  .profile-name { display: none; }
}

/* ==================== ADDITIONAL GRID COLS ==================== */
.col-lg-5  { flex: 0 0 41.6667%; max-width: 41.6667%; }
.col-lg-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
.col-md-2  { flex: 0 0 16.6667%; max-width: 16.6667%; }
.col-md-3  { flex: 0 0 25%; max-width: 25%; }
.col-md-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-lg-3  { flex: 0 0 25%; max-width: 25%; }
.col-lg-9  { flex: 0 0 75%; max-width: 75%; }
.col-lg-10 { flex: 0 0 83.3333%; max-width: 83.3333%; }
@media (max-width: 991px) {
  .col-lg-5, .col-lg-7 { flex: 0 0 100%; max-width: 100%; }
}

/* ==================== SPINNER ==================== */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid var(--border-dark);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  vertical-align: middle;
}

/* ==================== SETTINGS SECTIONS ==================== */
.settings-section { margin-bottom: 0; }

.settings-section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.settings-section-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* ==================== FORM SWITCH ==================== */
.form-switch { display: flex; align-items: center; gap: 0.5rem; }
.form-check.form-switch { align-items: center; }

/* ==================== DARK THEME ==================== */
[data-theme="dark"] {
  --bg:       #151B2E;
  --bg-card:  #1E2742;
  --sidebar-bg: #1E2742;
  --text:     #D8DEF0;
  --text-muted: #8D97B5;
  --text-light: #5C6685;
  --heading:  #EBF0FF;
  --border:   #2A3452;
  --border-dark: #354070;
}

[data-theme="dark"] .table thead th { background: #252e4a; }
[data-theme="dark"] .table tbody tr:hover td { background: rgba(240,134,36,0.08); }
[data-theme="dark"] .card { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .header { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .sidebar { background: var(--sidebar-bg); border-color: var(--border); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea.form-control {
  background: #252e4a;
  border-color: var(--border-dark);
  color: var(--text);
}

[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23A0A8C0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus { border-color: var(--primary); }
[data-theme="dark"] .btn-outline { border-color: var(--border-dark); color: var(--text) !important; }
[data-theme="dark"] .btn-outline:hover { background: rgba(240,134,36,0.12); color: var(--primary) !important; }
[data-theme="dark"] .profile-trigger { background: #252e4a; border-color: var(--border-dark); }
[data-theme="dark"] .profile-dropdown { background: #1E2742; border-color: var(--border); }
[data-theme="dark"] .auth-card { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] #global-loader { background: rgba(21,27,46,0.9); }
[data-theme="dark"] .cron-code,
[data-theme="dark"] .cron-tutorial pre { background: #252e4a; border-color: var(--border); color: var(--text); }
[data-theme="dark"] .media-item { background: #252e4a; border-color: var(--border); }
[data-theme="dark"] .modal-panel { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .api-test-result { display: block; }
[data-theme="dark"] .settings-section-icon { filter: brightness(0.85); }
[data-theme="dark"] pre { color: var(--text); }
