/**
 * 🎨 Modern Main CSS File - 生成AIステップアップガイド
 * 全CSSファイルの統合・インポート
 * モダンデザインシステム対応
 * 
 * 読み込み順序：
 * 1. Modern Fonts (Google Fonts)
 * 2. Variables (CSS変数定義)
 * 3. Reset (ブラウザ初期化)
 * 4. Base (基本スタイル)
 * 5. Layout (レイアウトシステム)
 * 6. Components (UIコンポーネント)
 * 7. Utilities (ユーティリティクラス)
 */

/* ===== 🎨 Modern Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

/* ===== 1. CSS変数定義 ===== */
@import url('./src/css/variables.css');

/* ===== 2. リセット・初期化 ===== */
@import url('./src/css/reset.css');

/* ===== 3. 基本スタイル ===== */
@import url('./src/css/base.css');

/* ===== 4. レイアウトシステム ===== */
@import url('./src/css/layout.css');

/* ===== 5. UIコンポーネント ===== */
@import url('./src/css/components.css');

/* ===== 6. ユーティリティクラス ===== */
@import url('./src/css/utilities.css');

/* ===== 🎯 Modern Custom Properties ===== */
:root {
  /* スクロール動作のカスタマイズ */
  scroll-behavior: smooth;
  
  /* フォント読み込み最適化 */
  font-display: swap;
  
  /* パフォーマンス最適化 */
  --gpu-acceleration: translateZ(0);
  
  /* モダンアニメーション */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

/* ===== 🎪 Modern Enhancements ===== */

/* GPU アクセラレーション強化 */
.card,
.btn,
header,
.hero-section,
nav a {
  will-change: transform;
  transform: var(--gpu-acceleration);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* モダンスクロールバー */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 115, 22, 0.3) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
  border-radius: var(--radius-full);
  border: none;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
}

/* ===== 📱 Modern Responsive Enhancements ===== */

/* 大きなフォント設定対応（強化版） */
@media (min-resolution: 1.5dppx) and (min-width: 1024px) {
  :root {
    --font-size-base: clamp(1.125rem, 3vw, 1.25rem);
    --font-size-sm: clamp(1rem, 2.5vw, 1.125rem);
    --font-size-xs: clamp(0.875rem, 2vw, 1rem);
  }
}

/* 高コントラストモード（強化版） */
@media (prefers-contrast: high) {
  .card,
  .content-highlights,
  input,
  textarea,
  select,
  button {
    border-width: 3px !important;
    border-color: currentColor !important;
    box-shadow: none !important;
  }
  
  :focus-visible {
    outline: 4px solid currentColor !important;
    outline-offset: 3px !important;
  }
  
  .btn-primary,
  .badge-primary {
    background: var(--color-primary-700) !important;
    border-color: var(--color-primary-800) !important;
  }
}

/* ===== 🌙 Dark Mode Enhancements ===== */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }
  
  .card {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.2);
  }
  
  .hero-section {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
  }
  
  .content-highlights {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.3);
  }
}

/* ===== 🎨 Advanced Animation Framework ===== */

