/**
 * blog-cpanel/assets/css/cpanel.css
 * Modern, responsive blog management control panel styles
 */

:root {
  --primary: #18215e;
  --primary-light: #242f7c;
  --primary-glow: rgba(24, 33, 94, 0.15);
  --accent: #ff4880;
  --accent-hover: #e8336b;
  --teal: #0d8c73;
  --amber: #f59e0b;
  --emerald: #10b981;
  --rose: #ef4444;
  --sky: #0284c7;
  
  --bg-body: #f4f6fb;
  --bg-card: #ffffff;
  --bg-sidebar: #131940;
  --bg-sidebar-active: #202b66;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border: #e2e8f0;
  --border-light: #edf2f7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Grotesk', monospace;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--sky);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--primary-light);
}

/* Shell Layout */
.cpanel-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, #7928ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(255, 72, 128, 0.3);
}
.brand-name {
  display: block;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #fff;
  line-height: 1.2;
}
.brand-sub {
  display: block;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  padding: 8px 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 6px 10px 2px 10px;
  margin-bottom: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
  transition: all 0.2s ease;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
}
.nav-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.15);
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid rgba(255,255,255,0.2);
}
.user-info {
  line-height: 1.2;
}
.user-name {
  display: block;
  font-weight: 700;
  font-size: 12.5px;
  color: #fff;
}
.user-role {
  display: block;
  font-size: 10.5px;
  color: #94a3b8;
}

/* Main Area */
.cpanel-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
}
.topbar-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.2px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-badge {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-body);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

/* Flash Messages */
.flash-stack {
  padding: 16px 28px 0;
}
.flash {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.flash-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.flash-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.flash-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
}
.flash-close:hover { opacity: 1; }

/* Content Wrapper */
.cpanel-content {
  padding: 28px;
  flex: 1;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.4px;
}
.page-title span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 18px;
  margin-left: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(24, 33, 94, 0.25);
}
.btn-primary:hover {
  background: var(--primary-light);
  color: #fff;
  transform: translateY(-1px);
}
.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255, 72, 128, 0.25);
}
.btn-accent:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
}
.btn-ghost {
  background: #fff;
  color: var(--text-main);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--primary);
}
.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
.btn-danger:hover {
  background: #ef4444;
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.indigo  { background: #e0e7ff; color: #4338ca; }
.stat-icon.emerald { background: #d1fae5; color: #059669; }
.stat-icon.amber   { background: #fef3c7; color: #d97706; }
.stat-icon.sky     { background: #e0f2fe; color: #0284c7; }
.stat-icon.rose    { background: #ffe4e6; color: #e11d48; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  font-family: var(--font-mono);
}
.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Cards & Containers */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-body {
  padding: 24px;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
table.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
table.data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: 13.5px;
}
table.data-table tr:last-child td {
  border-bottom: none;
}
table.data-table tr:hover td {
  background: #fafbfd;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-published { background: #dcfce7; color: #15803d; }
.badge-draft     { background: #fef3c7; color: #b45309; }
.badge-archived  { background: #f1f5f9; color: #475569; }
.badge-category  { background: #e0e7ff; color: #3730a3; }

/* Filter Bar */
.filter-bar {
  background: #fff;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}
.search-input-wrap input {
  padding-left: 36px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.form-group label span.req {
  color: var(--accent);
}
.form-group .form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

/* Editor Form Grid (2 Columns: Main Content + Sidebar) */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* SEO Card & Google SERP Preview */
.seo-card {
  background: #fdfefe;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 24px;
}
.seo-card .card-header {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border-bottom: 1px solid #dbeafe;
}
.google-serp-preview {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.google-serp-site {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #202124;
  margin-bottom: 4px;
}
.google-serp-site-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}
.google-serp-url {
  font-size: 12px;
  color: #4d5156;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.google-serp-title {
  font-size: 18px;
  font-weight: 500;
  color: #1a0dab;
  line-height: 1.3;
  cursor: pointer;
  margin-bottom: 4px;
}
.google-serp-title:hover {
  text-decoration: underline;
}
.google-serp-desc {
  font-size: 13.5px;
  color: #4d5156;
  line-height: 1.45;
}
.char-counter {
  font-size: 11px;
  color: var(--text-muted);
  float: right;
  font-weight: 600;
}
.char-counter.good { color: var(--emerald); }
.char-counter.warn { color: var(--amber); }

/* Image Uploader & Preview Box */
.image-upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  background: #fafbfd;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.image-upload-box:hover {
  border-color: var(--sky);
  background: #f0f9ff;
}
.image-upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.preview-img-holder {
  margin-top: 12px;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 180px;
}
.preview-img-holder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 20px;
}
.page-btn {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
}
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:hover:not(.active) {
  background: #f1f5f9;
}

/* Footer */
.cpanel-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}

/* Login Page Specific */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, #1e2768 0%, #10163a 90%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  padding: 40px 36px;
}
.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(255,72,128,0.35);
}
.login-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}
.login-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .cpanel-main {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
}
