/* ==========================================================================
   Article Planner (Rencana Artikel) - Design System & Modern UI
   ========================================================================== */

:root {
  --ap-bg: #0F172A;
  --ap-card: #1E293B;
  --ap-border: rgba(255, 255, 255, 0.08);
  --ap-border-focus: #D97706;
  --ap-primary: #D97706;
  --ap-primary-hover: #B45309;
  --ap-emerald: #10B981;
  --ap-cyan: #06B6D4;
  --ap-purple: #8B5CF6;
  --ap-blue: #3B82F6;
  --ap-rose: #F43F5E;
  --ap-text-main: #F8FAFC;
  --ap-text-muted: #94A3B8;
  --ap-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

/* Floating Launcher Button */
.ap-launcher-btn {
  position: fixed;
  bottom: 24px;
  right: 215px; /* Sits cleanly to the left of AI Article Studio floating button */
  z-index: 9998;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  color: #F8FAFC;
  border: 1px solid rgba(217, 119, 6, 0.4);
  border-radius: 9999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(217, 119, 6, 0.2);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.ap-launcher-btn:hover {
  transform: translateY(-2px);
  border-color: #D97706;
  box-shadow: 0 14px 30px -5px rgba(0, 0, 0, 0.6), 0 0 25px rgba(217, 119, 6, 0.35);
  background: linear-gradient(135deg, #283548 0%, #131E33 100%);
}

.ap-launcher-badge {
  background: rgba(217, 119, 6, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(217, 119, 6, 0.3);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 700;
}

/* Main Modal Backdrop & Window */
.ap-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.82);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ap-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.ap-window {
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 1280px;
  height: 85vh;
  min-height: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 40px rgba(217, 119, 6, 0.15);
  color: var(--ap-text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transform: scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.ap-modal-backdrop.active .ap-window {
  transform: scale(1);
}

/* Header */
.ap-header {
  padding: 18px 24px;
  background: rgba(30, 41, 59, 0.6);
  border-bottom: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ap-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ap-header-title h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.ap-header-stats {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ap-stat-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ap-border);
  color: var(--ap-text-muted);
}

.ap-stat-pill strong {
  color: #F8FAFC;
}

.ap-stat-pill.active-planned {
  border-color: rgba(148, 163, 184, 0.3);
  color: #CBD5E1;
}

.ap-stat-pill.active-progress {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.1);
  color: #93C5FD;
}

.ap-stat-pill.active-published {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #6EE7B7;
}

.ap-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-close-btn {
  background: transparent;
  border: none;
  color: var(--ap-text-muted);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ap-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

/* Toolbar & Filters Bar */
.ap-toolbar {
  padding: 14px 24px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--ap-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ap-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.ap-search-input {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  color: #F8FAFC;
  padding: 8px 12px;
  font-size: 13px;
  min-width: 220px;
  outline: none;
  transition: border-color 0.2s ease;
}

.ap-search-input:focus {
  border-color: var(--ap-primary);
}

.ap-select {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  color: #F8FAFC;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.ap-select:focus {
  border-color: var(--ap-primary);
}

.ap-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.ap-btn-primary {
  background: #D97706;
  color: #FFFFFF;
}

.ap-btn-primary:hover {
  background: #B45309;
}

.ap-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #E2E8F0;
  border-color: var(--ap-border);
}

.ap-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.ap-btn-sync {
  background: rgba(16, 185, 129, 0.12);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
}

.ap-btn-sync:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10B981;
}

.ap-btn-csv {
  background: rgba(59, 130, 246, 0.12);
  color: #60A5FA;
  border-color: rgba(59, 130, 246, 0.3);
}

.ap-btn-csv:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3B82F6;
}

/* Table Area */
.ap-table-container {
  flex: 1;
  overflow: auto;
  position: relative;
}

.ap-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.ap-table th {
  position: sticky;
  top: 0;
  background: #131E33;
  color: var(--ap-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ap-border);
  z-index: 10;
}

.ap-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.ap-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Specific Cell Badges & Formats */
.ap-keyphrase-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(217, 119, 6, 0.12);
  color: #FBBF24;
  border: 1px solid rgba(217, 119, 6, 0.25);
  font-weight: 600;
  font-size: 12px;
}

/* Page Role Badges */
.ap-role-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ap-role-pillar {
  background: rgba(139, 92, 246, 0.15);
  color: #C4B5FD;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.ap-role-cluster {
  background: rgba(6, 182, 212, 0.15);
  color: #67E8F9;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.ap-role-guide {
  background: rgba(245, 158, 11, 0.15);
  color: #FCD34D;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.ap-role-case {
  background: rgba(16, 185, 129, 0.15);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.ap-role-landing {
  background: rgba(244, 63, 94, 0.15);
  color: #FDA4AF;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

/* Title & Meta Details */
.ap-title-main {
  font-weight: 600;
  color: #F8FAFC;
  margin-bottom: 4px;
  line-height: 1.4;
}

.ap-title-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--ap-text-muted);
}

.ap-title-meta a {
  color: #38BDF8;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.ap-title-meta a:hover {
  text-decoration: underline;
}

/* Status Pills */
.ap-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.ap-status-planned {
  background: rgba(148, 163, 184, 0.12);
  color: #CBD5E1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.ap-status-in-progress {
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.ap-status-ready {
  background: rgba(234, 179, 8, 0.15);
  color: #FDE047;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.ap-status-scheduled {
  background: rgba(249, 115, 22, 0.15);
  color: #FDBA74;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.ap-status-published {
  background: rgba(16, 185, 129, 0.15);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Intent Badges */
.ap-intent-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: #E2E8F0;
  border: 1px solid var(--ap-border);
}

/* Action Buttons Cell */
.ap-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ap-btn-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ap-border);
  color: var(--ap-text-muted);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.ap-btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.ap-btn-action-ai {
  background: rgba(217, 119, 6, 0.15);
  color: #FBBF24;
  border-color: rgba(217, 119, 6, 0.3);
  font-weight: 600;
}

.ap-btn-action-ai:hover {
  background: #D97706;
  color: #FFFFFF;
  border-color: #D97706;
}

.ap-btn-action-delete:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #FDA4AF;
  border-color: #F43F5E;
}

/* Modals inside Planner (Add/Edit & CSV Import) */
.ap-submodal {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.9);
  backdrop-filter: blur(6px);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ap-submodal.active {
  display: flex;
}

.ap-submodal-card {
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  padding: 24px;
}

.ap-form-group {
  margin-bottom: 16px;
}

.ap-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #CBD5E1;
  margin-bottom: 6px;
}

