/* ===== Admin Content Manager ===== */

#content-manager-root {
  display: flex;
  min-height: 100vh;
  direction: rtl;
  font-family: 'Cairo', system-ui, sans-serif;
}

.cm-login {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  background: #f8fafc;
}

.cm-login-card {
  background: #fff;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  max-width: 400px;
  width: 90%;
}

.cm-login-card h2 { font-size: 24px; color: #1a2530; margin-bottom: 8px; }
.cm-login-card p { color: #64748b; margin-bottom: 24px; }

.cm-sidebar {
  width: 240px;
  background: #1a2530;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.cm-sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.cm-sidebar-header h2 { font-size: 18px; margin: 0; }
.cm-version { font-size: 11px; opacity: 0.5; }

.cm-nav { padding: 12px; flex: 1; }
.cm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  text-align: right;
  transition: all 0.2s;
  font-family: inherit;
}

.cm-nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cm-nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }
.cm-nav-item .material-icons-outlined { font-size: 20px; }

.cm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  min-width: 0;
}

.cm-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.cm-topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a2530;
  flex: 1;
}

.cm-topbar-actions { display: flex; gap: 8px; }

.cm-mobile-menu {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.cm-content {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.cm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.cm-btn-primary { background: #1a2530; color: #fff; }
.cm-btn-primary:hover { background: #0f172a; }
.cm-btn-secondary { background: #f1f5f9; color: #475569; }
.cm-btn-secondary:hover { background: #e2e8f0; }

.cm-table-wrapper { overflow-x: auto; }
.cm-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.cm-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 13px;
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid #e2e8f0;
}

.cm-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.cm-table tr:last-child td { border-bottom: none; }
.cm-table tr:hover td { background: #f8fafc; }

.cm-cell-title { font-weight: 500; }
.cm-cell-actions { display: flex; gap: 4px; }

.cm-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
  text-decoration: none;
}

.cm-btn-icon:hover { background: #f1f5f9; color: #1a2530; }
.cm-btn-icon .material-icons-outlined { font-size: 18px; }

.cm-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.cm-status-published { background: #dcfce7; color: #16a34a; }
.cm-status-draft { background: #fef9c3; color: #ca8a04; }
.cm-status-archived { background: #f1f5f9; color: #94a3b8; }

.cm-empty {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
}

.cm-loading, .cm-error {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.cm-error { color: #ef4444; }

/* ===== Editor ===== */

.cm-editor-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.cm-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.cm-editor-header h3 { font-size: 18px; color: #1a2530; margin: 0; }

.cm-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.cm-editor-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
}

.cm-form { max-width: 900px; margin: 0 auto; }
.cm-form-group { margin-bottom: 20px; }
.cm-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1a2530;
  margin-bottom: 6px;
}

.cm-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.cm-input:focus { border-color: #1a2530; }
.cm-input-color { width: 60px; height: 40px; padding: 4px; }

.cm-textarea { resize: vertical; min-height: 80px; }
.cm-editor-textarea {
  min-height: 400px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  direction: ltr;
  text-align: left;
}

.cm-form-row { display: flex; gap: 16px; }
.cm-form-row .cm-form-group { flex: 1; }
.cm-form-group-full { flex: 0 0 100%; }

.cm-form-section {
  margin: 24px 0;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
}

.cm-form-section h4 { font-size: 15px; color: #1a2530; margin-bottom: 4px; }
.cm-form-hint { font-size: 12px; color: #94a3b8; margin-bottom: 12px; }

.cm-editor-toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px;
  margin-bottom: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.cm-editor-toolbar button {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: all 0.2s;
}

.cm-editor-toolbar button:hover { background: #f1f5f9; border-color: #94a3b8; }

.cm-faq-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.cm-faq-item .cm-input { flex: 1; }
.cm-faq-item .cm-btn-icon { flex-shrink: 0; margin-top: 4px; }

/* ===== Toast ===== */

.cm-toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cm-toast {
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  color: #fff;
  text-align: center;
}

.cm-toast-success { background: #16a34a; }
.cm-toast-error { background: #ef4444; }
.cm-toast-info { background: #3b82f6; }

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .cm-sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    height: 100%;
    z-index: 500;
    transition: right 0.3s;
  }
  .cm-sidebar-open { right: 0; }
  .cm-mobile-menu { display: flex; }
  .cm-form-row { flex-direction: column; gap: 0; }
  .cm-table { font-size: 13px; }
  .cm-table th, .cm-table td { padding: 10px 12px; }
}
