/* ================================================================
   CALENDRIER STUDIO — style.css
   Premium dark-mode calendar creator + A4 landscape print styles
   ================================================================ */

/* ================================================================
   DESIGN TOKENS
   ================================================================ */
:root {
  /* Editor palette */
  --ed-bg: #080812;
  --ed-sidebar-bg: rgba(12, 12, 24, 0.98);
  --ed-surface: rgba(255, 255, 255, 0.035);
  --ed-surface-hover: rgba(255, 255, 255, 0.06);
  --ed-border: rgba(255, 255, 255, 0.08);
  --ed-border-hover: rgba(255, 255, 255, 0.18);
  --ed-text-1: #e8eaf6;
  --ed-text-2: #94a3b8;
  --ed-text-3: #4a5568;
  --ed-purple: #7c3aed;
  --ed-blue: #3b82f6;
  --ed-input-bg: rgba(255, 255, 255, 0.05);
  --ed-input-border: rgba(255, 255, 255, 0.1);
  --ed-input-focus: rgba(124, 58, 237, 0.5);
  --ed-sidebar-w: 330px;
  --ed-header-h: 58px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* ================================================================
   RESET
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ================================================================
   BODY & APP LAYOUT
   ================================================================ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ed-bg);
  color: var(--ed-text-1);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ================================================================
   HEADER
   ================================================================ */
#app-header {
  height: var(--ed-header-h);
  flex-shrink: 0;
  background: rgba(8, 8, 18, 0.96);
  border-bottom: 1px solid var(--ed-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(59,130,246,0.2));
  border: 1px solid rgba(124,58,237,0.3);
  color: #a78bfa;
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #c4b5fd, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-center {
  display: flex;
  align-items: center;
}

#header-year-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--ed-text-2);
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: 20px;
  padding: 4px 14px;
  letter-spacing: 2px;
}

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

/* ================================================================
   WORKSPACE
   ================================================================ */
#workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
#sidebar {
  width: var(--ed-sidebar-w);
  flex-shrink: 0;
  background: var(--ed-sidebar-bg);
  border-right: 1px solid var(--ed-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: horizontal;
  min-width: 200px;
  max-width: 50vw;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

/* ================================================================
   SIDEBAR SECTIONS
   ================================================================ */
.sidebar-section {
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  border-radius: var(--radius-lg);
  overflow: visible;
  transition: border-color 0.2s;
}

.sidebar-section:hover {
  border-color: rgba(255,255,255,0.13);
}

.section-title {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ed-text-2);
  background: none;
  border: none;
  border-bottom: 1px solid var(--ed-border);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  transition: background 0.2s, color 0.2s;
}

.section-title:hover { background: var(--ed-surface-hover); color: var(--ed-text-1); }

.sec-icon {
  display: flex;
  align-items: center;
  color: var(--ed-purple);
  opacity: 0.85;
}

.sec-chevron {
  margin-left: auto;
  transition: transform 0.25s ease;
  color: var(--ed-text-3);
}

.section-title[aria-expanded="false"] .sec-chevron {
  transform: rotate(-90deg);
}

.section-content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.section-content.collapsed {
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
}

/* ================================================================
   FORM FIELDS
   ================================================================ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--ed-text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.label-optional {
  font-size: 9px;
  color: var(--ed-text-3);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

input[type="text"],
input[type="number"],
select {
  background: var(--ed-input-bg);
  border: 1px solid var(--ed-input-border);
  border-radius: var(--radius-sm);
  color: var(--ed-text-1);
  padding: 8px 11px;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--ed-input-focus);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

input[type="text"]::placeholder { color: var(--ed-text-3); }

/* ================================================================
   YEAR CONTROL
   ================================================================ */
.year-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.year-control input[type="number"] {
  text-align: center;
  flex: 1;
  -moz-appearance: textfield;
}

.year-control input::-webkit-inner-spin-button,
.year-control input::-webkit-outer-spin-button { -webkit-appearance: none; }

.year-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--ed-border);
  color: var(--ed-text-1);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.year-btn:hover { background: rgba(255,255,255,0.12); border-color: var(--ed-border-hover); }
.year-btn:active { transform: scale(0.93); }