/* エントランスアニメーション */
@keyframes modernSlideIn {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modernFadeIn {
  0% {
    opacity: 0;
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes modernZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.8) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ページロード時のアニメーション */
.animate-on-load {
  animation: modernSlideIn 0.8s var(--ease-expo) forwards;
}

.animate-fade-load {
  animation: modernFadeIn 0.6s var(--ease-out) forwards;
}

.animate-zoom-load {
  animation: modernZoomIn 0.7s var(--ease-spring) forwards;
}

/* ===== 🎯 Performance Optimizations ===== */

/* Critical CSS loading optimization */
.critical-above-fold {
  contain: layout style paint;
}

/* Image optimization */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity var(--duration-300) var(--ease-out);
  will-change: opacity;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Font loading optimization */
.font-loading {
  font-display: optional;
  font-variation-settings: 'wght' 400;
}

/* ===== 🚀 Interactive Enhancements ===== */

/* Advanced hover effects */
.interactive-scale {
  transition: all var(--duration-300) var(--ease-spring);
  cursor: pointer;
}

.interactive-scale:hover {
  transform: scale(1.08) rotate(1deg);
}

.interactive-scale:active {
  transform: scale(0.95) rotate(-1deg);
  transition: transform var(--duration-100) var(--ease-out);
}

/* Magnetic button effect */
.magnetic-btn {
  transition: all var(--duration-200) var(--ease-out);
  position: relative;
}

.magnetic-btn::before {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--duration-300) var(--ease-out);
  pointer-events: none;
}

.magnetic-btn:hover::before {
  opacity: 1;
}

/* ===== 🎨 Special Effects ===== */

/* Particle background effect */
.particle-bg {
  position: relative;
  overflow: hidden;
}

.particle-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(249, 115, 22, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  animation: particleFloat 8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes particleFloat {
  0% { 
    transform: translateY(0) rotate(0deg);
    opacity: 0.5;
  }
  100% { 
    transform: translateY(-20px) rotate(5deg);
    opacity: 0.8;
  }
}

/* Glitch effect for special elements */
.glitch-effect {
  position: relative;
  display: inline-block;
}

.glitch-effect::before,
.glitch-effect::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.glitch-effect::before {
  color: #ff0080;
  animation: glitch1 0.3s infinite linear alternate-reverse;
}

.glitch-effect::after {
  color: #00ffff;
  animation: glitch2 0.3s infinite linear alternate-reverse;
}

@keyframes glitch1 {
  0% { transform: translateX(0); opacity: 0; }
  20% { transform: translateX(-2px); opacity: 0.8; }
  40% { transform: translateX(-2px); opacity: 0; }
  60% { transform: translateX(2px); opacity: 0.8; }
  80% { transform: translateX(2px); opacity: 0; }
  100% { transform: translateX(0); opacity: 0; }
}

@keyframes glitch2 {
  0% { transform: translateX(0); opacity: 0; }
  25% { transform: translateX(2px); opacity: 0.7; }
  50% { transform: translateX(2px); opacity: 0; }
  75% { transform: translateX(-2px); opacity: 0.7; }
  100% { transform: translateX(0); opacity: 0; }
}

/* ===== 🎨 Print Styles (Enhanced) ===== */
@media print {
  /* Remove all animations for print */
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  
  /* Optimize typography for print */
  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
    background: white;
  }
  
  /* Remove interactive elements */
  .btn,
  nav,
  .tooltip,
  .spinner {
    display: none !important;
  }
  
  /* Enhance readability */
  .card,
  .content-highlights {
    border: 1px solid #ccc !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: white !important;
    page-break-inside: avoid;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    color: #000 !important;
  }
  
  /* URL display for links */
  a:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  a[href^="#"]:after,
  a[href^="javascript:"]:after {
    content: "";
  }
}

/* ===== 🎯 Accessibility Enhancements ===== */

/* Focus management */
.focus-trap {
  position: relative;
}

.focus-trap:before,
.focus-trap:after {
  content: '';
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Enhanced screen reader support */
.sr-only-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .card,
  .btn,
  .interactive-scale,
  .magnetic-btn {
    transition: none !important;
    animation: none !important;
  }
  
  .floating,
  .pulse,
  [class*="animate-"] {
    animation: none !important;
  }
}

/* ===== 🛠️ Developer Tools ===== */

/* Development grid overlay */
.debug-grid {
  background-image: 
    linear-gradient(rgba(249, 115, 22, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.1) 1px, transparent 1px);
  background-size: var(--space-4) var(--space-4);
}

.debug-spacing * {
  outline: 1px solid rgba(249, 115, 22, 0.3) !important;
  background: rgba(249, 115, 22, 0.05) !important;
}

/* Performance monitoring */
.perf-monitor {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  z-index: var(--z-modal);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ===== 🌟 Final Touches ===== */

/* Content link styling for docs references */
.content-link {
  display: inline-block;
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
  color: white;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-sm);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.2);
}

.content-link:hover {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.3);
  color: white;
  text-decoration: none;
}

.content-link:focus {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* Loading state */
body.loading {
  overflow: hidden;
}

body.loading::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Success feedback */
.success-pulse {
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Error shake effect */
.error-shake {
  animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== エラー状態・警告表示 ===== */
.error-boundary {
  padding: var(--space-8);
  background-color: var(--color-danger-light);
  border: 2px solid var(--color-danger);
  border-radius: var(--border-radius-lg);
  text-align: center;
  margin: var(--space-4) 0;
}

.error-boundary h2 {
  color: var(--color-danger-dark);
  margin-bottom: var(--space-4);
}

.error-boundary p {
  color: var(--color-danger-dark);
}

/* ===== 成功・完了状態 ===== */
.success-message {
  padding: var(--space-4);
  background-color: var(--color-success-light);
  border: 1px solid var(--color-success);
  border-radius: var(--border-radius-md);
  color: var(--color-success-dark);
  margin: var(--space-4) 0;
}

/* ===== 読み込み状態 ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-index-modal);
}

.loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 4px solid var(--color-gray-200);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===== 終了マーカー ===== */
/* 
   このCSSファイルの読み込みが完了したことを示すマーカー
   JavaScript側で確認可能
*/
body::after {
  content: 'css-loaded';
  display: none;
} 