/* Base styles */
:root {
  --primary: #FFA500;
  --primary-dark: #FF8C00;
  --secondary: #6b7280;
  --secondary-dark: #4b5563;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-width: 40%;
  --main-width: 60%;
  --gap: 2rem;
  --honey-gradient: linear-gradient(135deg, #FFA500, #FFD700);
  --radius-sm: 0.5rem;
  --radius: 0.875rem;
  --radius-lg: 1.25rem;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow: 0 1px 3px rgba(17, 24, 39, 0.06), 0 8px 24px -8px rgba(17, 24, 39, 0.10);
  --shadow-lg: 0 4px 6px -1px rgba(17, 24, 39, 0.06), 0 16px 40px -12px rgba(17, 24, 39, 0.16);
  --shadow-primary: 0 8px 20px -6px rgba(255, 140, 0, 0.35);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
  color: var(--gray-800);
  background-color: #FFFAF0;
  background-image:
    radial-gradient(circle at 8% 0%, rgba(255, 165, 0, 0.10), transparent 32%),
    radial-gradient(circle at 100% 12%, rgba(255, 215, 0, 0.10), transparent 30%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: rgba(255, 165, 0, 0.25);
}

/* Slim, modern scrollbar (progressive enhancement - no-op where unsupported) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

h1, h2, h3, h4 {
  letter-spacing: -0.01em;
}

/* Layout */
.container:not(.profile-container) {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.editor-layout {
  display: flex;
  align-items: stretch;
  gap: var(--gap);
}

.editor-main {
  flex: 1 1 0;
  min-width: 0;
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.editor-sidebar {
  flex: 0 0 340px;
  max-width: 340px;
  position: sticky;
  top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.editor-sidebar .card {
  margin-bottom: 0;
  padding: 1.5rem;
}

.editor-sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  margin-bottom: 1.1rem;
}

.editor-sidebar-title svg {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--primary);
  flex: 0 0 auto;
}

.credit-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.credit-info-row + .credit-info-row {
  margin-top: 0.55rem;
}

.credit-info-row span:first-child {
  color: var(--gray-500);
}

.credit-info-row span:last-child {
  font-weight: 600;
  color: var(--gray-900);
}

/* Navigation */
.navbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem 0;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 40;
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-link {
  display: flex;
  align-items: center;
  transition: transform 0.2s var(--ease);
}

.logo-link:hover {
  transform: scale(1.02);
}

.logo {
  height: 40px;
  width: auto;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-200);
  transition: box-shadow 0.25s var(--ease);
}

/* Stat cards (dashboard summary row) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card-icon {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--honey-gradient);
}

.stat-card-icon svg { width: 1.35rem; height: 1.35rem; }

.stat-card-icon.is-success { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-card-icon.is-pending { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-card-icon.is-danger { background: linear-gradient(135deg, #ef4444, #f87171); }
.stat-card-icon.is-neutral { background: linear-gradient(135deg, #6b7280, #9ca3af); }

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gray-900);
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
  background: var(--gray-50);
  color: var(--gray-800);
}

.form-control::placeholder {
  color: var(--gray-400);
}

.form-control:hover {
  border-color: var(--gray-300);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 165, 0, 0.14);
  background: white;
}

small {
  display: block;
  margin-top: 0.375rem;
  color: var(--gray-500);
  font-size: 0.8rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.375rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease), opacity 0.15s var(--ease);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--honey-gradient);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -6px rgba(255, 140, 0, 0.42);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  transform: translateY(-1px);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: white;
  box-shadow: 0 8px 20px -6px rgba(245, 158, 11, 0.35);
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -6px rgba(245, 158, 11, 0.42);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: white;
  box-shadow: 0 8px 20px -6px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -6px rgba(239, 68, 68, 0.42);
}

.btn-sm {
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.table th,
.table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  text-align: left;
  vertical-align: middle;
}

.table th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  white-space: nowrap;
}

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

.table tbody tr {
  transition: background-color 0.15s var(--ease);
}

.table tbody tr:hover td {
  background-color: var(--gray-50);
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.alert svg {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

/* Editor (legacy custom-toolbar styles - unused now that TinyMCE renders its
   own UI, kept only so nothing that might still reference them breaks) */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-bottom: none;
  border-radius: 0;
  min-height: 30px;
}

.editor-toolbar button {
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  font-size: 13px;
  transition: none;
  color: #333;
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.editor-toolbar button:hover {
  background: #f0f0f0;
  border-color: #999;
}

.editor-toolbar button.active {
  background: #e8e8e8;
  border-color: #999;
}

.editor-content {
  position: relative;
}

.editor-content textarea {
  width: 100%;
  min-height: 500px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  background: white;
  color: #333;
}

.editor-content textarea:focus {
  outline: none;
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
}

/* WordPress-style buttons */
.editor-toolbar .wp-button {
  background: transparent;
  border: 1px solid transparent;
  color: #2c3338;
  font-weight: normal;
}

.editor-toolbar .wp-button:hover {
  background: #f0f0f0;
  border-color: #999;
  color: #2c3338;
}

.editor-toolbar .wp-button.active {
  background: #e8e8e8;
  border-color: #999;
  color: #2c3338;
}

/* Separator */
.editor-toolbar .separator {
  width: 1px;
  height: 24px;
  background-color: #ddd;
  margin: 3px 0;
}

/* Link Dialog */
.link-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  border-radius: 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  width: 90%;
  max-width: 400px;
  border: 1px solid #ddd;
}

.link-dialog h3 {
  margin: 0 0 15px 0;
  color: #1d2327;
  font-size: 14px;
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid #ddd;
}

.link-dialog .form-group {
  margin-bottom: 15px;
}

.link-dialog .form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #1d2327;
  font-size: 13px;
}

