/* ==========================================================================
   LACEYLIX — THE DIARY
   The calendar that opens from admin mode. Same dark ground and purple rule
   as the rest of the studio, built to be read at a glance: a month grid on
   the left, the chosen day and the entry form on the right.
   ========================================================================== */

.diary-modal { z-index: 10020; padding: 1rem; }

.diary-dialog {
  width: 100%;
  max-width: 1180px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0c0914;
  border: 1px solid rgba(168, 85, 247, 0.42);
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.85), 0 0 40px rgba(147, 51, 234, 0.18);
}

/* ---- head ------------------------------------------------------------- */
.diary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(147, 51, 234, 0.12), transparent);
}
.diary-kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #c084fc;
}
.diary-h {
  margin: 0.15rem 0 0;
  font-family: 'Syne', sans-serif;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: #fdfdfd;
}
.diary-nav { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.diary-month {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  color: #fdfdfd;
  min-width: 9.5rem;
  text-align: center;
}

.diary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s;
}
.diary-btn:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.45);
  color: #fff;
}
.diary-btn:disabled { opacity: 0.45; cursor: progress; }
.diary-btn[hidden] { display: none; }
.diary-btn--today { font-weight: 700; }
.diary-btn--ghost { background: transparent; }
.diary-btn--primary {
  background: linear-gradient(135deg, #9333ea, #c026d3);
  border-color: transparent;
  color: #fff;
  min-height: 40px;
  padding: 0.5rem 1.1rem;
}
.diary-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.diary-close:hover { color: #fff; border-color: rgba(168, 85, 247, 0.5); }

/* ---- body ------------------------------------------------------------- */
.diary-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 1.2rem;
  padding: 1.2rem 1.4rem;
  overflow: auto;
}
@media (max-width: 940px) {
  .diary-body { grid-template-columns: 1fr; }
}

/* ---- month grid ------------------------------------------------------- */
.diary-weekdays,
.diary-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}
.diary-weekdays { margin-bottom: 0.4rem; }
.diary-weekdays span {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  text-align: center;
}

.diary-cell {
  position: relative;
  min-height: 92px;
  padding: 0.35rem 0.35rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  overflow: hidden;
}
.diary-cell:hover { background: rgba(168, 85, 247, 0.08); border-color: rgba(168, 85, 247, 0.35); }
.diary-cell:focus-visible { outline: 2px solid #c084fc; outline-offset: 1px; }
.diary-cell.is-outside { opacity: 0.38; }
.diary-cell.is-weekend { background: rgba(255, 255, 255, 0.035); }
.diary-cell.is-today { border-color: rgba(236, 72, 153, 0.65); }
.diary-cell.is-selected {
  border-color: #c084fc;
  background: rgba(168, 85, 247, 0.13);
  box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.35);
}
.diary-cell.is-drop {
  border-color: #c084fc;
  background: rgba(168, 85, 247, 0.22);
  box-shadow: inset 0 0 0 2px rgba(192, 132, 252, 0.5);
}

.diary-cell-top { display: flex; align-items: center; justify-content: space-between; }
.diary-daynum {
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #e2e8f0;
}
.diary-cell.is-today .diary-daynum {
  color: #fff;
  background: linear-gradient(135deg, #9333ea, #ec4899);
  border-radius: 999px;
  padding: 0.05rem 0.42rem;
}
.diary-daycount {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.6rem;
  color: #94a3b8;
}

.diary-chips { display: flex; flex-direction: column; gap: 0.18rem; margin-top: 0.28rem; }
.diary-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  padding: 0.12rem 0.3rem;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.66rem;
  line-height: 1.25;
  text-align: left;
  cursor: grab;
}
.diary-chip:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.diary-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chip, #64748b);
  flex-shrink: 0;
}
.diary-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diary-chip.is-dragging { opacity: 0.4; }
.diary-more {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.6rem;
  color: #94a3b8;
  padding-left: 0.3rem;
}

.diary-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  margin-top: 0.7rem;
  font-size: 0.7rem;
  color: #94a3b8;
}
.diary-key { display: inline-flex; align-items: center; gap: 0.3rem; }
.diary-key i { width: 8px; height: 8px; border-radius: 50%; }

