/* Psytime Editor v18 - 2026-01-29 - AI generation buttons + per-field regeneration */
/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #FAFAF9;
  --bg-card: #FFFFFF;
  --bg-hover: #F5F5F4;
  --border: #E5E5E5;
  --text: #1A1A1A;
  --text-secondary: #737373;
  --accent: #8B7355;
  --accent-light: #C4B5A0;
  --success: #22C55E;
  --warning: #F59E0B;
  --info: #3B82F6;
  --error: #EF4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #F9F0E3 0%, #E8DFD0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-overlay.hidden {
  display: none;
}

.login-box {
  background: var(--bg-card);
  padding: 48px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.login-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.15);
}

.login-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

.login-error {
  color: #dc2626;
  font-size: 14px;
  margin-top: 16px;
}

.login-error.hidden {
  display: none;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
}

.logo-subtitle {
  font-size: 14px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--bg);
}

.nav-btn.active {
  background: var(--accent);
  color: white;
}

/* Main */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Posts view */
.posts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 68px;
  z-index: 10;
  background: var(--bg);
  padding: 16px 0;
}

.posts-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.posts-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.posts-count {
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 12px;
}

/* New post button */
.new-post-wrapper {
  position: relative;
}

.btn-new-post {
  font-size: 13px;
  padding: 8px 14px;
}

.new-post-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 200px;
  overflow: hidden;
}

.new-post-dropdown.hidden {
  display: none;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: var(--bg);
}

.dropdown-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* Import Modal */
.import-modal-content {
  max-width: 700px;
  width: 90%;
}

.import-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.import-textarea {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 300px;
}

.import-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.posts-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
}

.search-input {
  width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.type-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.type-select:focus {
  outline: none;
  border-color: var(--accent);
}

.filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 250px));
  gap: 20px;
  justify-content: center;
}

.posts-grid.list-view {
  display: block;
}

/* ============================================
   GALLERY VIEW TOGGLE
   ============================================ */
.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid var(--border);
}

#gallery-view-toggle .view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

#gallery-view-toggle .view-toggle-btn svg {
  width: 18px;
  height: 18px;
}

#gallery-view-toggle .view-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

#gallery-view-toggle .view-toggle-btn.active {
  background: var(--accent);
  color: white;
}

/* ============================================
   LIST VIEW STYLES
   ============================================ */
.posts-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

