/* Mobile Optimization CSS - Task 9 Implementation */
/* 모바일 최적화 검증 및 개선 */

/* ===== TOUCH TARGET OPTIMIZATION ===== */
/* iOS/Android 권장 최소 터치 영역: 44px x 44px */

/* Form Input Touch Targets */
.modern-form-input,
.modern-form-select {
  min-height: 48px !important; /* 44px + 4px padding */
  padding: 14px 16px !important;
  font-size: 16px !important; /* Prevent iOS zoom */
  line-height: 1.2 !important;
}

/* Button Touch Targets */
.modern-btn {
  min-height: 48px !important;
  padding: 12px 24px !important;
  font-size: 16px !important;
}

.modern-btn-lg {
  min-height: 56px !important;
  padding: 16px 32px !important;
  font-size: 18px !important;
}

.modern-btn-xl {
  min-height: 64px !important;
  padding: 20px 40px !important;
  font-size: 20px !important;
}

/* Character Card Touch Targets */
.character-card {
  min-height: 280px !important;
  padding: 16px !important;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(14, 165, 233, 0.2);
}

/* Character Selection Indicator Touch Targets */
.character-selection-indicator {
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  top: 12px !important;
  left: 12px !important;
  font-size: 18px !important;
}

/* Preset Card Touch Targets */
.preset-card,
.style-selection-button {
  min-height: 80px !important;
  padding: 16px !important;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(14, 165, 233, 0.2);
}

/* ===== MOBILE FONT OPTIMIZATION ===== */
/* 모바일 폰트 가독성 개선 */

/* Base Font Size for Mobile */
@media (max-width: 768px) {
  body {
    font-size: 16px !important; /* Prevent iOS zoom */
    line-height: 1.5 !important;
  }

  /* Headings Mobile Optimization */
  h1 {
    font-size: 28px !important;
    line-height: 1.2 !important;
  }
  h2 {
    font-size: 24px !important;
    line-height: 1.3 !important;
  }
  h3 {
    font-size: 20px !important;
    line-height: 1.3 !important;
  }
  h4 {
    font-size: 18px !important;
    line-height: 1.4 !important;
  }
  h5 {
    font-size: 16px !important;
    line-height: 1.4 !important;
  }
  h6 {
    font-size: 14px !important;
    line-height: 1.4 !important;
  }
}
  /* Character Details Mobile Font */
  .character-name {
    font-size: 16px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
  }
  
  .character-level {
    font-size: 14px !important;
    line-height: 1.4 !important;
  }
  
  .character-job {
    font-size: 13px !important;
    line-height: 1.4 !important;
    padding: 8px 12px !important;
  }
  
  .character-server {
    font-size: 12px !important;
    line-height: 1.4 !important;
    padding: 6px 10px !important;
  }
  
  .adventure-name {
    font-size: 14px !important;
    line-height: 1.3 !important;
  }
  
  /* Form Labels Mobile Font */
  .modern-form-label {
    font-size: 16px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
  }
  
  /* Button Text Mobile Font */
  .modern-btn {
    font-size: 16px !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
  }
  
  /* Preset Card Mobile Font */
  .preset-card h4,
  .style-selection-button {
    font-size: 15px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
  }
  
  .preset-card p {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }
}

/* ===== MOBILE SPACING OPTIMIZATION ===== */
/* 모바일 터치 영역 크기 및 간격 최적화 */

@media (max-width: 768px) {
  /* Container Padding */
  .modern-container,
  .container {
    padding: 16px !important;
  }
  
  /* Form Section Spacing */
  .modern-form-section {
    margin-bottom: 32px !important;
    padding: 20px !important;
  }
  
  /* Form Grid Spacing */
  .modern-form-grid {
    gap: 20px !important;
    margin-bottom: 24px !important;
  }
  
  /* Character Grid Spacing */
  .character-grid {
    gap: 16px !important;
    padding: 0 !important;
  }
  
  /* Preset Cards Spacing */
  .preset-cards {
    gap: 16px !important;
  }
  
  /* Button Spacing */
  .modern-btn + .modern-btn {
    margin-top: 12px !important;
  }
  
  /* Section Headers */
  .modern-form-section h2,
  .modern-form-section h3 {
    margin-bottom: 20px !important;
  }
}

/* ===== ENHANCED TOUCH INTERACTIONS ===== */
/* 터치 디바이스 전용 최적화 */

@media (hover: none) and (pointer: coarse) {
  /* Remove Hover Effects on Touch Devices */
  .character-card:hover,
  .preset-card:hover,
  .modern-btn:hover,
  .style-selection-button:hover {
    transform: none !important;
    box-shadow: var(--shadow-md) !important;
  }
  
  /* Enhanced Focus States for Touch */
  .character-card:focus,
  .preset-card:focus,
  .modern-btn:focus,
  .style-selection-button:focus {
    outline: 3px solid var(--primary-500) !important;
    outline-offset: 2px !important;
  }
  
  /* Touch Feedback */
  .character-card:active,
  .preset-card:active,
  .modern-btn:active,
  .style-selection-button:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
  }
  
  /* Larger Touch Targets for Small Elements */
  .character-selection-indicator {
    min-width: 48px !important;
    min-height: 48px !important;
  }
  
  /* Enhanced Tap Highlight */
  * {
    -webkit-tap-highlight-color: rgba(14, 165, 233, 0.2) !important;
  }
}

