/* ============================================
   GOXEM Newsletter CMS Styles
   ============================================ */

/* ============================================
   NEWSLETTER LIST PAGE
   ============================================ */
.newsletter-search-bar {
  margin-bottom: var(--space-md);
}

.tag-filters {
  margin-bottom: var(--space-lg);
}

.newsletter-loading,
.newsletter-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-text-muted);
}

.article-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.article-card-link:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.article-card-link:hover .article-title {
  color: var(--color-primary);
}

.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-image-gradient {
  background: linear-gradient(135deg, var(--color-purple-100, #f0ebf7), var(--color-lavender-light, #e8ddf5));
  min-height: 180px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

/* Pagination */
.newsletter-pagination,
.admin-pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-2xl);
  flex-wrap: wrap;
}

.page-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--surface-border);
  background: var(--color-bg);
  color: var(--color-text);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.page-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.page-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ============================================
   ADMIN PANEL (inline on newsletter page)
   ============================================ */
.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.admin-panel-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-panel-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-panel-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.admin-panel {
  padding-bottom: var(--space-xl);
}

/* ============================================
   ADMIN DASHBOARD
   ============================================ */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.admin-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  flex: 1;
}

.admin-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.admin-search {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.admin-filters {
  display: flex;
  gap: var(--space-sm);
}

/* Stats */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--color-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--color-primary);
}

.stat-label {
  display: block;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Admin Table */
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table thead {
  background: var(--color-bg-alt);
}

.admin-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--surface-border);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-border);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: var(--color-bg-alt);
}

.table-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-2xl) !important;
}

.td-title {
  max-width: 350px;
}

.post-title-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  display: block;
}

.post-title-link:hover {
  color: var(--color-primary);
}

.post-slug {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.featured-star {
  color: var(--color-warm);
  margin-left: 4px;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-draft {
  background: var(--color-bg-soft);
  color: var(--color-text-muted);
}

.status-published {
  background: rgba(52, 211, 153, 0.12);
  color: #059669;
}

.status-scheduled {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.status-archived {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
}

/* Action Buttons */
.td-actions {
  white-space: nowrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--surface-border);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.action-publish:hover {
  border-color: #059669;
  color: #059669;
}

.action-delete:hover {
  border-color: var(--color-error);
  color: var(--color-error);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-xl);
}

.modal-card h3 {
  font-family: var(--font-heading);
  margin-bottom: var(--space-md);
}

.modal-card p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-xl);
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ============================================
   EDITOR
   ============================================ */
.editor-layout {
  min-height: 100vh;
  background: var(--color-bg-alt);
}

.editor-header {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--surface-border);
  padding: 10px var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-header-left,
.editor-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.editor-status {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.editor-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(52px + var(--space-xl)) var(--space-xl) var(--space-2xl);
}

.editor-main {
  min-width: 0;
}

/* Toolbar */
.editor-toolbar {
  background: var(--color-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
  position: sticky;
  top: calc(72px + 52px + 8px);
  z-index: 50;
}

.toolbar-group {
  display: flex;
  gap: 2px;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--surface-border);
  margin: 0 6px;
}

.toolbar-btn {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  border-color: var(--surface-border);
}

/* Editor Canvas */
.editor-canvas {
  background: var(--color-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  min-height: 400px;
}

.editor-canvas.drag-over {
  border-color: var(--color-primary);
  border-style: dashed;
  background: var(--color-bg-alt);
}

.editor-empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-text-muted);
}

/* Block Wrapper */
.block-wrapper {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  transition: border-color var(--transition-fast);
}

.block-wrapper:hover {
  border-color: var(--surface-border);
}

.block-wrapper:focus-within {
  border-color: var(--color-primary-light);
}

.block-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.block-wrapper:hover .block-controls {
  opacity: 1;
}

.block-ctrl {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.block-ctrl:hover {
  background: var(--color-bg-soft);
  color: var(--color-primary);
}

.block-ctrl-delete:hover {
  color: var(--color-error);
}

.block-type-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 0 auto 0 var(--space-sm);
}

.block-content {
  padding: var(--space-sm) var(--space-md);
}

/* Block Image Preview */
.block-image-preview img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

/* List Editor */
.list-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.list-item-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.list-item-row .input-field {
  flex: 1;
}

/* Table Editor */
.table-editor {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-sm);
}

.table-editor td {
  padding: 2px;
}

.input-table-cell {
  padding: 6px 8px !important;
  font-size: 0.82rem !important;
}

