@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {

  /* Form labels */
  .form-label {
    @apply block text-base font-medium text-gray-700 mb-1;
  }

  .form-label-required {
    @apply block text-base font-medium text-gray-700 mb-1;
  }

  .form-label-required::after {
    content: '*';
    @apply text-red-500 ml-1;
  }
}

@layer components {
  /* Flash message: 2秒後にフェードアウトして自動消去 */
  .flash-auto-hide {
    animation: flashFadeOut 0.5s ease-out 2s forwards;
  }

  @keyframes flashFadeOut {
    to {
      opacity: 0;
      pointer-events: none;
    }
  }

  /* モバイル: サイドバー初期状態で非表示 */
  @media (max-width: 1023px) {
    aside[data-mobile-sidebar-target="sidebar"] {
      transform: translateX(-100%);
    }

    aside[data-mobile-sidebar-target="sidebar"].mobile-open {
      transform: translateX(0);
    }
  }

  /* デスクトップ: サイドバーは常に表示 */
  @media (min-width: 1024px) {
    aside[data-mobile-sidebar-target="sidebar"] {
      transform: translateX(0) !important;
    }
  }

  /* Tiptapエディタ用スタイル */
  .tiptap {
    outline: none;
  }

  .tiptap p {
    margin: 0.5em 0;
  }

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

  .tiptap ul {
    list-style-type: disc;
    padding-left: 1.5em;
    margin: 0.5em 0;
  }

  .tiptap ol {
    list-style-type: decimal;
    padding-left: 1.5em;
    margin: 0.5em 0;
  }

  .tiptap li {
    margin: 0.25em 0;
  }

  .tiptap li p {
    margin: 0;
  }

  .tiptap blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 1em;
    margin: 0.5em 0;
    color: #6b7280;
  }

  .tiptap a {
    color: #4285F4;
    text-decoration: underline;
  }

  .tiptap a:hover {
    color: #3367D6;
  }

  .tiptap strong {
    font-weight: 600;
  }

  .tiptap em {
    font-style: italic;
  }

  .tiptap u {
    text-decoration: underline;
  }

  .tiptap s {
    text-decoration: line-through;
  }

  /* プレースホルダー */
  .tiptap p.is-editor-empty:first-child::before {
    color: #9ca3af;
    content: attr(data-placeholder);
    float: left;
    height: 0;
    pointer-events: none;
  }
}