/* Non-critical styles loaded after first paint to keep initial render fast. */

/* Slide panels, modals, emoji picker, and misc embellishments live here. */

@layer components {
  .slide-panel {
    position: absolute;
    top: var(--size-3);
    right: var(--size-3); /* Moved slightly inward */
    width: min(23.75rem, 90vw); /* 380px */
    max-height: calc(100% - var(--size-5));
    overflow-y: auto;
    background: var(--bg-panel); /* Opaque surface */
    border: var(--border-width) solid var(--text-main); /* Distinct border */
    border-radius: var(--radius-panel);
    padding: var(--size-3);
    box-shadow: var(--shadow-pop); /* Deep shadow */
    display: flex;
    flex-direction: column;
    gap: var(--size-2);
    z-index: var(--layer-panel);
    transform-origin: top right;
    transition:
      transform 0.3s var(--motion-snappy),
      opacity 0.3s var(--motion-snappy);
  }

  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    align-items: center;
    padding: var(--size-2) 0;
    border-bottom: var(--border-width) solid var(--veil-8);
  }

  .panel-section {
    border-top: 1px solid var(--veil-5);
    padding-top: var(--size-2);
    display: flex;
    flex-direction: column;
    gap: var(--size-2);
  }

  .panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .file-input {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
  }

  .file-input input[type="file"] {
    display: none;
  }

  .file-input span {
    text-decoration: underline;
  }

  .history-search {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    border: var(--border-width) solid var(--border);
    background: var(--bg-panel);
    box-shadow: var(--shadow-pop);
    color: var(--text-main);
  }

  .history-list {
    list-style: none;
    margin: var(--size-2) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--size-2);
  }

  .history-list li {
    display: flex;
    justify-content: space-between;
    gap: var(--size-2);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--size-2);
    background: var(--bg-surface-alt);
  }

  .history-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .history-name {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: var(--border-width) solid var(--border);
    background: transparent;
    color: var(--text-main);
  }

  .toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .status-text {
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .share-link {
    display: block;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    border: var(--border-width) solid var(--border);
    font-family: var(--font-mono);
    margin-bottom: var(--size-1);
  }

  .emoji-picker {
    position: absolute;
    bottom: 110%;
    left: 1rem;
    right: 1rem;
    min-width: 18rem;
    max-width: 22rem;
    min-height: 14rem;
    padding-bottom: var(--size-3);
    background: var(--bg-panel);
    border: var(--border-width) solid var(--primary); /* Fresh, cartoonish pop */
    border-radius: var(--radius-panel); /* Rounder */
    box-shadow: var(--shadow-pop); /* Harder shadow */
    padding: var(--size-2);
    z-index: var(--layer-panel);
    display: flex;
    flex-direction: column;
    gap: var(--size-2);
  }

  .emoji-picker__header {
    display: flex;
    gap: var(--size-2);
    align-items: center;
  }

  .emoji-picker__header input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: var(--border-width) solid var(--veil-12);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-main);
  }

  .emoji-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr)); /* 40px */
    gap: 0.25rem;
    max-height: 240px;
    overflow-y: auto;
  }

  .emoji-picker__item {
    border: var(--border-width) solid var(--veil-8);
    background: var(--veil-4);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    font-size: 1.2rem;
    cursor: pointer;
  }

  .emoji-picker__item:hover,
  .emoji-picker__item:focus-visible {
    border-color: var(--accent);
    outline: none;
  }

  .share-modal {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--layer-modal);
    padding: 2rem;
  }

  .share-modal__panel {
    width: min(420px, 90vw);
    background: var(--bg-panel);
    border-radius: var(--radius-panel);
    padding: var(--size-4);
    border: var(--border-width) solid var(--border);
    box-shadow: var(--shadow-pop);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transform: translateY(12px);
    transition:
      transform 0.35s var(--motion-snappy),
      opacity 0.35s var(--motion-snappy);
  }

  .share-link-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
  }

  .share-link-row input {
    flex: 1;
    background: var(--bg-body);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 0.45rem 0.75rem;
  }

  .privacy-list {
    list-style: none;
    padding: 0;
    margin: var(--size-1) 0 0;
    display: flex;
    flex-direction: column;
    gap: var(--size-2);
  }

  .privacy-list li {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--veil-4);
    border: var(--border-width) solid var(--veil-5);
    font-size: 0.95rem;
  }

  .privacy-list strong {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.2rem;
  }
}