/* ================================================================
   THEME SWATCHES
   ================================================================ */
.theme-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 4px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  background: none;
}

.theme-swatch:hover { border-color: rgba(255,255,255,0.2); transform: translateY(-1px); }

.theme-swatch.active {
  border-color: var(--ed-purple);
  background: rgba(124,58,237,0.1);
}

.swatch-preview {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.theme-swatch:hover .swatch-preview { transform: scale(1.08); box-shadow: 0 5px 16px rgba(0,0,0,0.4); }

.theme-swatch span {
  font-size: 9px;
  color: var(--ed-text-2);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ================================================================
   SELECT
   ================================================================ */
.select-input {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

select option { background: #1a1a2e; color: #e2e8f0; }

/* ================================================================
   TOGGLE SWITCHES
   ================================================================ */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toggle-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ed-text-1);
}

.toggle-desc {
  font-size: 11px;
  color: var(--ed-text-3);
}

.toggle-switch {
  position: relative;
  width: 38px;
  height: 21px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 10.5px;
  transition: background 0.3s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #c4c4d4;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

.toggle-switch input:checked + .toggle-slider { background: var(--ed-purple); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(17px); background: white; }

/* ================================================================
   PHOTO POOL
   ================================================================ */
.pool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pool-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ed-text-1);
}

.pool-subtitle {
  font-size: 11px;
  color: var(--ed-text-3);
  margin-top: 1px;
}

.btn-magic {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(59,130,246,0.3));
  border: 1px solid rgba(124,58,237,0.35);
  color: var(--ed-text-1);
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-magic:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(124,58,237,0.55), rgba(59,130,246,0.5));
  border-color: rgba(124,58,237,0.55);
  transform: translateY(-1px);
}

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

.dropzone {
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: all 0.2s;
  min-height: 72px;
}

.dropzone.drag-over {
  border-color: var(--ed-purple);
  background: rgba(124,58,237,0.08);
  box-shadow: 0 0 20px rgba(124,58,237,0.15) inset;
}

.dropzone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ed-text-3);
  font-size: 11px;
  text-align: center;
  padding: 4px 0;
}

.dropzone-label svg { color: var(--ed-text-3); opacity: 0.6; }

.dropzone-actions {
  display: flex;
  gap: 7px;
  justify-content: center;
}

.dropzone-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--ed-input-bg);
  border: 1px solid var(--ed-input-border);
  color: var(--ed-text-2);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.dropzone-btn:hover {
  background: rgba(124,58,237,0.18);
  border-color: rgba(124,58,237,0.45);
  color: var(--ed-text-1);
}

.dropzone-btn-folder {
  background: rgba(14,116,144,0.12);
  border-color: rgba(14,116,144,0.3);
  color: #7dd3fc;
}

.dropzone-btn-folder:hover {
  background: rgba(14,116,144,0.25);
  border-color: rgba(14,116,144,0.55);
  color: #bae6fd;
}

.dropzone-hint {
  font-size: 10px;
  color: var(--ed-text-3);
  opacity: 0.7;
}

.pool-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.pool-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.2s, border-color 0.2s;
}

.pool-item:hover { transform: scale(1.05); border-color: rgba(124,58,237,0.5); }

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

.pool-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,0.75);
  border: none;
  color: white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1;
}

.pool-item:hover .pool-remove { opacity: 1; }

/* ================================================================
   PHOTOS SUB HEADER
   ================================================================ */
.photos-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ed-text-3);
  margin-top: 2px;
}

.btn-text-sm {
  font-size: 10px;
  color: var(--ed-text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: none;
  border: none;
  transition: color 0.2s, background 0.2s;
}

.btn-text-sm:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* ================================================================
   MONTH PHOTO BUTTONS
   ================================================================ */
.month-photos-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.month-photo-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 8px;
}

.month-photo-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ed-text-2);
  margin-bottom: 2px;
}

.month-photo-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.month-photo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--ed-input-bg);
  border: 1.5px solid var(--ed-input-border);
  border-radius: var(--radius-sm);
  padding: 6px 4px 5px;
  color: var(--ed-text-1);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.month-photo-group.active-group {
  border-color: rgba(124,58,237,0.3);
  background: rgba(124,58,237,0.03);
}

