/* ── Tiptap Editor ── */
.tiptap ul p,
.tiptap ol p {
  @apply inline;
}

.tiptap p.is-editor-empty:first-child::before {
  @apply pointer-events-none float-left h-0 text-sm;
}

.ProseMirror-focused {
  outline: none;
}

.tiptap {
  :first-child {
    margin-top: 0;
  }

  ul,
  ol {
    padding: 0 1rem;
    margin: 1.25rem 1rem 1.25rem 0.4rem;

    li p {
      margin-top: 0.25em;
      margin-bottom: 0.25em;
    }
  }

  ul { list-style-type: circle; }
  ol { list-style-type: decimal; }

  h1, h2, h3, h4, h5, h6 {
    line-height: 1.1;
    margin-top: 2.5rem;
    text-wrap: pretty;
  }

  h1, h2 {
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
  }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1.1rem; }
  h4, h5, h6 { font-size: 1rem; }

  code {
    background-color: var(--purple-light);
    border-radius: 0.4rem;
    color: var(--black);
    font-size: 0.85rem;
    padding: 0.25em 0.3em;
  }

  pre {
    background: var(--black);
    border-radius: 0.5rem;
    color: var(--white);
    font-family: 'JetBrainsMono', monospace;
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;

    code {
      background: none;
      color: inherit;
      font-size: 0.8rem;
      padding: 0;
    }
  }

  mark {
    background-color: #faf594;
    border-radius: 0.4rem;
    box-decoration-break: clone;
    padding: 0.1rem 0.3rem;
  }

  blockquote {
    border-left: 3px solid var(--gray-3);
    margin: 1.5rem 0;
    padding-left: 1rem;
  }

  hr {
    border: none;
    border-top: 1px solid var(--gray-2);
    margin: 2rem 0;
  }
}

/* ── List styles (global reset override) ── */
ul {
  list-style-type: disc !important;
  margin: default !important;
  margin-left: 1.5em !important;
  padding-left: 0 !important;
}

ol {
  list-style-type: decimal !important;
  margin: default !important;
  margin-left: 1.5em !important;
  padding-left: 0 !important;
}

/* ── Calendar dot ── */
.calendar-dot {
    position: relative;
}

.calendar-dot::after {
    left: 50%;
    width: 5px;
    height: 5px;
    content: '';
    bottom: -4px;
    position: absolute;
    border-radius: 50%;
    transform: translateX(-50%);
    background: oklch(0.637 0.237 25.331);
}

/* ── Admin Sidebar (mobile slide-in) ── */
@media (max-width: 639px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .admin-sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }
}

/* ── Toast Notifications ── */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
}

.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    max-width: 320px;
    min-width: 240px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
    animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    line-height: 1.4;
    cursor: pointer;
    border: 1px solid transparent;
    backdrop-filter: blur(8px);
}

.toast.toast-success {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.toast.toast-success .toast-icon {
    color: #16a34a;
}

.toast.toast-error {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}

.toast.toast-error .toast-icon {
    color: #e11d48;
}

.toast.toast-info {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.toast.toast-info .toast-icon {
    color: #2563eb;
}

.toast.toast-warning {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.toast.toast-warning .toast-icon {
    color: #d97706;
}

.toast.removing {
    animation: toastSlideOut 0.25s ease forwards;
}

.toast-icon {
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Modal Animation ── */
@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-modal {
    animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Loading Spinner ── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* ── Nav button active state ── */
.nav-button.active .tabindex-badge {
    opacity: 0.6;
    color: white;
}

/* ── Template card hover effect ── */
.template-card {
    cursor: pointer;
    text-align: left;
}

/* ── Advanced section chevron rotation ── */
#advanced-chevron {
    transition: transform 0.2s ease;
}

/* ── Builder section card entrance ── */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

#builder-sections > div {
    animation: cardIn 0.2s ease forwards;
}

/* ── Builder page selector focus ── */
#builder-page-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ── Inline editor modal — editor slot fills space ── */
#ied-editor-slot #info-content {
    border-radius: 0.75rem;
    overflow: hidden;
}

/* ── New page modal layout grid cards ── */
#npm-layout-grid button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
