/* Calendar-view styles. Layered on top of shared.css.
   Faithful port of purina-post-calendar.html, minus:
     - "Edit colors" UI (admin-only, lives in admin panel)
     - "Download HTML" button
     - "Copy data as code" / "Reset to defaults" toolbar buttons */

/* ── HEADER OVERRIDES — title-block + project dates ────── */
.header-center .project-dates {
  font-size: 10px; font-weight: 500; letter-spacing: 2.5px;
  color: rgba(232,224,208,.45); text-transform: uppercase; margin-top: 5px;
}

/* ── LEGEND STRIP ──────────────────────────────────────── */
.legend-strip {
  background: #cfc8bd; padding: 9px 36px;
  border-bottom: 1px solid rgba(26,46,61,.08);
  display: flex; align-items: center; gap: 14px;
}
.legend-inline {
  flex: 1; display: flex; align-items: flex-start; gap: 0;
}
.legend-main {
  display: grid; grid-template-columns: repeat(5, max-content);
  gap: 7px 22px; align-items: center;
}
.legend-important {
  display: flex; flex-direction: column; gap: 5px;
  border-left: 1px solid rgba(26,46,61,.2);
  padding-left: 16px; margin-left: 24px;
}
.legend-imp-header {
  font-size: 7px; font-weight: 800; letter-spacing: 2.5px;
  text-transform: uppercase; color: rgba(26,46,61,.5);
  margin-bottom: 1px;
}
.legend-strip-label {
  font-size: 7px; font-weight: 800; letter-spacing: 2.5px;
  text-transform: uppercase; color: rgba(26,46,61,.4);
  flex-shrink: 0; padding-right: 14px;
  border-right: 1px solid rgba(26,46,61,.2);
}
.legend-item   { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 20px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.legend-label  {
  font-size: 9.5px; font-weight: 500; letter-spacing: .2px;
  color: rgba(26,46,61,.62);
}

/* ── CALENDAR GRID ─────────────────────────────────────── */
.calendar-section {
  margin-bottom: 32px; border-radius: 5px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.1), 0 4px 16px rgba(0,0,0,.06);
  position: relative;
}
.month-header {
  background: var(--beige); color: var(--navy); padding: 10px 18px;
  font-size: 11px; font-weight: 700; letter-spacing: 3.5px; text-transform: uppercase;
}
.calendar-grid {
  display: grid; grid-template-columns: .33fr 1fr 1fr 1fr 1fr 1fr .33fr;
  background: var(--border); gap: 1px;
}
.dow-header {
  background: var(--navy); color: rgba(232,224,208,.7); text-align: center;
  padding: 7px 4px; font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
}
.dow-header.weekend { background: #152534; color: rgba(232,224,208,.4); }

.day-cell {
  background: var(--white); min-height: 108px; position: relative;
  transition: background .12s; overflow: hidden; display: flex; flex-direction: column;
}
.day-cell.weekend    { background: #faf8f4; }
.day-cell.empty      { background: #f5f2ec; }
.day-cell.next-month         { background: #f2f5f9; }
.day-cell.next-month.weekend { background: #eef1f6; }
.day-cell.month-start        { border-left: 3px solid var(--beige); }
.month-pill {
  display: inline-block; font-size: 7px; font-weight: 700;
  letter-spacing: .9px; text-transform: uppercase;
  color: rgba(26,46,61,.5); background: rgba(26,46,61,.09);
  padding: 1px 4px; border-radius: 2px; margin-left: 4px;
  vertical-align: middle; line-height: 1.6;
}
.day-cell:not(.empty):hover { background: #f7f9fb; }
.day-cell.weekend:not(.empty):hover { background: #f2f0ea; }

/* Editor-only: show + button on hover */
body.editor-mode .day-cell:not(.empty):hover .cell-add-btn { opacity: 1; }

.shoot-banner {
  width: 100%; padding: 3px 7px; color: #fff;
  font-size: 7.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; flex-shrink: 0;
}
.shoot-banner:hover { filter: brightness(1.12); }

.cell-inner { padding: 5px 6px 5px; flex: 1; display: flex; flex-direction: column; }
.date-number {
  font-size: 12px; font-weight: 700; color: var(--navy);
  line-height: 1; margin-bottom: 5px;
}
.day-cell.weekend .date-number { color: rgba(26,46,61,.42); }
.activities { display: flex; flex-direction: column; gap: 2.5px; flex: 1; }

.activity-bar {
  border-radius: 2.5px; padding: 2.5px 5px; font-size: 8px; font-weight: 600;
  color: #fff; line-height: 1.35; word-break: break-word;
  transition: filter .1s; user-select: none;
}
.activity-bar:hover { filter: brightness(1.1); }
.activity-bar.dark-text { color: #1a2e3d; }

/* Editor-only: cursor + drag affordances */
body.editor-mode .activity-bar,
body.editor-mode .shoot-banner { cursor: pointer; }
body.editor-mode .activity-bar[draggable="true"],
body.editor-mode .shoot-banner[draggable="true"] { cursor: grab; }

.cell-add-btn {
  position: absolute; bottom: 5px; right: 5px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--navy); color: white; border: none;
  font-size: 14px; line-height: 1; display: flex; align-items: center;
  justify-content: center; cursor: pointer; opacity: 0;
  transition: opacity .15s, transform .1s; font-weight: 300; padding-bottom: 1px;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.cell-add-btn:hover { transform: scale(1.15); }
body:not(.editor-mode) .cell-add-btn { display: none; }

/* ── DRAG & DROP ───────────────────────────────────────── */
.is-dragging { opacity: .25 !important; pointer-events: none !important; }
.day-cell.drop-active:not(.empty) {
  background: #eaf0f6 !important;
  outline: 2px dashed rgba(26,46,61,.28); outline-offset: -3px;
}
.activity-bar.drop-above { box-shadow:  0 -2.5px 0 0 var(--navy); }
.activity-bar.drop-below { box-shadow:  0  2.5px 0 0 var(--navy); }

.day-cell.paste-target:not(.empty) {
  outline: 2px dashed rgba(26,46,61,.32); outline-offset: -3px;
  background: rgba(26,46,61,.04) !important;
}
.day-cell.drop-copy:not(.empty) {
  background: #eaf5ed !important;
  outline: 2px dashed rgba(29,106,57,.38); outline-offset: -3px;
}
.activity-bar.selected, .shoot-banner.selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--navy) !important;
}

/* ── BOTTOM TOOLBAR (editor hint strip) ────────────────── */
.bottom-toolbar {
  background: rgba(26,46,61,.04); border-top: 1px solid rgba(26,46,61,.08);
  padding: 8px 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
  font-size: 10.5px; color: rgba(26,46,61,.5);
}
.toolbar-hint strong { color: rgba(26,46,61,.7); }
body:not(.editor-mode) .bottom-toolbar { display: none; }

/* ── DELIVERABLES ──────────────────────────────────────── */
.deliverables-section {
  border-radius: 5px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
}
.deliverables-header {
  background: var(--navy); color: var(--beige); padding: 10px 18px;
  font-size: 10px; font-weight: 700; letter-spacing: 3.5px; text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
}
.dv-due-dates {
  display: flex; align-items: center; gap: 6px;
  font-size: 9px; font-weight: 500; letter-spacing: 1px;
  color: rgba(232,224,208,.55); text-transform: uppercase;
}
.dv-due-item { display: flex; align-items: center; gap: 5px; }
.dv-due-dot  { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dv-due-sep  { color: rgba(232,224,208,.25); font-size: 10px; }
.deliverables-grid {
  background: var(--white); display: grid;
}
.dv-col { display: flex; flex-direction: column; border-right: 1px solid rgba(26,46,61,.08); }
.dv-col:last-child { border-right: none; }
.dv-col-hd {
  padding: 7px 14px; font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: #fff;
  outline: none;
}
body.editor-mode .dv-col-hd[contenteditable] { cursor: text; }
.dv-col-hd:focus { outline: 2px solid rgba(255,255,255,.45); outline-offset: -2px; border-radius: 2px; }
.deliverables-header[contenteditable] { outline: none; }
body.editor-mode .deliverables-header [contenteditable] { cursor: text; }
.deliverables-header [contenteditable]:focus { outline: 2px solid rgba(232,224,208,.35); outline-offset: -2px; border-radius: 2px; }
.dv-col-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 9px; }
.dv-name   { font-size: 10.5px; font-weight: 600; color: var(--navy); line-height: 1.3; }
.dv-ratios { font-size: 9.5px; color: rgba(26,46,61,.5); margin-top: 2px; letter-spacing: .2px; }
.dv-note   {
  font-size: 9px; font-style: italic; color: rgba(26,46,61,.5);
  line-height: 1.5; margin-top: 4px; padding-top: 9px;
  border-top: 1px solid rgba(26,46,61,.08);
}

/* ── EVENT MODAL (add/edit) — movable + resizable ──────── */
#event-modal {
  width: 420px;
  max-width: 95vw;
  min-width: 360px;
  min-height: 380px;
  max-height: 92vh;
  resize: both;
  overflow: hidden; /* resize handle requires non-default overflow */
}
#event-modal .modal-body { padding: 20px 18px 4px; }
.field-group { margin-bottom: 16px; }
.type-picker {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 5px;
  max-height: 240px; overflow-y: auto;
}
.type-picker .type-group-label {
  grid-column: 1 / -1;
  font-size: 8.5px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: rgba(26,46,61,.45);
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid rgba(26,46,61,.08);
}
.type-picker .type-group-label:first-child {
  margin-top: 0; padding-top: 0; border-top: none;
}
.type-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 7px;
  border: 2px solid transparent; border-radius: 4px; cursor: pointer;
  font-family: var(--font); font-size: 9.5px; font-weight: 600;
  color: var(--navy); background: #f4f2ee; transition: all .1s;
  text-align: left; line-height: 1.3;
}
.type-btn:hover { background: #ede9e1; border-color: rgba(26,46,61,.2); }
.type-btn.selected { border-color: var(--navy); background: #eae6de; }
.type-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.btn-dup {
  background: none; border: 1.5px solid rgba(125,60,152,.35); color: #7d3c98;
  padding: 7px 14px; border-radius: 3px; font-family: var(--font);
  font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  cursor: pointer; transition: all .12s;
}
.btn-dup:hover { background: rgba(125,60,152,.07); border-color: rgba(125,60,152,.6); }

/* ── Right-side action cluster in bottom toolbar ───────── */
.bottom-toolbar-actions {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}

/* ── Deliverables editor modal — wider than other modals ── */
#dv-edit-modal {
  width: 720px; max-width: 95vw;
  max-height: 92vh;
}

/* ── "Clear all events" button (bottom toolbar) ────────── */
.btn-clear-events {
  background: none;
  border: 1px solid rgba(169,50,38,.3);
  border-radius: 3px;
  padding: 5px 11px;
  font-family: var(--font);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .5px;
  color: #a93226;
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.btn-clear-events:hover {
  background: rgba(169,50,38,.07);
  border-color: rgba(169,50,38,.55);
}
.btn-clear-events:active { transform: scale(.97); }

/* ── × DELETE BUTTON ON TYPE-BTN (editor mode, hover-reveal) ── */
.type-btn { position: relative; }
.type-btn-del {
  position: absolute; top: 3px; right: 3px;
  width: 14px; height: 14px;
  border: none; border-radius: 50%;
  background: rgba(169,50,38,.12);
  color: #a93226;
  font-size: 9px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  opacity: 0; transition: opacity .12s, background .12s, transform .1s;
}
body.editor-mode .type-btn:hover .type-btn-del { opacity: 1; }
.type-btn-del:hover { background: rgba(169,50,38,.25); }
.type-btn-del:active { transform: scale(.92); }

/* ── "+ Activity" BUTTON INSIDE EVENT MODAL TYPE-PICKER ── */
.type-btn-add {
  border: 2px dashed rgba(26,46,61,.25) !important;
  background: transparent !important;
  color: rgba(26,46,61,.55) !important;
  justify-content: center;
  font-weight: 700;
}
.type-btn-add:hover {
  border-color: rgba(26,46,61,.55) !important;
  background: rgba(26,46,61,.04) !important;
  color: var(--navy) !important;
}

/* ── HEADER TITLE — contenteditable affordance (editor only) ── */
body.editor-mode #hdr-client[contenteditable="true"],
body.editor-mode #hdr-project[contenteditable="true"] {
  cursor: text;
  border-radius: 2px;
  transition: background .12s;
  padding: 0 3px;
  margin: 0 -3px;
}
body.editor-mode #hdr-client[contenteditable="true"]:hover,
body.editor-mode #hdr-project[contenteditable="true"]:hover {
  background: rgba(232,224,208,.10);
}
#hdr-client[contenteditable="true"]:focus,
#hdr-project[contenteditable="true"]:focus {
  outline: 2px solid rgba(232,224,208,.4);
  outline-offset: 2px;
  background: rgba(232,224,208,.12);
}

/* ── EDITOR-MODE AFFORDANCES ──────────────────────────── */
body.editor-mode .legend-swatch[data-type-key],
body.editor-mode .type-swatch[data-type-key] {
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
body.editor-mode .legend-swatch[data-type-key]:hover,
body.editor-mode .type-swatch[data-type-key]:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(26,46,61,.18);
}
body.editor-mode .project-dates {
  cursor: pointer;
  transition: color .12s;
}
body.editor-mode .project-dates:hover {
  color: rgba(232,224,208,.85);
}
body.editor-mode .project-dates::after {
  content: " ✎";
  font-size: 10px;
  opacity: 0;
  transition: opacity .15s;
}
body.editor-mode .project-dates:hover::after { opacity: .6; }

/* ── EDITOR PIN MODAL ──────────────────────────────────── */
#pin-modal  { width: 340px; max-width: 92vw; }
#dates-modal     { width: 420px; max-width: 92vw; }
#add-type-modal  { width: 380px; max-width: 92vw; }
#confirm-modal   { width: 380px; max-width: 92vw; }

/* Destructive-action variant of the modal save button */
.btn-confirm-danger {
  background: #a93226 !important;
  color: #fff !important;
}
.btn-confirm-danger:hover { background: #922b21 !important; }

/* ── ROTATE-DEVICE HINT (narrow portrait only) ─────────── */
.rotate-hint { display: none; }

/* ── MOBILE — portrait phones ──────────────────────────── */
@media (max-width: 600px) and (orientation: portrait) {
  .rotate-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--navy);
    color: rgba(232,224,208,.85);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .3px;
    border-bottom: 1px solid rgba(232,224,208,.15);
  }
  .page-header {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
    text-align: center;
  }
  .header-center h1 { font-size: 14px; white-space: normal; line-height: 1.3; }
  .header-right {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .legend-strip {
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .main-content { padding: 14px 10px 24px; }
  .day-cell    { min-height: 70px; }
  .cell-inner  { padding: 4px 4px 4px; }
  .date-number { font-size: 10px; margin-bottom: 3px; }
  .activity-bar { font-size: 7px; padding: 1.5px 3px; line-height: 1.3; }
  .shoot-banner { font-size: 7px; padding: 2px 4px; }
  .dow-header   { font-size: 7.5px; padding: 5px 2px; }
  .month-header { font-size: 9px; padding: 8px 14px; letter-spacing: 2.5px; }
  /* Stack deliverable columns vertically */
  .deliverables-grid { grid-template-columns: 1fr !important; }
  .deliverables-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 14px;
  }
  .dv-due-dates { flex-wrap: wrap; }
  .bottom-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
  }
  .bottom-toolbar-actions { width: 100%; justify-content: flex-end; }
  .toolbar-hint { font-size: 9.5px; line-height: 1.55; }
}

/* ── PRINT ─────────────────────────────────────────────── */
@media print {
  @page { size: letter landscape; margin: .28in .32in; }

  dialog, dialog::backdrop { display: none !important; }
  #toast                   { display: none !important; }
  .btn-primary, .cell-add-btn, .no-print, .bottom-toolbar { display: none !important; }

  html { font-size: 12px; }
  body {
    background: #fff !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    min-width: 0; zoom: 0.9;
  }

  .main-content   { padding: 10px 0 0; }
  .calendar-section { margin-bottom: 14px; box-shadow: none; break-inside: auto; border: 1px solid rgba(26,46,61,.13); border-radius: 5px; }
  .calendar-section.new-page { break-before: page; }
  .deliverables-section { box-shadow: none; margin-top: 14px; break-before: avoid; border: 1px solid rgba(26,46,61,.13); border-radius: 5px; }

  .page-header {
    padding: 12px 28px !important;
    background: #fff !important;
    border-bottom: 1px solid rgba(26,46,61,.15) !important;
  }
  .logo svg.logo-full { height: 36px !important; }
  .ap         { fill: var(--navy) !important; }
  .header-center h1 { font-size: 15px !important; color: var(--navy) !important; }
  .project-dates    { color: rgba(26,46,61,.45) !important; }
  .deliverables-header {
    background: #fff !important; color: var(--navy) !important;
    border-bottom: 1px solid rgba(26,46,61,.15) !important;
  }
  .dv-due-dates { color: rgba(26,46,61,.5) !important; }
  .dv-due-sep   { color: rgba(26,46,61,.2) !important; }

  .legend-strip { background: #f4f1ec !important; padding: 7px 28px !important; }
  .legend-main  { grid-template-columns: repeat(5, max-content) !important; }

  .day-cell     { min-height: 82px  !important; overflow: visible; }
  .cell-inner   { padding: 4px 6px 18px !important; }
  .month-header { padding: 8px 16px !important; font-size: 9px   !important; }
  .dow-header   { padding: 6px 4px  !important; font-size: 8px   !important; }
  .date-number  { font-size: 10px   !important; margin-bottom: 2px !important; }

  .activity-bar { font-size: 8.5px !important; padding: 2px 5px !important; margin-bottom: 2px !important; }
  .shoot-banner { font-size: 8.5px !important; padding: 2px 6px !important; }

  .page-footer {
    background: #f4f1ec !important; margin-top: 10px !important;
    border-top: 2px solid rgba(26,46,61,.18) !important;
    padding: 10px 24px !important;
  }
  .footer-text   { color: rgba(26,46,61,.4) !important; }
  .footer-center { color: rgba(26,46,61,.3) !important; }

  * { box-shadow: none !important; outline: none !important; }
}