.month-photo-btn:hover {
  border-color: rgba(124,58,237,0.5);
  background: rgba(124,58,237,0.08);
  transform: translateY(-1px);
}

.photo-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  background-size: cover;
  background-position: center;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.photo-thumb.has-photo { border: 1px solid rgba(124,58,237,0.3); }

.photo-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(124,58,237,0.25);
  opacity: 0;
  transition: opacity 0.2s;
}

.month-photo-btn:hover .photo-thumb::after { opacity: 1; }

.photo-plus {
  font-size: 15px;
  color: var(--ed-text-3);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none;
  transition: opacity 0.2s;
}

.photo-thumb.has-photo ~ .photo-plus { opacity: 0; }

.photo-month-label {
  font-size: 8.5px;
  color: var(--ed-text-2);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: white;
  border: none;
  box-shadow: 0 3px 14px rgba(124,58,237,0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #4338ca);
  box-shadow: 0 5px 20px rgba(124,58,237,0.5);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

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

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--ed-text-1);
  border: 1px solid var(--ed-border);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--ed-border-hover);
}

/* ================================================================
   PREVIEW AREA
   ================================================================ */
#preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 40% at 70% 30%, rgba(79,70,229,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 30% 70%, rgba(14,116,144,0.04) 0%, transparent 60%),
    var(--ed-bg);
}

/* Navigation bar */
#preview-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--ed-border);
  flex-shrink: 0;
  background: rgba(8,8,18,0.5);
  backdrop-filter: blur(10px);
}

.nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--ed-surface);
  border: 1px solid var(--ed-border);
  color: var(--ed-text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(124,58,237,0.2);
  border-color: rgba(124,58,237,0.4);
}

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

#page-label {
  font-size: 12px;
  color: var(--ed-text-2);
  min-width: 210px;
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Preview wrapper + scaler */
#preview-wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

#preview-scaler {
  position: relative;
  flex-shrink: 0;
}

#preview-page-wrap {
  position: absolute;
  top: 0;
  left: 0;
}

#preview-page {
  width: 100%;
  height: 100%;
  transition: opacity 0.15s ease, transform 0.18s ease;
}

/* Shadow behind preview */
#preview-scaler::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(59,130,246,0.1));
  filter: blur(20px);
  z-index: -1;
}

/* Page dots */
#page-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.page-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  transition: all 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.page-dot:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.3);
}

.page-dot.active {
  background: var(--ed-purple);
  width: 20px;
  border-radius: 3.5px;
}

/* ================================================================
   TOAST NOTIFICATION
   ================================================================ */
#toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: rgba(22, 22, 42, 0.96);
  border: 1px solid rgba(124,58,237,0.35);
  color: var(--ed-text-1);
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(124,58,237,0.1);
  transform: translateY(12px);
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  pointer-events: none;
}

#toast.show { transform: translateY(0); opacity: 1; }

/* ================================================================
   EXPORT OVERLAY
   ================================================================ */
#export-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 18, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}

.export-modal {
  background: rgba(18, 18, 36, 0.98);
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: 20px;
  padding: 36px 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 320px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.export-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(124,58,237,0.2);
  border-top-color: var(--ed-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.export-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ed-text-1);
}

.export-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.export-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ed-purple), var(--ed-blue));
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.export-status {
  font-size: 12px;
  color: var(--ed-text-2);
}

/* ================================================================
   CALENDAR PAGE — shared (preview + print)
   ================================================================ */
.calendar-page {
  display: grid;
  overflow: hidden;
  background: #ffffff;
  position: relative;
  gap: 4mm; /* White breathing space between tiles */
  padding: 4mm; /* Outer breathing space */
  box-sizing: border-box;
}

.calendar-page.layout-landscape {
  width: 297mm;
  height: 210mm;
}

.calendar-page.layout-portrait {
  width: 210mm;
  height: 297mm;
}