.link-dialog .form-control {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 0;
  font-size: 13px;
}

.link-dialog .form-control:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
  outline: none;
}

.link-dialog .button-group {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.link-dialog .btn {
  padding: 5px 10px;
  border-radius: 0;
  font-size: 13px;
  cursor: pointer;
  transition: none;
}

.link-dialog .btn-primary {
  background: #2271b1;
  color: white;
  border: 1px solid #2271b1;
}

.link-dialog .btn-primary:hover {
  background: #135e96;
  border-color: #135e96;
}

.link-dialog .btn-secondary {
  background: #f6f7f7;
  color: #2c3338;
  border: 1px solid #c3c4c7;
}

.link-dialog .btn-secondary:hover {
  background: #f0f0f1;
  border-color: #2271b1;
  color: #2271b1;
}

.link-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* TinyMCE wrapper */
.tinymce-container {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.375rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.status-badge svg {
  width: 0.9rem;
  height: 0.9rem;
}

.status-publish {
  background: #ecfdf5;
  color: #065f46;
}

.status-draft {
  background: var(--gray-100);
  color: var(--gray-700);
}

.status-pending, .status-queued {
  background: #fffbeb;
  color: #92400e;
}

.status-failed {
  background: #fef2f2;
  color: #991b1b;
}

/* Footer */
.footer {
  margin-top: 80px;
  padding: 2rem 0;
  background: white;
  border-top: 1px solid var(--gray-200);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  height: 30px;
  width: auto;
  opacity: 0.9;
}

.footer-copyright {
  color: var(--gray-600);
  font-size: 0.875rem;
}

/* Utility Classes */
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 1rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }

/* Responsive */
@media (max-width: 1024px) {
  .editor-layout {
    flex-direction: column;
  }

  .editor-sidebar {
    flex: 0 0 100%;
    max-width: 100%;
    position: static;
  }
}

@media (max-width: 768px) {
  .navbar-content {
    flex-direction: column;
    gap: 1rem;
  }

  .container {
    padding: 0 1rem;
  }

  .card, .editor-main {
    padding: 1.5rem;
  }

  .editor-toolbar {
    padding: 0.75rem;
  }

  .editor-content textarea {
    padding: 1rem;
  }
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card, .stat-card, .alert {
  animation: fadeInUp 0.35s var(--ease) both;
}

/* Category List */
.category-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s var(--ease);
}

.category-item:hover {
  background-color: var(--gray-50);
}

.category-item input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.25rem;
  border: 2px solid var(--gray-300);
  transition: all 0.2s var(--ease);
  cursor: pointer;
  accent-color: var(--primary);
}

.category-item input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Credit Info */
.credit-info {
  background: var(--gray-50);
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-200);
}

.credit-info p {
  margin-bottom: 0.5rem;
}

.credit-info p:last-child {
  margin-bottom: 0;
}

/* Warning Messages */
.warning {
  background: #fff7ed;
  border-left: 4px solid var(--warning);
  color: #9a3412;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Table Responsive */
.table-responsive {
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-200);
}

/* Separator */
.separator {
  width: 1px;
  height: 24px;
  background-color: var(--gray-300);
  margin: 0 0.5rem;
}

.back-to-dashboard-btn {
  margin-bottom: 4rem;
}

main.container {
  min-height: 300px;
}

/* Content Hub "shared to" icon strip */
.ch-share-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.ch-share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.ch-share-icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

a.ch-share-icon:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.ch-share-icon.is-success {
  background: #ecfdf5;
  color: #065f46;
}

.ch-share-icon.is-failed {
  background: #fef2f2;
  color: #991b1b;
  cursor: help;
}

.ch-share-icon.is-pending {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: help;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.pagination .mx-4 {
  color: var(--gray-500);
  font-size: 0.85rem;
  font-weight: 500;
}
