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

@layer components {
  /* 背景グラデーション */
  .bg-primary-gradient {
    background: linear-gradient(to right, #0ea5e9, #3b82f6);
  }

  .bg-primary-gradient-hover {
    background: linear-gradient(to right, #0284c7, #2563eb);
  }

  /* テキストグラデーション */
  .text-primary-gradient {
    @apply text-transparent bg-clip-text;
    background-image: linear-gradient(to right, #0ea5e9, #3b82f6);
  }

  .text-gradient-purple {
    @apply text-transparent bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text;
  }

  /* プライマリカラー */
  .text-primary {
    @apply text-blue-600;
  }

  .bg-primary {
    @apply bg-blue-600;
  }

  .btn {
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
    cursor: pointer;
    border: none;
  }

  .btn-primary {
    background: linear-gradient(to right, #0ea5e9, #3b82f6);
    color: white;
    padding: 1rem 2rem;
    border-radius: 9999px;
    /* font-weight: 600; */
    font-size: 1.125rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(0);
    transition: all 0.3s ease;
    cursor: pointer;
  }
  .btn-primary:hover {
    background: linear-gradient(to right, #0284c7, #2563eb);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
    cursor: pointer;
  }
  .btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(59, 130, 246, 0.5);
  }

  .btn-secondary {
    background-color: #e5e7eb;
    color: #374151;
    transition: all 0.3s ease;
    cursor: pointer;
  }
  .btn-secondary:hover {
    background-color: #d1d5db;
    cursor: pointer;
  }
  .btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(156, 163, 175, 0.5);
  }

  .btn-ghost {
    color: #4b5563;
    transition: all 0.3s ease;
  }
  .btn-ghost:hover {
    background-color: #f9fafb;
  }

  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  .btn-md {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
  }

  .btn-xlg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
  }

  /* グラデーションプライマリボタン */
  .btn-gradient {
    background: linear-gradient(to right, #0ea5e9, #3b82f6);
    color: white;
    font-weight: 500;
    border-radius: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    border: none;
    outline: none;
  }

  /* btn-gradientのデフォルトパディング */
  .btn-gradient:not(.btn-sm):not(.btn-md):not(.btn-lg):not(.btn-xlg) {
    padding: 0.5rem 1.5rem;
  }
  .btn-gradient:hover {
    background: linear-gradient(to right, #0284c7, #2563eb);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  }
  .btn-gradient:focus {
    outline: none;
    ring: 2px;
    ring-offset: 2px;
    ring-color: #3b82f6;
  }

  /* グラデーションボタン - ラージサイズ（フォーム用） */
  .btn-gradient-lg {
    background: linear-gradient(to right, #0ea5e9, #3b82f6);
    color: white;
    font-weight: 600;
    border-radius: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 1rem 2rem;
    cursor: pointer;
    border: none;
    outline: none;
    font-size: 1rem;
  }
  .btn-gradient-lg:hover {
    background: linear-gradient(to right, #0284c7, #2563eb);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  }
  .btn-gradient-lg:focus {
    outline: none;
    ring: 2px;
    ring-offset: 2px;
    ring-color: #3b82f6;
  }

  /* ボーダー付きボタン */
  .btn-bordered {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0.75rem;
    color: #374151;
    background-color: white;
    border: 2px solid #d1d5db;
    cursor: pointer;
    outline: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
  .btn-bordered:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
  }
  .btn-bordered:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(156, 163, 175, 0.5);
  }

  /* リンクボタン */
  .btn-link {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 1rem;
    color: #2563eb;
    cursor: pointer;
    border: none;
    outline: none;
  }

  /* btn-linkのデフォルトサイズ（btn-smと同じ） */
  .btn-link:not(.btn-md):not(.btn-lg) {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  /* btn-linkでbtn-mdを使用する場合 */
  .btn-link.btn-md {
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
  }

  /* btn-linkでbtn-lgを使用する場合 */
  .btn-link.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
  }
  .btn-link:hover {
    background-color: rgba(59, 130, 246, 0.05);
  }
  .btn-link:focus {
    outline: none;
    ring: 2px;
    ring-offset: 2px;
    ring-color: #3b82f6;
  }
  .btn-link:disabled {
    cursor: not-allowed;
    opacity: 0.5;
  }

  /* Pillボタン */
  .btn-pill {
    font-weight: 500;
    transition: all 0.3s ease;
    transform: scale(1);
    border-radius: 9999px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    outline: none;
  }
  .btn-pill:hover {
    transform: scale(1.05);
  }
  .btn-pill:focus {
    outline: none;
  }

  /* Pillボタン - 小サイズ */
  .btn-pill-sm {
    font-weight: 500;
    transition: all 0.3s ease;
    transform: scale(1);
    border-radius: 9999px;
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    outline: none;
  }
  .btn-pill-sm:hover {
    transform: scale(1.05);
  }
  .btn-pill-sm:focus {
    outline: none;
  }

  /* Pillボタン - 極小サイズ */
  .btn-pill-xs {
    font-weight: 500;
    transition: all 0.3s ease;
    transform: scale(1);
    border-radius: 9999px;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    cursor: pointer;
    border: none;
    outline: none;
  }
  .btn-pill-xs:hover {
    transform: scale(1.05);
  }
  .btn-pill-xs:focus {
    outline: none;
  }

  /* Pillボタン - アクティブ状態 */
  .btn-pill-active {
    background: linear-gradient(to right, #0ea5e9, #3b82f6);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }

  /* Pillボタン - 非アクティブ状態 */
  .btn-pill-inactive {
    background-color: white;
    color: #374151;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }
  .btn-pill-inactive:hover {
    background-color: #f9fafb;
  }

  /* Pillボタン - 白スタイル（CTAエリア用） */
  .btn-pill-white {
    @apply px-8 py-4 rounded-full font-bold text-lg bg-white text-cyan-600
           hover:bg-gray-100 transition-all duration-300 shadow-lg hover:shadow-xl
           transform hover:scale-105 inline-flex items-center justify-center;
  }

  /* Pillボタン - 白アウトライン（CTAエリア用） */
  .btn-pill-white-outline {
    @apply px-8 py-4 rounded-full font-bold text-lg bg-white/20 backdrop-blur-sm
           border-2 border-white text-white hover:bg-white hover:text-cyan-600
           transition-all duration-300 transform hover:scale-105 inline-flex items-center justify-center;
  }

  /* カードスタイル */
  .card-default {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
  }

  .card-primary {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
  }

  .card-secondary {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
  }

  .btn-solid {
    @apply px-4 py-2 rounded-md text-sm font-medium cursor-pointer;
  }

  .btn-solid-primary {
    @apply bg-blue-600 hover:bg-blue-700 text-white;
  }

  .btn-solid-secondary {
    @apply bg-gray-600 hover:bg-gray-700 text-white;
  }

  .btn-solid-success {
    @apply bg-green-600 hover:bg-green-700 text-white;
  }

  .btn-solid-warning {
    @apply bg-yellow-600 hover:bg-yellow-700 text-white;
  }

  .btn-solid-orange {
    @apply bg-orange-600 hover:bg-orange-700 text-white;
  }

  .btn-solid-cancel {
    @apply border border-gray-300 text-gray-700 hover:bg-gray-50;
  }

  .btn-solid-icon {
    @apply cursor-pointer;
  }

  .btn-solid-icon-primary {
    @apply text-blue-600 hover:text-blue-900;
  }

  .btn-solid-icon-secondary {
    @apply text-gray-600 hover:text-gray-900;
  }

  .btn-solid-icon-success {
    @apply text-green-600 hover:text-green-900;
  }

  .btn-solid-icon-warning {
    @apply text-yellow-600 hover:text-yellow-900;
  }

  .btn-solid-icon-danger {
    @apply text-gray-600 hover:text-gray-900;
  }

  /* テキスト入力フィールド専用カスタムクラス */
  .text-field {
    @apply w-full px-4 py-3 border border-gray-300 rounded-2xl focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors bg-white;
  }

  .text-field:focus {
    outline: none;
  }

  /* テキストエリア専用カスタムクラス */
  .textarea-field {
    @apply w-full px-4 py-3 border border-gray-300 rounded-2xl focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none transition-colors bg-white;
  }

  .textarea-field:focus {
    outline: none;
  }



  /* セレクトボックス専用カスタムクラス */
  .select-field {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    min-height: 3rem; /* 48px - テキストフィールドと同じ高さを保証 */
    @apply w-full px-4 py-3 border border-gray-300 rounded-2xl focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors bg-white;
  }

  /* フォーカス時のアウトライン除去 */
  .select-field:focus {
    outline: none;
  }

  /* 汎用セレクトボックススタイル（既存コードとの互換性） */
  select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    min-height: 3rem; /* 48px - テキストフィールドと同じ高さを保証 */
  }

  select:focus {
    outline: none;
  }

  /* input要素とplaceholderに標準フォントを適用 */
  input,
  textarea,
  select {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  }

  input::placeholder,
  textarea::placeholder {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  }

  /* 標準フォント用のカスタムクラス */
  .font-system {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  }

  /* input用の標準フォントクラス */
  .input-system {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  }

  .input-system::placeholder {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  }

  /* 地図のz-index設定（ヘッダーより低く設定） */
  .map-container {
    position: relative;
    z-index: 1;
  }

  .map-container .leaflet-container {
    z-index: 1;
  }

  /* 画像ローディング */
  .fade-in {
    animation: fadeIn 0.3s ease-in-out;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  /* ローディングスピナー */
  .loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  /* スケルトンローディング（Facebook風） */
  .skeleton {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 20%, #d6d6d6 50%, #e0e0e0 80%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }

  @keyframes shimmer {
    0% {
      background-position: -200% 0;
    }
    100% {
      background-position: 200% 0;
    }
  }

  /* 画像用スケルトン */
  .skeleton-image {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 20%, #d6d6d6 50%, #e0e0e0 80%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    @apply w-full h-full bg-gray-200 rounded;
  }

  /* テキスト用スケルトン */
  .skeleton-text {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 20%, #d6d6d6 50%, #e0e0e0 80%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    @apply h-4 bg-gray-200 rounded mb-2;
  }

  .skeleton-text-sm {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 20%, #d6d6d6 50%, #e0e0e0 80%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    @apply h-3 bg-gray-200 rounded mb-1;
  }

  .skeleton-text-lg {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 20%, #d6d6d6 50%, #e0e0e0 80%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    @apply h-6 bg-gray-200 rounded mb-3;
  }
}