/* ---- side panel ------------------------------------------------------- */
.diary-side {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}
.diary-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}
.diary-side-head h3 {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  color: #fdfdfd;
}
.diary-side-head h3.is-today { color: #f0abfc; }
.diary-side-count {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  color: #94a3b8;
}

.diary-day-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 34vh;
  overflow: auto;
  padding-right: 0.15rem;
}
.diary-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 2px solid var(--chip, #a855f7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}
.diary-item.is-booking { border-left-color: #ec4899; background: rgba(236, 72, 153, 0.06); }
.diary-item-when {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  color: #c084fc;
  min-width: 3.1rem;
  padding-top: 0.1rem;
}
.diary-item-when small { display: block; color: #64748b; font-size: 0.62rem; }
.diary-item-main { min-width: 0; flex: 1; }
.diary-item-top { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.diary-item-top strong { font-size: 0.88rem; color: #fdfdfd; font-weight: 600; }
.diary-pill {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  color: var(--chip, #c084fc);
  border: 1px solid color-mix(in srgb, var(--chip, #c084fc) 45%, transparent);
}
.diary-item-sub { font-size: 0.72rem; color: #94a3b8; margin-top: 0.1rem; }
.diary-item-notes {
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: #cbd5e1;
  white-space: pre-wrap;
}
.diary-item-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.4rem; }
.diary-item-actions button,
.diary-item-actions a {
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #cbd5e1;
  font-size: 0.68rem;
  cursor: pointer;
  text-decoration: none;
}
.diary-item-actions button:hover,
.diary-item-actions a:hover { color: #fff; border-color: rgba(168, 85, 247, 0.5); }
.diary-item-actions .is-danger:hover { color: #f87171; border-color: rgba(248, 113, 113, 0.55); }

.diary-empty {
  margin: 0.35rem 0;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.6;
}

/* ---- the entry form --------------------------------------------------- */
.diary-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  background: rgba(147, 51, 234, 0.07);
}
.diary-form-head {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c084fc;
}
.diary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.diary-field { display: flex; flex-direction: column; gap: 0.22rem; }
.diary-field > span {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}
.diary-field input,
.diary-field select,
.diary-field textarea {
  width: 100%;
  min-height: 36px;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(9, 7, 14, 0.85);
  color: #fdfdfd;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
}
.diary-field textarea { min-height: 54px; resize: vertical; }
.diary-field input:focus,
.diary-field select:focus,
.diary-field textarea:focus {
  outline: none;
  border-color: #c084fc;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}
.diary-field select option { background: #130f1e; }
.diary-form-actions { display: flex; gap: 0.5rem; margin-top: 0.15rem; }

/* ---- next seven days -------------------------------------------------- */
.diary-upcoming h4 {
  margin: 0 0 0.4rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #64748b;
}
#diary-upcoming-list { display: flex; flex-direction: column; gap: 0.28rem; }
.diary-up {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
  color: #cbd5e1;
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
}
.diary-up:hover { background: rgba(168, 85, 247, 0.1); border-color: rgba(168, 85, 247, 0.35); }
.diary-up-day {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.64rem;
  color: #c084fc;
  min-width: 4.4rem;
}
.diary-up-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diary-up-title i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ---- foot ------------------------------------------------------------- */
.diary-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  color: #64748b;
}
.diary-keys { color: #475569; }

/* ---- the toolbar button ---------------------------------------------- */
.admin-diary-tool {
  border-color: rgba(34, 197, 94, 0.45) !important;
  color: #4ade80 !important;
}
.admin-diary-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #334155;
  color: #e2e8f0;
  font-size: 0.62rem;
  font-weight: 700;
}
.admin-diary-badge.is-busy { background: #22c55e; color: #04160a; }

/* ---- phone ------------------------------------------------------------ */
@media (max-width: 620px) {
  .diary-modal { padding: 0.4rem; }
  .diary-dialog { max-height: 96vh; border-radius: 14px; }
  .diary-head { padding: 0.75rem 0.85rem; position: relative; padding-right: 3rem; }
  .diary-nav { gap: 0.3rem; }
  .diary-close { position: absolute; top: 0.7rem; right: 0.7rem; }
  .diary-nav .diary-close { position: absolute; }
  .diary-month { min-width: 0; font-size: 0.88rem; }
  .diary-body { padding: 0.75rem 0.85rem; gap: 0.9rem; }
  .diary-cell { min-height: 54px; padding: 0.2rem; border-radius: 7px; }
  .diary-daynum { font-size: 0.72rem; }
  .diary-chip { font-size: 0.56rem; padding: 0.08rem 0.18rem; }
  .diary-chip span { display: none; }
  .diary-chip i { width: 7px; height: 7px; }
  .diary-chips { flex-direction: row; flex-wrap: wrap; gap: 0.15rem; }
  .diary-day-list { max-height: 26vh; }
  .diary-foot { padding: 0.5rem 0.85rem; }
  .diary-keys { display: none; }
}