/* Editor Sidebar */
.editor-sidebar {
  background: var(--color-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  height: fit-content;
  position: sticky;
  top: calc(72px + 52px + 8px);
  max-height: calc(100vh - 72px - 52px - 32px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: var(--space-lg);
}

.sidebar-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

/* Featured Image Preview */
.featured-image-preview {
  width: 100%;
  min-height: 120px;
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
  overflow: hidden;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.featured-image-preview img {
  width: 100%;
  height: auto;
  display: block;
}

/* Preview Pane */
.editor-preview {
  background: var(--color-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-2xl);
  min-height: 400px;
}

/* ============================================
   FORM INPUTS (shared)
   ============================================ */
.input-field {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.input-field::placeholder {
  color: var(--color-text-muted);
}

.input-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a7a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.input-textarea {
  resize: vertical;
  min-height: 60px;
}

.input-mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.82rem;
}

.input-heading {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}

.input-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.82rem;
  background: var(--color-bg-alt);
  resize: vertical;
}

.input-mini {
  padding: 4px 8px;
  font-size: 0.75rem;
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  margin-bottom: var(--space-xs);
}

/* ============================================
   ARTICLE ADMIN BAR
   ============================================ */
.article-admin-bar {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--surface-border);
  padding: 8px 0;
}

.article-admin-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.article-admin-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.article-admin-delete-btn {
  border: 1px solid var(--surface-border);
  background: var(--color-bg);
  cursor: pointer;
  font-family: var(--font-body);
}

.article-admin-delete-btn:hover {
  border-color: var(--color-error);
  color: var(--color-error);
}

/* ============================================
   ARTICLE PAGE
   ============================================ */
.article-loading {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.article-hero {
  padding: calc(72px + var(--space-3xl)) 0 var(--space-2xl);
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
}

body.has-admin-bar .article-hero {
  padding-top: calc(72px + 44px + var(--space-3xl));
}

.article-hero-inner {
  max-width: 760px;
  margin: 0 auto;
}

.article-hero-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.article-hero-meta .category-tag {
  position: static;
}

.article-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
}

.article-hero-excerpt {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.article-author-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.article-author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initials {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary);
}

.article-author-info {
  display: flex;
  flex-direction: column;
}

.article-author-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
}

.article-author-role {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* Featured Image */
.article-featured-image {
  margin-bottom: var(--space-2xl);
}

.article-featured-image figure {
  max-width: 900px;
  margin: 0 auto;
}

.article-featured-image img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Article Body (rendered content) */
.article-body-wrap {
  padding-bottom: var(--space-3xl);
}

.article-rendered {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text);
}

.article-rendered p {
  margin-bottom: 1.5em;
}

.article-rendered h1,
.article-rendered h2,
.article-rendered h3,
.article-rendered h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2em;
  margin-bottom: 0.7em;
  line-height: 1.3;
}

.article-rendered h2 { font-size: 1.5rem; }
.article-rendered h3 { font-size: 1.25rem; }
.article-rendered h4 { font-size: 1.1rem; }

.article-rendered a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-rendered a:hover {
  color: var(--color-primary-dark);
}

.article-rendered img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 1.5em 0;
}

.article-rendered figure {
  margin: 1.5em 0;
}

.article-rendered figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

.article-rendered blockquote {
  border-left: 3px solid var(--color-primary);
  padding-left: var(--space-xl);
  margin: 1.5em 0;
  color: var(--color-text-secondary);
  font-style: italic;
}

.article-rendered pre {
  background: var(--color-bg-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  margin: 1.5em 0;
}

.article-rendered code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.88em;
}

.article-rendered p code {
  background: var(--color-bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--surface-border);
}

.article-rendered ul,
.article-rendered ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.article-rendered li {
  margin-bottom: 0.5em;
}

.article-rendered hr {
  border: none;
  height: 1px;
  background: var(--surface-border);
  margin: 2em 0;
}

.article-rendered table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9rem;
}

.article-rendered th,
.article-rendered td {
  border: 1px solid var(--surface-border);
  padding: 10px 14px;
  text-align: left;
}

.article-rendered th {
  background: var(--color-bg-alt);
  font-weight: 600;
}

.article-rendered .callout {
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-xl);
  margin: 1.5em 0;
}

.article-rendered .callout-info {
  background: rgba(110, 79, 158, 0.06);
  border-left: 3px solid var(--color-primary);
}

.article-rendered .callout-warning {
  background: rgba(245, 158, 11, 0.06);
  border-left: 3px solid var(--color-warning);
}

.article-rendered .callout-error {
  background: rgba(248, 113, 113, 0.06);
  border-left: 3px solid var(--color-error);
}

.article-rendered .callout-success {
  background: rgba(52, 211, 153, 0.06);
  border-left: 3px solid var(--color-success);
}

.article-rendered .callout-tip {
  background: rgba(110, 79, 158, 0.06);
  border-left: 3px solid var(--color-lavender);
}

.article-rendered .video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 1.5em 0;
  border-radius: var(--radius-md);
}

.article-rendered .video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.article-rendered .checklist {
  list-style: none;
  padding-left: 0;
}

.article-rendered .checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 0.5em;
}

/* Tags */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  max-width: 720px;
  margin: var(--space-xl) auto;
}

.article-tags .tag-filter {
  text-decoration: none;
}

/* Share */
.article-share {
  max-width: 720px;
  margin: var(--space-2xl) auto 0;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.share-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.share-buttons {
  display: flex;
  gap: var(--space-sm);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--surface-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.share-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .editor-body {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-toolbar-left,
  .admin-toolbar-right {
    flex-wrap: wrap;
  }

  .admin-search {
    max-width: none;
  }

  .article-share {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-toolbar {
    position: static;
  }
}

@media (max-width: 480px) {
  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .admin-filters {
    flex-direction: column;
    width: 100%;
  }

  .admin-filters select {
    width: 100%;
  }
}