.posts-list-table thead {
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.posts-list-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

.posts-list-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.posts-list-table th.sortable:hover {
  color: var(--text);
}

.posts-list-table th.sort-active {
  color: var(--accent);
}

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

.post-list-row {
  cursor: pointer;
  transition: background 0.15s;
}

.post-list-row:hover {
  background: var(--bg-hover);
}

/* Column widths */
.col-badge { width: 70px; }
.col-name { min-width: 200px; }
.col-type { width: 130px; }
.col-status { width: 100px; }
.col-date { width: 110px; }

/* Badge cell */
.post-list-badge span {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
}

.badge-theme { background: #e8f5e9 !important; color: #2e7d32 !important; }
.badge-punchline { background: #fff3e0 !important; color: #e65100 !important; }
.badge-punchline-long { background: #fce4ec !important; color: #c2185b !important; }
.badge-1idee { background: #e3f2fd !important; color: #1565c0 !important; }
.badge-story { background: #f3e5f5 !important; color: #7b1fa2 !important; }

/* Name cell */
.post-list-name {
  font-weight: 500;
  color: var(--text);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Type cell */
.post-list-type {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Status pill */
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-pill.draft {
  background: rgba(115, 115, 115, 0.15);
  color: #666;
}

.status-pill.validated {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.status-pill.ready {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}

.status-pill.published {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

/* Date cells */
.post-list-date {
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
}

.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.post-thumbnail {
  aspect-ratio: 4/5;
  background: #F9F0E3;
  position: relative;
  overflow: hidden;
  --thumb-scale: 0.23; /* Default, overridden by JS */
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Thumbnail preview avec blobs */
.thumb-preview {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Real preview scalée - 250px max width / 1080 = 0.23 scale */
.thumb-preview.real-preview {
  padding: 0;
  width: 100%;
  height: 100%;
}

.thumb-scale-container {
  width: 1080px;
  height: 1350px;
  transform: scale(var(--thumb-scale, 0.23));
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}

/* Placeholder pour lazy loading */
.thumb-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  animation: placeholderPulse 1.5s ease-in-out infinite;
}

@keyframes placeholderPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.thumb-placeholder-text {
  font-size: 24px;
  font-weight: 600;
  color: #ccc;
}

.thumb-blob {
  position: absolute;
  width: 100px;
  height: 100px;
  opacity: 0.4;
}

.thumb-blob svg {
  width: 100%;
  height: 100%;
}

.thumb-blob.top-left { top: -30px; left: -30px; }
.thumb-blob.top-right { top: -30px; right: -30px; }
.thumb-blob.bottom-left { bottom: -30px; left: -30px; }
.thumb-blob.bottom-right { bottom: -30px; right: -30px; }

/* Forme SVG centrale pour punchline */
.thumb-shape {
  position: absolute;
  width: 140%;
  height: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  opacity: 0.85;
}

.thumb-title {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #7D845A;
  text-align: center;
  line-height: 1.35;
  position: relative;
  z-index: 2;
  max-width: 90%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.post-status {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
}

.post-status.draft { background: var(--text-secondary); }
.post-status.validated { background: var(--warning); }
.post-status.ready { background: var(--info); }
.post-status.published { background: var(--success); }

.post-status-label {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-status-label.draft { background: rgba(115, 115, 115, 0.9); color: white; }
.post-status-label.validated { background: rgba(245, 158, 11, 0.9); color: white; }
.post-status-label.ready { background: rgba(59, 130, 246, 0.9); color: white; }
.post-status-label.published { background: rgba(34, 197, 94, 0.9); color: white; }

.post-info {
  padding: 16px;
}

.post-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
}

/* Calendar view */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.cal-nav-btn:hover {
  background: var(--bg);
}

#current-month {
  font-size: 18px;
  font-weight: 500;
  min-width: 160px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.calendar-day:hover {
  border-color: var(--accent);
}

.calendar-day.other-month {
  opacity: 0.3;
}

.calendar-day.today {
  border-color: var(--accent);
  border-width: 2px;
}

.calendar-day.has-post {
  background: var(--bg);
}

.calendar-day .day-number {
  font-weight: 500;
}

.calendar-day .day-posts {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.calendar-day .day-post {
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-post.published { background: #DCFCE7; color: #166534; }
.day-post.scheduled { background: #FEF3C7; color: #92400E; }
.day-post.ready { background: #DBEAFE; color: #1E40AF; }

.calendar-legend {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.published { background: var(--success); }
.dot.scheduled { background: var(--warning); }
.dot.ready { background: var(--info); }

/* ======================================
   CALENDAR ASSIGNMENT FEATURE
   ====================================== */

/* Page header avec toggle */
.calendar-page-header {
  margin-bottom: 20px;
}

.calendar-view-toggle {
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  width: fit-content;
}

.view-toggle-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.view-toggle-btn:hover {
  color: var(--text);
}

.view-toggle-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* Utility class */
.hidden {
  display: none !important;
}

/* Layout principal calendrier */
.calendar-main {
  display: grid;
  grid-template-columns: 1fr 385px;
  gap: 24px;
  align-items: start;
}

.calendar-left {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* Calendrier - jour sélectionné */
.calendar-day.selected {
  background: var(--accent) !important;
  color: white;
  border-color: var(--accent);
}

.calendar-day.selected .day-number {
  color: white;
}

.calendar-day.selected .day-post {
  background: rgba(255,255,255,0.3);
  color: white;
}

/* Panneau d'affectation */
.assign-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 100px;
}

.assign-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.assign-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.close-assign-panel {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
}

.close-assign-panel:hover {
  background: var(--border);
}

.assign-panel-content {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

/* État vide */
.assign-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.assign-empty p {
  margin: 0;
  font-size: 14px;
}

/* Formulaire d'affectation */
.assign-form.hidden {
  display: none;
}

/* Posts déjà affectés */
.assigned-posts {
  margin-bottom: 20px;
}

.assigned-post-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
}

.assigned-post-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assigned-post-badge {
  padding: 4px 8px;
  background: var(--warning);
  color: white;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.assigned-post-title {
  font-size: 14px;
  font-weight: 500;
}

.btn-unassign {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-unassign:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: #fff5f5;
}

/* Sélecteur de type */
.assign-type-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.assign-type-btn {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.assign-type-btn:hover {
  border-color: var(--accent-light);
}

.assign-type-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

/* Recherche dans le panneau d'affectation */
.assign-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  background: var(--bg-card);
}

.assign-search:focus {
  outline: none;
  border-color: var(--accent);
}

/* Liste des posts disponibles */
.available-posts {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.available-post-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.available-post-item:last-child {
  border-bottom: none;
}

.available-post-item:hover {
  background: var(--bg);
}

.available-post-item.selected {
  background: #f0f7ff;
  border-color: var(--info);
}

.available-post-item.selected::before {
  content: '✓';
  width: 24px;
  height: 24px;
  background: var(--info);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.available-post-num {
  min-width: 36px;
  padding: 4px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--text-secondary);
}

.available-post-title {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.available-post-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-secondary);
}

.available-post-status.validated {
  background: #fef3c7;
  color: #92400e;
}

.available-post-scheduled {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #dcfce7;
  color: #166534;
  display: flex;
  align-items: center;
  gap: 4px;
}

.available-post-scheduled::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
}

.available-post-item.already-scheduled {
  background: #f0fdf4;
}

.available-post-item.already-scheduled:hover {
  background: #dcfce7;
}

.available-posts-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Bouton affecter */
.btn-assign {
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

.btn-assign:disabled {
  background: var(--border);
  color: var(--text-secondary);
}

/* Vue liste des prochains posts */
.calendar-list.hidden {
  display: none;
}

.upcoming-posts {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.upcoming-post-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.upcoming-post-item:hover {
  background: var(--bg);
}

.upcoming-post-item:last-child {
  border-bottom: none;
}

.upcoming-date {
  min-width: 60px;
  text-align: center;
}

.upcoming-date-day-letter {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upcoming-date-day {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.upcoming-date-month {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.upcoming-post-info {
  flex: 1;
}

.upcoming-post-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.upcoming-post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upcoming-post-type {
  font-size: 12px;
  color: var(--text-secondary);
}

.upcoming-post-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.upcoming-post-status.draft {
  background: #f0f0f0;
  color: #666;
}

.upcoming-post-status.validated {
  background: #e3f2fd;
  color: #1976d2;
}

.upcoming-post-status.ready {
  background: #fff3e0;
  color: #f57c00;
}

.upcoming-post-status.published {
  background: #e8f5e9;
  color: #388e3c;
}

.upcoming-post-actions {
  display: flex;
  gap: 8px;
}

.btn-edit-small, .btn-unschedule {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit-small:hover {
  background: var(--bg);
  border-color: var(--accent);
}

.btn-unschedule:hover {
  border-color: #dc3545;
  color: #dc3545;
}

.upcoming-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.upcoming-empty p {
  margin: 0 0 8px 0;
}

/* Section de planification dans l'éditeur */
.scheduling-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.scheduling-section.scheduled {
  background: #fef3c7;
  border: 1px solid #f59e0b;
}

.scheduling-section.published {
  background: #dcfce7;
  border: 1px solid #22c55e;
}

.schedule-icon {
  font-size: 20px;
}

.schedule-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.btn-add-schedule,
.btn-change-schedule {
  padding: 8px 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-schedule:hover,
.btn-change-schedule:hover {
  background: #7A654A;
}

.btn-remove-schedule {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-schedule:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: #fff5f5;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.btn-close,
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-close:hover,
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#editor-status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}
#editor-status-badge.draft { background: rgba(115, 115, 115, 0.15); color: #666; }
#editor-status-badge.validated { background: rgba(245, 158, 11, 0.15); color: #b45309; }
#editor-status-badge.ready { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
#editor-status-badge.published { background: rgba(34, 197, 94, 0.15); color: #15803d; }

.btn-reset-draft {
  font-size: 13px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--text-secondary);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset-draft:hover {
  background: var(--bg);
  border-color: var(--text);
  color: var(--text);
}

.btn-reset-draft.hidden {
  display: none;
}

.close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 8px;
}

.close-btn:hover {
  background: var(--bg);
}

/* Editor */
.editor-container {
  display: grid;
  grid-template-columns: 1fr 550px;
  flex: 1;
  overflow: hidden;
}

.slides-editor {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.slide-editor {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.slide-editor:hover {
  background: var(--bg-hover);
}

.slide-editor.active {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.slide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.slide-header h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.slide-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-slide-colors,
.btn-shuffle-blobs {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-slide-colors:hover,
.btn-shuffle-blobs:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.btn-slide-colors.expanded {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Color Picker Expansion in Editor */
.color-picker-row-container {
  position: relative;
}

.color-picker-expanded-row {
  display: none;
  position: fixed;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 200px;
  max-width: 320px;
}

.color-picker-expanded-row.visible {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-picker-expanded-row .color-option {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.15s;
}

.color-picker-expanded-row .color-option:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-picker-expanded-row .color-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* For quote color pairs */
.color-picker-expanded-row .color-pair-option {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(0,0,0,0.03);
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.color-picker-expanded-row .color-pair-option:hover {
  background: rgba(0,0,0,0.08);
}

.color-picker-expanded-row .color-pair-option.selected {
  background: var(--accent-light);
  border-color: var(--accent);
}

.color-picker-expanded-row .color-pair-option .pair-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

.color-picker-section-label {
  width: 100%;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.color-picker-section-label:not(:first-child) {
  margin-top: 10px;
}

.color-picker-section-label:not(:first-child) {
  margin-top: 10px;
}

/* AI Suggest Button */
.btn-suggest-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  margin-left: auto;
}

.btn-suggest-content:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-suggest-content:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spell Check Slide Button */
.btn-spellcheck-slide {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

.btn-spellcheck-slide:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* AI Suggest Description Button */
.btn-suggest-description {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  margin-left: auto;
}

.btn-suggest-description:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-suggest-description:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Post Title Section */
.post-title-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.post-title-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-title-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  transition: all 0.2s ease;
}

.post-title-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.15);
}

.post-title-input::placeholder {
  color: #a0a0a0;
  font-weight: 400;
}

/* Generate Full Post Section */
.generate-full-post-section {
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
  border: 2px dashed #667eea;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-generate-full-post {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-generate-full-post:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-generate-full-post:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-generate-full-post .btn-icon {
  font-size: 18px;
}

.generate-hint {
  color: #667eea;
  font-size: 13px;
  opacity: 0.8;
}

/* Empty post - theme input section */
/* Theme input row */
.generate-theme-row {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: flex-start;
}

.ai-generation-theme {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  border: 2px solid #d0d5ff;
  border-radius: 8px;
  background: white;
  resize: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.ai-generation-theme:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.ai-generation-theme::placeholder {
  color: #a0a0a0;
}

.btn-random-theme {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.btn-random-theme:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}

.btn-random-theme:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-random-theme .btn-icon {
  font-size: 16px;
}

/* Per-paragraph regenerate button */
.btn-regenerate-paragraph {
  background: transparent;
  border: 1px solid #e0e0e0;
  color: #667eea;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-regenerate-paragraph:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  transform: scale(1.1);
}

.btn-regenerate-paragraph:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Field with regenerate layout */
.field-with-regenerate .field-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.field-with-regenerate .field-label {
  margin-bottom: 0;
}

.slide-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-group-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.field-group.field-small {
  width: 80px;
  flex-shrink: 0;
}

.field-group.field-grow {
  flex: 1;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.field-input {
  min-height: 80px;
}

/* Séparateur entre paragraphe intro et les paires sous-titre/paragraphe */
.field-separator {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Textarea pour les posts Réel (1idee) - hauteur adaptée à la preview */
.type-1idee textarea.field-input {
  min-height: 500px;
  font-size: 16px;
  line-height: 1.6;
}

/* Textarea pour les posts Story - légèrement plus grand (+50%) */
.story-textarea {
  min-height: 120px !important;
}

/* Color picker pour story */
.color-picker-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-picker-input {
  width: 50px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

.color-hex-input {
  width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: monospace;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

/* Bouton supprimer slide */
.btn-delete-slide {
  padding: 4px 10px;
  background: #e74c3c;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete-slide:hover {
  background: #c0392b;
}

/* Section ajouter slide (story) */
.add-slide-section {
  padding: 16px;
  margin-top: 8px;
}

.btn-add-slide {
  display: block;
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-slide:hover {
  background: rgba(139, 115, 85, 0.1);
  border-style: solid;
}

/* Bouton d'ajout de paragraphe (posts thème) */
.btn-add-paragraph {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-paragraph:hover:not(.disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139, 115, 85, 0.05);
}

.btn-add-paragraph.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Paragraphe avec bouton supprimer (punchline-long) */
.paragraph-with-delete {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.paragraph-with-delete > .field-group,
.paragraph-with-delete > .field-with-fontsize {
  flex: 1;
}

.btn-delete-paragraph {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-top: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid #e74c3c;
  border-radius: 6px;
  color: #e74c3c;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-delete-paragraph:hover {
  background: #e74c3c;
  color: white;
}

/* Paires de champs avec bouton supprimer */
.field-pair {
  position: relative;
  border-left: 3px solid var(--accent-light);
  padding-left: 12px;
  margin-bottom: 8px;
}

.field-group.with-delete {
  position: relative;
}

.btn-delete-pair {
  width: 20px;
  height: 20px;
  padding: 0;
  background: var(--error);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.btn-delete-pair:hover {
  opacity: 1;
}

/* Font size controls */
.field-with-fontsize {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-label-row .field-label {
  flex: 1;
}

.fontsize-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fontsize-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.15s;
}

.fontsize-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.fontsize-btn:active {
  transform: scale(0.95);
}

.fontsize-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
}

.fontsize-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.fontsize-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.fontsize-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.fontsize-value {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}

/* Toggle couleur du gras */
.bold-color-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-main);
  border-radius: 6px;
}

.bold-color-toggle .toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.bold-color-toggle .toggle-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.bold-color-toggle .toggle-btn:hover {
  border-color: var(--accent);
}

.bold-color-toggle .toggle-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Description Instagram editor */
.description-editor {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 2px solid var(--accent-light);
  margin-top: 16px;
}

.description-editor .slide-header h3 {
  color: var(--accent);
}

.description-input {
  min-height: 150px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.description-preview {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.description-preview-header {
  background: var(--bg);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.description-preview-content {
  padding: 12px;
  background: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #262626;
  max-height: 200px;
  overflow-y: auto;
}

.desc-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.desc-hashtag {
  color: #00376b;
}

.desc-placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

/* Preview panel */
.preview-panel {
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
}

.preview-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden; /* For overflow detection */
}

#slide-counter {
  font-size: 16px;
  font-weight: 500;
  min-width: 40px;
  text-align: center;
}

.preview-nav-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.preview-nav-btn:hover {
  background: var(--bg);
  border-color: var(--accent);
}

.preview-nav-btn:active {
  background: var(--accent-light);
}

/* Boutons numérotés pour navigation slides */
.slide-num-btn {
  width: 36px;
  height: 36px;
  min-width: 36px; /* Prevent shrinking */
  flex-shrink: 0; /* Trigger overflow instead of compress */
  border: 2px solid var(--border);
  background: var(--bg-card);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
  margin: 0 2px;
}

.slide-num-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.slide-num-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slide-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.preview-frame {
  flex: 1;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Wrapper pour le scale - dimensions calculées par JS */
.preview-frame .iframe-wrapper {
  position: relative;
  /* width et height définis par JS via --preview-scale */
  width: calc(1080px * var(--preview-scale, 0.5));
  height: calc(1350px * var(--preview-scale, 0.5));
}

/* Preview iframe - taille native avec transform dynamique */
.preview-frame iframe {
  width: 1080px;
  height: 1350px;
  border: none;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  background: #F9F0E3;
  transform: scale(var(--preview-scale, 0.5));
  -webkit-transform: scale(var(--preview-scale, 0.5));
  transform-origin: top left;
  -webkit-transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}

/* Modal footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.save-status {
  font-size: 13px;
  color: var(--success);
}

.save-status.saving {
  color: var(--warning);
}

.footer-actions {
  display: flex;
  gap: 12px;
}

.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #7A654A;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c82333;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #218838;
}

.btn-info {
  background: var(--info);
  color: white;
}

.btn-info:hover:not(:disabled) {
  background: #2563eb;
}

.btn-icon {
  font-size: 16px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

/* Mobile toggle button */
.mobile-toggle {
  display: none;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  background: var(--bg);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  gap: 6px;
  align-items: center;
  color: var(--accent);
  font-weight: 500;
}

.mobile-toggle .toggle-icon {
  font-size: 16px;
}

/* Mobile footer toggle */
.footer-toggle {
  display: none;
  width: 100%;
  padding: 8px;
  border: none;
  background: var(--bg);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
}

/* Quick actions - hidden on desktop */
.footer-quick {
  display: none;
}

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

  .posts-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    top: 103px;
  }

  .posts-header-right {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  .type-select {
    flex: 1;
  }

  .filters {
    flex-wrap: wrap;
  }

  /* Gallery: 2 colonnes sur tablette */
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* List view tablet adjustments */
  .posts-list-table {
    font-size: 13px;
  }

  .posts-list-table th,
  .posts-list-table td {
    padding: 10px 12px;
  }

  /* Hide less important columns on tablet */
  .col-type,
  .post-list-type {
    display: none;
  }

  .col-date-updated,
  .post-list-date-updated {
    display: none;
  }

  /* Calendar responsive */
  .calendar-main {
    grid-template-columns: 1fr;
  }

  .calendar-left {
    padding: 16px;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    padding: 6px 4px;
    font-size: 13px;
  }

  .day-post {
    font-size: 9px;
    padding: 1px 3px;
  }

  /* Panneau d'affectation en modal sur mobile */
  .assign-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-radius: 20px 20px 0 0;
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 500;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  }

  .assign-panel.active {
    transform: translateY(0);
  }

  .close-assign-panel {
    display: block;
  }

  .assign-panel-header {
    padding: 12px 16px;
  }

  .assign-panel-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
  }

  .assign-panel-content {
    padding: 16px;
    max-height: calc(70vh - 60px);
  }

  .assign-type-btn {
    padding: 12px 8px;
    font-size: 12px;
  }

  .available-posts {
    max-height: 200px;
  }

  /* Vue liste responsive */
  .upcoming-post-item {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
  }

  .upcoming-post-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .editor-container {
    grid-template-columns: 1fr;
    position: relative;
  }

  /* Mobile: hide header toggle button (already in footer) */
  .mobile-toggle {
    display: none;
  }

  /* Mobile header compact */
  .modal-header {
    padding: 12px 16px;
  }

  .modal-header h2 {
    font-size: 16px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Mobile: hide preview by default, show form */
  .preview-panel {
    display: none !important;
  }

  .slides-editor {
    display: flex !important;
  }

  /* Textarea Réel sur mobile - hauteur min cohérente avec l'écran */
  .type-1idee textarea.field-input {
    min-height: 60vh;
  }

  /* When preview mode is active on mobile */
  .editor-container.mobile-preview .preview-panel {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 300px;
  }

  .editor-container.mobile-preview .preview-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    overflow: auto;
  }

  .editor-container.mobile-preview .slides-editor {
    display: none !important;
  }

  /* Preview frame scaling for mobile - use transform for Safari compatibility */
  .editor-container.mobile-preview .preview-frame {
    width: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .editor-container.mobile-preview .preview-frame .iframe-wrapper {
    width: calc(1080px * var(--mobile-scale, 0.35));
    height: calc(1350px * var(--mobile-scale, 0.35));
    position: relative;
    flex-shrink: 0;
  }

  .editor-container.mobile-preview .preview-frame iframe {
    width: 1080px;
    height: 1350px;
    border: none;
    transform: scale(var(--mobile-scale, 0.35));
    -webkit-transform: scale(var(--mobile-scale, 0.35));
    transform-origin: top left;
    -webkit-transform-origin: top left;
    position: absolute;
    top: 0;
    left: 0;
  }

  .modal-content {
    max-height: 100vh;
    border-radius: 0;
  }

  /* Mobile footer - compact */
  .modal-footer {
    padding: 8px 12px;
    flex-direction: column;
    gap: 8px;
  }

  .footer-left {
    display: none;
  }

  .footer-toggle {
    display: block !important;
  }

  .footer-actions {
    display: none !important;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }

  .footer-actions.expanded {
    display: flex !important;
  }

  .footer-actions .btn {
    padding: 8px 10px;
    font-size: 12px;
    flex: 1;
    min-width: 45%;
    justify-content: center;
  }

  .footer-actions .btn-icon {
    font-size: 14px;
  }

  /* Quick actions always visible */
  .footer-quick {
    display: flex !important;
    gap: 8px;
    width: 100%;
  }

  .footer-quick .btn {
    flex: 1;
    justify-content: center;
  }
}

/* Mobile list view: card layout */
@media (max-width: 480px) {
  .posts-list-table,
  .posts-list-table thead,
  .posts-list-table tbody,
  .posts-list-table tr,
  .posts-list-table th,
  .posts-list-table td {
    display: block;
  }

  .posts-list-table thead {
    display: none;
  }

  .post-list-row {
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .posts-list-table td {
    padding: 0;
    border: none;
  }

  .post-list-badge {
    order: 1;
  }

  .post-list-name {
    order: 2;
    flex: 1;
    min-width: 150px;
  }

  .post-list-status {
    order: 3;
  }

  .post-list-type {
    display: none;
  }

  .post-list-date {
    order: 4;
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
  }

  .post-list-date-updated {
    display: none;
  }

  /* Hide view toggle on very small screens */
  #gallery-view-toggle {
    display: none;
  }
}

/* Small phones: ajustements */
@media (max-width: 400px) {
  .main {
    padding: 12px;
  }

  .posts-grid {
    gap: 8px;
  }

  .post-info {
    padding: 10px;
  }

  .post-title {
    font-size: 14px;
  }

  .post-badge {
    font-size: 10px;
    padding: 2px 6px;
    top: 8px;
    left: 8px;
  }

  .post-status-label {
    font-size: 9px;
    padding: 2px 6px;
    bottom: 8px;
    right: 8px;
  }
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  pointer-events: auto;
}

.toast.success {
  background: #16a34a;
}

.toast.info {
  background: #2563eb;
}

.toast.warning {
  background: #d97706;
}

.toast.error {
  background: #dc2626;
}

.toast.hiding {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  font-size: 16px;
}

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

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ====================================================
   SETTINGS MODAL
   ==================================================== */

.nav-btn-settings {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
}

.nav-btn-settings:hover {
  background: var(--bg);
  border-color: var(--accent);
}

.settings-modal {
  z-index: 1100;
}

.settings-content {
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
}

.settings-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg);
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--text);
}

.settings-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

.settings-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.export-status {
  display: inline-block;
  margin-left: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.export-status.success {
  color: #22c55e;
}

.export-status.error {
  color: #ef4444;
}

.color-group {
  margin-bottom: 16px;
}

.color-group:last-child {
  margin-bottom: 0;
}

.color-group-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.color-square {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  border: 2px solid rgba(0,0,0,0.1);
  transition: all 0.15s;
}

.color-square:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-square .color-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.color-square .color-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-square:hover .color-delete {
  opacity: 1;
}

.color-add {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Color pairs (quote/text) */
.color-pairs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.color-pair {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(0,0,0,0.03);
  position: relative;
}

.color-pair:hover {
  background: rgba(0,0,0,0.06);
}

.color-pair .color-square {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.color-pair .pair-separator {
  color: var(--text-secondary);
  font-size: 12px;
  opacity: 0.5;
}

.color-pair .pair-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-pair:hover .pair-delete {
  opacity: 1;
}

.settings-footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

/* ====================================================
   BIN MODAL (Corbeille)
   ==================================================== */

.bin-modal {
  z-index: 1100;
}

.bin-content {
  max-width: 500px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.bin-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.bin-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.bin-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.bin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.bin-item:last-child {
  margin-bottom: 0;
}

.bin-item-info {
  flex: 1;
}

.bin-item-title {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.bin-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.bin-item-actions {
  display: flex;
  gap: 8px;
}

.bin-item-actions button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-restore {
  background: var(--success);
  color: white;
  border: none;
}

.btn-restore:hover {
  background: #16a34a;
}

.btn-delete-permanent {
  background: transparent;
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

.btn-delete-permanent:hover {
  background: #e74c3c;
  color: white;
}

.bin-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-danger:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.nav-btn-bin {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.nav-btn-bin:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ====================================================
   HISTORY PANEL
   ==================================================== */

/* History panel - side drawer */
.history-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 340px;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 10002;
  display: flex;
  flex-direction: column;
}

.history-panel.open {
  transform: translateX(0);
}

.history-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
}

.history-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.history-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-close-btn:hover {
  background: var(--border);
}

.history-cloud-status {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.history-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.history-item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 20px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}

.history-item:last-child {
  border-left-color: transparent;
}

.history-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg-card);
}

.history-item.current::before {
  background: var(--success);
  width: 12px;
  height: 12px;
  left: -7px;
}

.history-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.history-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.history-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.history-compare-btn {
  margin-top: 8px;
  padding: 6px 12px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}

.history-compare-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.history-changes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  margin-bottom: 2px;
}

.history-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
  font-weight: 500;
}

.history-change-badge.modified {
  background: #fff3cd;
  color: #856404;
}

.history-change-badge.added {
  background: #d4edda;
  color: #155724;
}

.history-change-badge.deleted {
  background: #f8d7da;
  color: #721c24;
}

.history-no-changes {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================
   COMPARE OVERLAY (side-by-side preview)
   ============================================ */

.compare-overlay {
  display: none;
  flex-direction: column;
  background: var(--bg);
  flex: 1;
  min-height: 0;
}

.compare-overlay.visible {
  display: flex;
}

.compare-overlay.visible + .editor-container {
  display: none;
}

.compare-top {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 2px;
  background: var(--border);
  overflow: hidden;
}

.compare-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  min-width: 0;
}

.compare-pane-header {
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.compare-pane:first-child .compare-pane-title {
  color: var(--accent);
}

.compare-pane:last-child .compare-pane-title {
  color: var(--text-secondary);
}

.compare-pane-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 0;
  overflow: hidden;
}

/* Left pane content (current) - will be replaced - light red */
.compare-pane:first-child .compare-pane-content {
  border: 20px solid #fcdddd;
}

/* Right pane content (snapshot) - source to restore from - light green */
.compare-pane:last-child .compare-pane-content {
  border: 20px solid #e0f3e5;
}

.compare-frame-wrapper {
  --compare-scale: 0.4;
  width: calc(1080px * var(--compare-scale));
  height: calc(1350px * var(--compare-scale));
  position: relative;
  flex-shrink: 0;
}

.compare-frame {
  width: 1080px;
  height: 1350px;
  border: none;
  border-radius: calc(8px / var(--compare-scale));
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: white;
  transform: scale(var(--compare-scale));
  transform-origin: top left;
}

.compare-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.compare-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-nav button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}

.compare-nav button:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

#compare-nav-label {
  font-size: 13px;
  font-weight: 500;
  min-width: 80px;
  text-align: center;
}

.compare-slides-list {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.compare-slide-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all 0.15s;
}

.compare-slide-chip:hover {
  border-color: var(--accent);
}

.compare-slide-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.compare-slide-chip.unchanged {
  opacity: 0.5;
}

.compare-slide-chip.modified {
  border-color: #e67e22;
  background: #fef5e7;
}

.compare-slide-chip.modified.active {
  background: #e67e22;
}

.compare-slide-chip.deleted {
  border-color: #e74c3c;
  background: #fdedec;
}

.compare-slide-chip.deleted.active {
  background: #e74c3c;
}

.compare-slide-chip.added {
  border-color: #27ae60;
  background: #e8f8f0;
}

.compare-slide-chip input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* Hint: show arrow when checkbox is checked (restore from right → left) */
.compare-slide-chip .restore-hint {
  display: none;
  font-size: 10px;
  opacity: 0.7;
}

.compare-slide-chip input[type="checkbox"]:checked ~ .restore-hint {
  display: inline;
}

/* Separator between current and deleted slides */
.compare-slides-separator {
  display: flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

.compare-slides-separator::before {
  content: '';
  width: 1px;
  height: 16px;
  background: var(--border);
  margin-right: 8px;
}

/* Deleted slide chip with restore functionality */
.compare-slide-chip.deleted .deleted-icon {
  font-size: 10px;
  opacity: 0.7;
}

.compare-slide-chip.deleted .restore-deleted-btn {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.compare-slide-chip.deleted .restore-deleted-btn:hover {
  background: var(--accent-dark, #2563eb);
  transform: scale(1.05);
}

/* Position picker dropdown for deleted slide restoration */
.position-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.position-picker {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 320px;
  width: 90%;
}

.position-picker h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: var(--text);
}

.position-picker .picker-subtitle {
  margin: 0 0 16px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.position-picker .positions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.position-picker .position-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.position-picker .position-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.position-picker .position-btn.original {
  border-color: var(--accent);
  background: var(--accent-light);
}

.position-picker .position-btn.original::after {
  content: ' ✓';
  font-size: 10px;
  opacity: 0.7;
}

.position-picker .picker-cancel {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.position-picker .picker-cancel:hover {
  background: var(--bg-secondary);
}

.compare-diff-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.compare-diff-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.compare-diff-toggle.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.compare-restore-hint {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.compare-restore-hint span {
  font-size: 12px;
}

.compare-bottom-actions {
  display: flex;
  gap: 8px;
}

.compare-bottom-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-close-compare {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-close-compare:hover {
  background: var(--bg-hover);
}

.btn-restore-selection {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: white;
}

.btn-restore-selection:hover {
  background: #7A654A;
}

.btn-restore-all {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-restore-all:hover {
  background: var(--bg-hover);
}

/* Compare overlay responsive */
@media (max-width: 1200px) {
  .compare-frame-wrapper {
    --compare-scale: 0.35;
  }
}

@media (max-width: 900px) {
  .compare-frame-wrapper {
    --compare-scale: 0.28;
  }
}

@media (max-width: 768px) {
  .compare-frame-wrapper {
    --compare-scale: 0.22;
  }

  .compare-pane-content {
    padding: 8px;
  }

  .compare-bottom {
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
  }

  .compare-bottom-actions {
    width: 100%;
  }

  .compare-bottom-actions button {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Compare view (in history panel - legacy) */
.history-compare {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.history-compare.visible {
  display: flex;
}

.compare-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
}

.compare-header button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 4px;
}

.compare-header button:hover {
  background: var(--accent-light);
}

.compare-header span {
  font-size: 14px;
  font-weight: 500;
}

.compare-slides {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.compare-slide {
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.compare-slide.deleted {
  border-color: #FFCDD2;
  background: #FFEBEE;
}

.compare-slide.modified {
  border-color: #FFE082;
  background: #FFF8E1;
}

.compare-slide.unchanged {
  opacity: 0.6;
}

.compare-slide.added {
  border-color: #C8E6C9;
  background: #E8F5E9;
}

.compare-slide label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.compare-slide input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.compare-slide input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.slide-label-text {
  font-size: 14px;
  font-weight: 500;
}

.slide-status {
  margin-left: auto;
  font-size: 12px;
}

.changed-fields, .deleted-warning {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 26px;
}

.compare-preview-toggle {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.preview-snapshot-btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px dashed var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.preview-snapshot-btn:hover {
  background: var(--accent);
  color: white;
  border-style: solid;
}

.compare-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  background: var(--bg);
}

.compare-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.compare-actions button:first-child {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.compare-actions button:first-child:hover {
  background: #7A654A;
}

.compare-actions button:last-child {
  background: var(--bg-card);
}

.compare-actions button:last-child:hover {
  background: var(--bg-hover);
}

/* Toggle button in modal header */
.history-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.history-toggle:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* History toast notification */
.history-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10003;
  pointer-events: none;
}

.history-toast.visible {
  opacity: 1;
}

/* Empty history state */
.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.history-empty p {
  margin: 0;
  font-size: 14px;
}

/* Mobile responsive */
@media (max-width: 1024px) {
  .history-panel {
    width: 100%;
    max-width: 400px;
  }
}

/* ====================================================
   SPELL CHECK OVERLAY
   ==================================================== */

.spellcheck-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.spellcheck-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.spellcheck-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10010;
  display: none;
  flex-direction: column;
}

.spellcheck-overlay.open {
  display: flex;
}

.spellcheck-overlay-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.spellcheck-overlay-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.spellcheck-overlay-status {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
}

.spellcheck-overlay-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spellcheck-overlay-close:hover {
  background: var(--border);
}

.spellcheck-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.spellcheck-overlay-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

/* Loading state */
.spellcheck-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: white;
}

.spellcheck-loading-spinner {
  font-size: 48px;
  animation: spin 1s linear infinite;
}

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

.spellcheck-loading-text {
  margin-top: 16px;
  font-size: 16px;
}

/* No corrections found */
.spellcheck-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: white;
}

.spellcheck-success-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.spellcheck-success-text {
  font-size: 18px;
}

/* Correction row - side by side */
.correction-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.correction-row.accepted {
  opacity: 0.5;
  background: #f0fdf4;
}

.correction-row.rejected {
  display: none;
}

.correction-column {
  display: flex;
  flex-direction: column;
}

.correction-column-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.correction-location {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
  font-weight: 500;
}

.correction-text {
  font-size: 14px;
  line-height: 1.6;
  padding: 12px;
  border-radius: 8px;
  word-break: break-word;
  white-space: pre-wrap;
}

.correction-text.original {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.correction-text.corrected {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.correction-text .diff-removed {
  background: #fca5a5;
  text-decoration: line-through;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

.correction-text .diff-added {
  background: #86efac;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

.correction-explanation {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
}

.correction-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 100px;
}

.btn-accept-correction {
  background: var(--success);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-accept-correction:hover {
  background: #16a34a;
}

.btn-reject-correction {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reject-correction:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .correction-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .correction-actions {
    flex-direction: row;
    min-width: auto;
  }
}

/* ============================================================================
   POST LIBRE editor
   ============================================================================ */

.slide-editor-libre textarea.libre-content-textarea {
  min-height: 320px;
  font-size: 15px;
  line-height: 1.6;
  border-radius: 0 0 8px 8px;
  border-top: none;
}

.libre-content-field {
  margin-top: 12px;
}

.libre-format-toolbar {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.libre-format-btn {
  width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: 'Georgia', serif;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.libre-format-btn:hover {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}

.libre-format-btn b { font-weight: 700; }
.libre-format-btn i { font-style: italic; }
.libre-format-btn u { text-decoration: underline; }

.slide-editor-libre .hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
}

.libre-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: var(--bg-main);
  border-radius: 6px;
}

.libre-toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.libre-toggle-group .toggle-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 110px;
}

.libre-toggle-btn,
.regen-style-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.libre-toggle-btn:hover,
.regen-style-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.libre-toggle-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.regen-style-btn {
  margin-left: auto;
}

.regen-style-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
