/**
 * Cartoon French — Notes Workspace UI
 * Modern, practical study-notes interface (loaded after site.css)
 */

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */
body.notes-page {
  background:
    radial-gradient(ellipse 90% 55% at 8% -10%, rgba(20, 184, 166, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 45% at 92% 8%, rgba(56, 189, 248, 0.08), transparent 50%),
    var(--bg, #020617);
}

[data-theme="light"] body.notes-page {
  background:
    radial-gradient(ellipse 90% 55% at 8% -10%, rgba(20, 184, 166, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 45% at 92% 8%, rgba(14, 165, 233, 0.08), transparent 50%),
    #f4f7f9;
}

.diary-workspace-section {
  padding-top: 1.15rem !important;
  padding-bottom: 4rem !important;
  position: relative;
}

.notes-page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.35rem;
  padding: 1.15rem 1.25rem;
  border-radius: 20px;
  border: 1px solid rgba(20, 184, 166, 0.2);
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(56, 189, 248, 0.04) 55%, transparent 100%),
    rgba(15, 23, 42, 0.35);
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.4);
  animation: notesRise 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

[data-theme="light"] .notes-page-hero {
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(255, 255, 255, 0.9) 50%, #fff 100%);
  border-color: rgba(20, 184, 166, 0.22);
  box-shadow: 0 14px 36px -18px rgba(15, 23, 42, 0.12);
}

.notes-page-hero-copy {
  min-width: 0;
  flex: 1;
}

.notes-page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal, #14b8a6);
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.28);
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.55rem;
}

.notes-page-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.2vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.notes-page-lead {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.notes-page-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.notes-quick-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-line, rgba(255, 255, 255, 0.1));
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

[data-theme="light"] .notes-quick-stat {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
}