/* ===== MOBILE PORTRAIT OPTIMIZATION ===== */
/* 세로 모드 모바일 최적화 (480px 이하) */

@media (max-width: 480px) {
  /* Single Column Layout */
  .character-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  .preset-cards {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  /* Form Layout */
  .modern-form-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  /* Enhanced Touch Targets for Small Screens */
  .modern-form-input,
  .modern-form-select {
    min-height: 52px !important;
    padding: 16px !important;
    font-size: 16px !important;
  }
  
  .modern-btn {
    min-height: 52px !important;
    padding: 16px 24px !important;
    width: 100% !important;
    font-size: 16px !important;
  }
  
  /* Character Card Mobile Portrait */
  .character-card {
    min-height: 320px !important;
    padding: 20px !important;
  }
  
  .character-card img {
    max-width: 180px !important;
    height: 280px !important;
  }
  
  /* Character Selection Indicator */
  .character-selection-indicator {
    width: 48px !important;
    height: 48px !important;
    top: 16px !important;
    left: 16px !important;
    font-size: 20px !important;
  }
  
  /* Preset Card Mobile Portrait */
  .preset-card,
  .style-selection-button {
    min-height: 100px !important;
    padding: 20px !important;
  }
}

/* ===== MOBILE LANDSCAPE OPTIMIZATION ===== */
/* 가로 모드 모바일 최적화 */

@media (max-width: 768px) and (orientation: landscape) {
  /* Two Column Layout for Landscape */
  .character-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
  
  .preset-cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  /* Compact Character Cards for Landscape */
  .character-card {
    min-height: 240px !important;
    padding: 12px !important;
  }
  
  .character-card img {
    height: 200px !important;
  }
  
  /* Compact Preset Cards */
  .preset-card,
  .style-selection-button {
    min-height: 80px !important;
    padding: 16px !important;
  }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
/* 접근성 개선 */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .character-card,
  .preset-card,
  .modern-btn,
  .modern-form-input {
    border-width: 3px !important;
  }
  
  .character-selection-indicator {
    border-width: 4px !important;
  }
  
  /* Enhanced Focus Indicators */
  .character-card:focus,
  .preset-card:focus,
  .modern-btn:focus {
    outline: 4px solid var(--primary-500) !important;
    outline-offset: 3px !important;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .character-card,
  .preset-card,
  .modern-btn,
  .character-selection-indicator {
    transition: none !important;
    animation: none !important;
  }
  
  .character-card:hover,
  .preset-card:hover,
  .modern-btn:hover {
    transform: none !important;
  }
}

/* ===== MOBILE FORM ENHANCEMENTS ===== */
/* 모바일 폼 개선 */

@media (max-width: 768px) {
  /* Input Focus Enhancement */
  .modern-form-input:focus,
  .modern-form-select:focus {
    transform: scale(1.02) !important;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2) !important;
  }
  
  /* Select Dropdown Enhancement */
  .modern-form-select {
    background-size: 20px 20px !important;
    padding-right: 48px !important;
  }
  
  /* Label Enhancement */
  .modern-form-label {
    display: block !important;
    margin-bottom: 8px !important;
  }
  
  /* Error State Enhancement */
  .modern-form-input.error {
    border-color: var(--error-500) !important;
    border-width: 3px !important;
  }
}

/* ===== MOBILE LOADING STATES ===== */
/* 모바일 로딩 상태 최적화 */

@media (max-width: 768px) {
  .modern-loading {
    padding: 40px 20px !important;
  }
  
  .modern-loading-spinner {
    width: 48px !important;
    height: 48px !important;
    border-width: 4px !important;
  }
  
  .modern-loading-text {
    font-size: 16px !important;
    margin-top: 16px !important;
  }
}

/* ===== MOBILE SPECIFIC UTILITIES ===== */
/* 모바일 전용 유틸리티 클래스 */

/* Touch-friendly spacing */
.mobile-touch-spacing {
  padding: 16px !important;
  margin: 8px 0 !important;
}

/* Mobile-only visibility */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }
  
  .desktop-only {
    display: none !important;
  }
}

/* Mobile text alignment */
.mobile-text-center {
  text-align: left;
}

@media (max-width: 768px) {
  .mobile-text-center {
    text-align: center !important;
  }
}

/* Mobile full width */
.mobile-full-width {
  width: auto;
}

@media (max-width: 768px) {
  .mobile-full-width {
    width: 100% !important;
  }
}

/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */
/* 모바일 성능 최적화 */

/* Reduce animations on mobile for better performance */
@media (max-width: 768px) {
  * {
    animation-duration: 0.2s !important;
  }
  
  .character-card,
  .preset-card {
    will-change: transform !important;
  }
}

/* GPU acceleration for smooth scrolling */
@media (max-width: 768px) {
  .character-grid,
  .preset-cards {
    transform: translateZ(0) !important;
    -webkit-overflow-scrolling: touch !important;
  }
}