/* Mode 2 Photos (Asymétrique) */
.calendar-page.layout-2-photos-0 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "photo1 photo1" "calendar photo2";
}
.calendar-page.layout-2-photos-1 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "calendar photo1" "photo2 photo1";
}
.calendar-page.layout-2-photos-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "photo2 calendar" "photo1 photo1";
}
.calendar-page.layout-2-photos-3 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "photo1 photo2" "photo1 calendar";
}

/* Mode 3 Photos (Classique) */
.calendar-page.layout-3-photos-0 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "photo1 photo2" "photo3 calendar";
}
.calendar-page.layout-3-photos-1 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "photo1 photo2" "calendar photo3";
}
.calendar-page.layout-3-photos-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "photo1 calendar" "photo2 photo3";
}
.calendar-page.layout-3-photos-3 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "calendar photo1" "photo2 photo3";
}

/* Mode 1 Photo (Pleine page) */
.calendar-page.layout-single {
  display: block;
  padding: 0;
}
.calendar-page.layout-single > [data-element-id="photo_0"] {
  width: 100%;
  height: 100%;
  border-radius: 0;
}
.calendar-page.layout-single .page-right {
  position: absolute;
  bottom: 8mm;
  right: 8mm;
  width: auto;
  max-width: 50%;
  border-radius: 6mm;
  padding: 6mm;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.calendar-page.layout-single [data-color-key] {
  cursor: pointer;
  transition: transform 0.1s ease, text-shadow 0.1s ease;
  display: inline-block; /* needed for transform */
}
.calendar-page.layout-single [data-color-key]:hover {
  transform: scale(1.15);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  position: relative;
  z-index: 10;
}

/* Photos inside the grid */
.calendar-page > [data-element-id="photo_0"] { border-radius: 6mm; }
.calendar-page > [data-element-id="photo_1"] { border-radius: 6mm; }
.calendar-page > [data-element-id="photo_2"] { border-radius: 6mm; }

.page-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 6mm;
}

.page-photo-empty {
  width: 100%;
  height: 100%;
  border-radius: 6mm;
}

/* Calendar corner */
.page-right {
  grid-area: calendar;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 6mm;
}

/* Calendar header — elegant, soft */
.cal-header {
  flex-shrink: 0;
  padding: 8mm 6mm 4mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1mm;
  text-align: center;
  opacity: var(--cal-text-opacity, 1.0);
}

.cal-header-line {
  height: 0px;
  margin: 0;
  display: none;
}

.cal-month-name {
  font-size: calc(20pt * var(--cal-font-scale, 1));
  font-weight: 300;
  letter-spacing: 4px;
  line-height: 1;
}

.cal-year-num {
  font-size: calc(9pt * var(--cal-font-scale, 1));
  font-weight: 400;
  letter-spacing: 6px;
  opacity: 0.6;
  margin-top: 2px;
}

/* Calendar body — soft spacing */
.cal-body {
  flex: 1;
  padding: 0 6mm 6mm;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  opacity: var(--cal-text-opacity, 1.0);
}

/* Calendar grid — clean, borderless */
.cal-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 2mm;
  table-layout: fixed;
}

.cal-grid thead tr th {
  font-size: calc(7pt * var(--cal-font-scale, 1));
  font-weight: 600;
  text-align: center;
  padding: 2mm 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: none;
  opacity: 0.7;
}

.cal-grid tbody tr td {
  text-align: center;
  vertical-align: middle;
  padding: 2mm 0.5mm;
  border: none;
  position: relative;
}

.cal-grid tbody tr:last-child td { border-bottom: none; }

.cal-empty { background: transparent; }

/* Weekend cell */
.cal-day-we { }

/* Holiday cell */
.cal-day-hd { background-color: var(--cal-hd-tint, transparent); }

.day-num {
  display: block;
  font-size: calc(13pt * var(--cal-font-scale, 1));
  font-weight: 300;
  line-height: 1;
}
.cal-day-hd .day-num { font-weight: 700; }