.notes-quick-stat strong {
  color: var(--teal, #14b8a6);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

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

/* --------------------------------------------------------------------------
   Desk layout
   -------------------------------------------------------------------------- */
.diary-desk {
  gap: 1.15rem !important;
  min-height: min(78vh, 820px) !important;
  animation: notesRise 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

.diary-sidebar {
  border-radius: 22px !important;
  border-color: rgba(20, 184, 166, 0.18) !important;
  background:
    linear-gradient(165deg, rgba(20, 184, 166, 0.07) 0%, transparent 42%),
    var(--surface, #0f172a) !important;
  box-shadow:
    0 18px 40px -14px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

[data-theme="light"] .diary-sidebar {
  background:
    linear-gradient(165deg, rgba(20, 184, 166, 0.06) 0%, transparent 42%),
    #ffffff !important;
  border-color: rgba(20, 184, 166, 0.2) !important;
  box-shadow:
    0 18px 40px -16px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.diary-brand-icon {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.25), rgba(56, 189, 248, 0.18)) !important;
  border-color: rgba(20, 184, 166, 0.4) !important;
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.2);
  animation: notesIconGlow 4s ease-in-out infinite;
}

@keyframes notesIconGlow {
  0%, 100% { box-shadow: 0 0 14px rgba(20, 184, 166, 0.15); }
  50% { box-shadow: 0 0 24px rgba(20, 184, 166, 0.32); }
}

.diary-counter-badge {
  min-width: 1.85rem;
  text-align: center;
  background: rgba(20, 184, 166, 0.12) !important;
  color: #2dd4bf !important;
  border-color: rgba(20, 184, 166, 0.28) !important;
  font-variant-numeric: tabular-nums;
}

[data-theme="light"] .diary-counter-badge {
  color: #0f766e !important;
  background: rgba(20, 184, 166, 0.12) !important;
}

.btn-new-entry {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 55%, #0891b2 100%) !important;
  box-shadow: 0 8px 22px rgba(20, 184, 166, 0.35) !important;
  border-radius: 14px !important;
  min-height: 46px;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
.btn-new-entry:hover {
  box-shadow: 0 12px 28px rgba(20, 184, 166, 0.45) !important;
  transform: translateY(-2px);
}

.diary-search-bar input:focus {
  border-color: rgba(20, 184, 166, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15) !important;
}

/* Filter chips */
.diary-filter-chips {
  padding: 0.65rem 1rem !important;
  gap: 0.4rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

[data-theme="light"] .diary-filter-chips {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

.diary-chip {
  border-radius: 999px !important;
  padding: 0.38rem 0.75rem !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease !important;
}
.diary-chip:hover {
  transform: translateY(-1px);
}
.diary-chip.active {
  background: rgba(20, 184, 166, 0.18) !important;
  color: #5eead4 !important;
  border-color: rgba(20, 184, 166, 0.45) !important;
  box-shadow: 0 0 16px rgba(20, 184, 166, 0.15);
}

[data-theme="light"] .diary-chip.active {
  color: #0f766e !important;
  background: rgba(20, 184, 166, 0.14) !important;
}

/* Note list cards */
.diary-entries-list {
  padding: 0.65rem 0.7rem 1rem !important;
  gap: 0.45rem;
  display: flex;
  flex-direction: column;
}

.diary-item-card {
  border-radius: 14px !important;
  padding: 0.7rem 0.75rem !important;
  gap: 0.7rem !important;
  border: 1px solid transparent !important;
  background: rgba(255, 255, 255, 0.02) !important;
  cursor: pointer;
  transition:
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease !important;
  animation: notesListIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.diary-item-card:nth-child(1) { animation-delay: 0.02s; }
.diary-item-card:nth-child(2) { animation-delay: 0.05s; }
.diary-item-card:nth-child(3) { animation-delay: 0.08s; }
.diary-item-card:nth-child(4) { animation-delay: 0.11s; }
.diary-item-card:nth-child(5) { animation-delay: 0.14s; }
.diary-item-card:nth-child(6) { animation-delay: 0.17s; }
.diary-item-card:nth-child(7) { animation-delay: 0.2s; }
.diary-item-card:nth-child(8) { animation-delay: 0.23s; }

@keyframes notesListIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.diary-item-card:hover {
  transform: translateY(-2px) !important;
  background: rgba(20, 184, 166, 0.06) !important;
  border-color: rgba(20, 184, 166, 0.22) !important;
}

.diary-item-card.active {
  background: rgba(20, 184, 166, 0.1) !important;
  border-color: rgba(20, 184, 166, 0.4) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(20, 184, 166, 0.12) !important;
}

[data-theme="light"] .diary-item-card {
  background: rgba(15, 23, 42, 0.02) !important;
}
[data-theme="light"] .diary-item-card:hover,
[data-theme="light"] .diary-item-card.active {
  background: rgba(20, 184, 166, 0.08) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06) !important;
}

.diary-item-card.active::before {
  background: linear-gradient(180deg, #2dd4bf, #14b8a6) !important;
  width: 3px !important;
  border-radius: 0 3px 3px 0;
}

.diary-date-stamp {
  border-radius: 12px !important;
  min-width: 46px;
  padding: 0.4rem 0.35rem !important;
  background: rgba(15, 23, 42, 0.55) !important;
}

[data-theme="light"] .diary-date-stamp {
  background: rgba(20, 184, 166, 0.08) !important;
}

.diary-item-title {
  font-weight: 750 !important;
  letter-spacing: -0.01em;
}

.diary-item-snippet {
  opacity: 0.78;
  line-height: 1.4 !important;
}

/* --------------------------------------------------------------------------
   Reading canvas
   -------------------------------------------------------------------------- */
.diary-canvas {
  border-radius: 22px !important;
  border: 1px solid rgba(20, 184, 166, 0.16) !important;
  background:
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(20, 184, 166, 0.08), transparent 55%),
    var(--surface, #0f172a) !important;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.5) !important;
  overflow: hidden;
  position: relative;
}

[data-theme="light"] .diary-canvas {
  background:
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(20, 184, 166, 0.08), transparent 55%),
    #ffffff !important;
  border-color: rgba(20, 184, 166, 0.18) !important;
  box-shadow: 0 20px 50px -20px rgba(15, 23, 42, 0.12) !important;
}

.diary-page-container,
.diary-editor-view {
  animation: notesCanvasIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.diary-page-header {
  gap: 0.85rem !important;
  align-items: flex-start !important;
  padding-bottom: 1rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 1.1rem !important;
}

[data-theme="light"] .diary-page-header {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

.diary-actions-pill-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.4rem !important;
}

.btn-diary-act {
  border-radius: 999px !important;
  padding: 0.42rem 0.8rem !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  min-height: 36px;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--ink) !important;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important;
}
.btn-diary-act:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.4) !important;
  background: rgba(20, 184, 166, 0.1) !important;
}
.btn-act-edit {
  background: rgba(20, 184, 166, 0.14) !important;
  border-color: rgba(20, 184, 166, 0.35) !important;
  color: #5eead4 !important;
}
[data-theme="light"] .btn-act-edit {
  color: #0f766e !important;
}
[data-theme="light"] .btn-diary-act {
  background: rgba(15, 23, 42, 0.03) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}
.btn-act-danger:hover {
  border-color: rgba(239, 68, 68, 0.45) !important;
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fb7185 !important;
}

.diary-meta-chips {
  gap: 0.4rem !important;
  margin-bottom: 0.85rem !important;
}

.badge-cat-modern,
.badge-lvl-modern,
.badge-pinned-modern,
.badge-words-count {
  border-radius: 999px !important;
  font-weight: 750 !important;
}

.diary-entry-title {
  font-size: clamp(1.45rem, 3vw, 1.95rem) !important;
  letter-spacing: -0.03em !important;
  line-height: 1.25 !important;
  margin-bottom: 1.15rem !important;
}

.diary-paper-body {
  font-size: 1.02rem !important;
  line-height: 1.75 !important;
  color: var(--muted);
}

.diary-pdf-card,
.diary-video-box {
  border-radius: 16px !important;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.diary-pdf-card:hover,
.diary-video-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.diary-photo-card {
  border-radius: 12px !important;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.diary-photo-card:hover {
  transform: scale(1.03) !important;
}

/* --------------------------------------------------------------------------
   Editor
   -------------------------------------------------------------------------- */
.diary-editor-view {
  padding: 1.35rem 1.4rem 1.6rem !important;
}

.diary-editor-header {
  margin-bottom: 1.25rem !important;
  padding-bottom: 1rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .diary-editor-header {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

.editor-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.3);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.diary-input-modern,
.diary-select-modern,
.diary-modern-textarea {
  border-radius: 14px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
}
.diary-input-modern:focus,
.diary-select-modern:focus,
.diary-modern-textarea:focus {
  border-color: rgba(20, 184, 166, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14) !important;
}

.diary-attach-panel {
  border-radius: 16px !important;
  border-color: rgba(20, 184, 166, 0.2) !important;
  background: rgba(20, 184, 166, 0.04) !important;
}

.diary-attach-btn {
  border-radius: 12px !important;
  min-height: 42px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease !important;
}
.diary-attach-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.45) !important;
  background: rgba(20, 184, 166, 0.1) !important;
}

.diary-editor-footer {
  gap: 0.65rem !important;
  padding-top: 1rem !important;
}

.diary-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  background: rgba(20, 184, 166, 0.05);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.diary-toggle-label:hover {
  border-color: rgba(20, 184, 166, 0.35);
  background: rgba(20, 184, 166, 0.09);
}

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */
.notes-empty-ledger,
.notes-empty-canvas {
  text-align: center;
  padding: 2.5rem 1.25rem !important;
}
.notes-empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(145deg, rgba(20, 184, 166, 0.18), rgba(56, 189, 248, 0.1));
  border: 1px solid rgba(20, 184, 166, 0.3);
  box-shadow: 0 12px 30px rgba(20, 184, 166, 0.15);
  animation: notesBob 3.5s ease-in-out infinite;
}
@keyframes notesBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.notes-empty-canvas .notes-empty-icon {
  width: 88px;
  height: 88px;
  font-size: 2.4rem;
  margin-bottom: 1.15rem;
}

.notes-empty-tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  max-width: 520px;
  margin: 1.35rem auto 1.75rem;
  text-align: left;
}
.notes-empty-tip {
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-line, rgba(255, 255, 255, 0.1));
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.notes-empty-tip:hover {
  transform: translateY(-2px);
  border-color: rgba(20, 184, 166, 0.35);
}
[data-theme="light"] .notes-empty-tip {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
}
.notes-empty-tip strong {
  display: block;
  color: var(--ink);
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
}

/* --------------------------------------------------------------------------
   Share modal polish
   -------------------------------------------------------------------------- */
.notes-modal-dialog {
  border-radius: 20px !important;
  border: 1px solid rgba(20, 184, 166, 0.22) !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 40px rgba(20, 184, 166, 0.08) !important;
  animation: notesModalIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes notesModalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header-icon {
  background: rgba(20, 184, 166, 0.15) !important;
  border: 1px solid rgba(20, 184, 166, 0.3);
}

.notes-toast {
  border-radius: 12px !important;
  animation: notesToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}
@keyframes notesToastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .notes-page-hero {
    margin-bottom: 1rem;
    padding: 1rem;
  }
  .notes-empty-tips {
    grid-template-columns: 1fr;
  }
  .diary-actions-pill-bar .btn-diary-act {
    font-size: 0.74rem !important;
  }
  .diary-page-header {
    flex-direction: column !important;
  }
  .diary-sidebar {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .notes-page-hero-actions {
    width: 100%;
  }
  .notes-quick-stat {
    flex: 1;
    justify-content: center;
  }
  .notes-page-hero-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .btn-diary-act {
    flex: 1 1 auto;
    justify-content: center;
  }
  .diary-editor-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.85rem;
  }
  .diary-editor-header .flex.items-center.gap-2 {
    width: 100%;
  }
  .diary-editor-header .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notes-page-hero,
  .diary-desk,
  .diary-item-card,
  .diary-page-container,
  .diary-editor-view,
  .notes-empty-icon,
  .notes-modal-dialog,
  .notes-toast,
  .diary-brand-icon {
    animation: none !important;
  }
}