.ap-form-input, .ap-form-textarea {
  width: 100%;
  background: #0F172A;
  border: 1px solid var(--ap-border);
  border-radius: 6px;
  color: #F8FAFC;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.ap-form-input:focus, .ap-form-textarea:focus {
  border-color: var(--ap-primary);
}

.ap-dropzone {
  border: 2px dashed rgba(217, 119, 6, 0.4);
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  background: rgba(217, 119, 6, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ap-dropzone:hover, .ap-dropzone.dragover {
  border-color: #D97706;
  background: rgba(217, 119, 6, 0.08);
}

/* Toast Notifications */
.ap-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1E293B;
  border: 1px solid #10B981;
  color: #F8FAFC;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 99999;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Multiple Keyphrase Chips in Table */
.ap-keyphrase-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 280px;
}

.ap-keyphrase-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(217, 119, 6, 0.12);
  color: #FBBF24;
  border: 1px solid rgba(217, 119, 6, 0.25);
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1.25;
}

/* Multi-keyphrase Tag Input in Form Modal */
.ap-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: #0F172A;
  border: 1px solid var(--ap-border);
  border-radius: 6px;
  padding: 6px 10px;
  min-height: 42px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: text;
}
.ap-chips-wrap:focus-within {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.25);
}
.ap-form-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(217, 119, 6, 0.16);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #FBBF24;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  line-height: 1.2;
}
.ap-form-chip-remove {
  cursor: pointer;
  background: none;
  border: none;
  color: #FBBF24;
  font-size: 12px;
  font-weight: bold;
  padding: 0 0 0 3px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s;
}
.ap-form-chip-remove:hover {
  opacity: 1;
  transform: scale(1.2);
  color: #EF4444;
}
.ap-chip-input-field {
  flex: 1;
  min-width: 140px;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  color: #F8FAFC !important;
  font-size: 13px !important;
  font-family: inherit !important;
  padding: 4px 0 !important;
  box-shadow: none !important;
}
.ap-chip-input-field::placeholder {
  color: #64748B;
}

/* Scheduled Stat Pill in Header */
.ap-stat-pill.active-scheduled {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.12);
  color: #FDBA74;
}

/* Row Flash / Glow Animation on Website Sync */
@keyframes apRowPulse {
  0% {
    background-color: rgba(217, 119, 6, 0.3);
    box-shadow: inset 0 0 16px rgba(217, 119, 6, 0.35);
  }
  50% {
    background-color: rgba(16, 185, 129, 0.22);
    box-shadow: inset 0 0 12px rgba(16, 185, 129, 0.3);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

.ap-row-highlight {
  animation: apRowPulse 3s ease-out forwards;
}