.hday-label {
  display: block;
  font-size: calc(5pt * var(--cal-font-scale, 1));
  font-weight: 600;
  margin-top: 0.5mm;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Calendar footer */
.cal-footer {
  padding: 2mm 7mm;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  opacity: var(--cal-text-opacity, 1.0);
}

.cal-footer-brand {
  font-size: 7pt;
  font-weight: 300;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  opacity: 0.35;
}

/* ================================================================
   POOL — FOLDER GROUPS
   ================================================================ */
.pool-folder-group {
  margin-bottom: 8px;
}

.pool-folder-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ed-text-2);
  padding: 4px 0 4px;
  border-bottom: 1px solid var(--ed-border);
  margin-bottom: 5px;
  letter-spacing: 0.4px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.pool-folder-name svg { flex-shrink: 0; opacity: 0.7; }

.pool-folder-count {
  margin-left: auto;
  font-size: 9px;
  color: var(--ed-text-3);
  font-weight: 400;
  flex-shrink: 0;
}

/* ================================================================
   COVER PAGE
   ================================================================ */
.cover-page {
  position: relative;
}

.cover-bg {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.cover-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}

.cover-content {
  padding: 14mm 16mm;
  max-width: 55%;
}

.cover-year-label {
  font-size: 9pt;
  font-weight: 400;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  margin-bottom: 5mm;
}

.cover-title {
  font-size: 34pt;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 4mm;
}

.cover-subtitle {
  font-size: 13pt;
  font-weight: 300;
  font-style: italic;
  color: rgba(255,255,255,0.8);
  margin-bottom: 7mm;
}

.cover-divider {
  width: 45mm;
  height: 1.5pt;
  border-radius: 1pt;
  margin-bottom: 6mm;
}

.cover-months-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cover-month-chip {
  font-size: 6pt;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

.cover-month-chip:not(:last-child)::after { content: ' ·'; }

/* ================================================================
   PREVIEW-ONLY ANIMATIONS (screen only)
   ================================================================ */
@media screen {
  #preview-page .calendar-page {
    animation: calPageIn 0.22s cubic-bezier(0.34, 1.2, 0.64, 1) both;
  }

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

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  html, body {
    margin: 0;
    padding: 0;
    overflow: visible;
    background: white;
  }

  #app,
  #toast,
  #export-overlay {
    display: none !important;
  }

  #print-output {
    display: block !important;
    position: static !important;
    width: auto !important;
    z-index: auto !important;
  }

  .calendar-page {
    width: 297mm;
    height: 210mm;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
    overflow: hidden;
    display: flex;
    flex-direction: row;
  }

  .calendar-page:last-child {
    page-break-after: avoid;
    break-after: auto;
  }
}

/* ================================================================
   PRINT OUTPUT — hidden in editor, shown in print & export
   ================================================================ */
#print-output {
  display: none;
}
/* ================================================================
   WYSIWYG EDITOR OVERLAYS
   ================================================================ */
.wysiwyg-element {
  position: relative;
}
.wysiwyg-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 2px dashed #3b82f6;
  pointer-events: none;
  z-index: 100;
  box-sizing: border-box;
}
.wysiwyg-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  pointer-events: auto;
  z-index: 101;
}
.wysiwyg-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.wysiwyg-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.wysiwyg-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.wysiwyg-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.wysiwyg-crop-mode {
  border-color: #f97316 !important;
  cursor: grab;
}
.wysiwyg-crop-mode:active {
  cursor: grabbing;
}
.wysiwyg-crop-mode .wysiwyg-handle {
  display: none; /* Hide handles in crop mode */
}

.wysiwyg-drag-area {
  position: absolute;
  top: 10%; left: 10%; right: 10%; bottom: 10%;
  cursor: move;
  pointer-events: auto;
  z-index: 101;
}

#right-sidebar {
  width: var(--ed-sidebar-w);
  resize: horizontal;
  overflow: auto;
  min-width: 200px;
  max-width: 50vw;
  direction: rtl; /* Puts the resize handle on the left side */
}
#right-sidebar > * {
  direction: ltr; /* Content remains left-to-right */
}

/* Alignment overrides */
.cal-align-left .cal-header { align-items: flex-start !important; text-align: left !important; }
.cal-align-left .cal-grid th, .cal-align-left .cal-grid td { text-align: left !important; }

.cal-align-right .cal-header { align-items: flex-end !important; text-align: right !important; }
.cal-align-right .cal-grid th, .cal-align-right .cal-grid td { text-align: right !important; }
