/* ============================================
   Nutrition Therapy Responsive Fixes
   Version: 1.0.0
   モバイル・タブレット対応の包括的修正
   ============================================ */

/* ========== 基本設定 ========== */
* {
    box-sizing: border-box;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* ========== コンテンツ幅制限 ========== */
section {
    max-width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ========== 2列グリッドの修正 ========== */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* ========== メインコンテンツグリッド ========== */
.main-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

@media (max-width: 1024px) {
    .main-content-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

/* ========== タイムラインのレスポンシブ ========== */
@media (max-width: 768px) {
    .timeline-item > div {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .timeline-item div[style*="width: 60px"] {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        font-size: 1.2rem !important;
    }
}

/* ========== 統計グリッド ========== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========== 効果カードグリッド ========== */
@media (max-width: 768px) {
    div[style*="grid-template-columns: repeat(auto-fit, minmax(320px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
}

/* ========== テキストサイズ調整 ========== */
@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    h4 {
        font-size: 1.1rem !important;
    }
    
    p, li {
        font-size: 0.95rem !important;
    }
}

/* ========== パディング調整 ========== */
@media (max-width: 768px) {
    section {
        padding: 2rem 1rem !important;
    }
    
    div[style*="padding: 2rem"] {
        padding: 1.5rem !important;
    }
    
    div[style*="padding: 2.5rem"] {
        padding: 1.5rem !important;
    }
}

/* ========== ボタングループ ========== */
@media (max-width: 768px) {
    div[style*="display: flex"][style*="gap: 1.5rem"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    button, a[style*="padding"] {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ========== アイコンサイズ調整 ========== */
@media (max-width: 768px) {
    .icon-pulse i {
        font-size: 2rem !important;
    }
    
    div[style*="width: 60px; height: 60px"] i {
        font-size: 1.2rem !important;
    }
}

/* ========== カウンター ========== */
@media (max-width: 768px) {
    .counter {
        font-size: 2.5rem !important;
    }
    
    .counter-label {
        font-size: 0.9rem !important;
    }
}

/* ========== Wave Divider調整 ========== */
@media (max-width: 768px) {
    .wave-divider {
        height: 40px !important;
    }
    
    .wave-divider svg {
        height: 40px !important;
    }
}

/* ========== 固定幅要素の修正 ========== */
@media (max-width: 768px) {
    div[style*="max-width: 1200px"],
    div[style*="max-width: 1000px"],
    div[style*="max-width: 900px"] {
        max-width: 100% !important;
    }
}

/* ========== テーブル・リスト ========== */
@media (max-width: 768px) {
    ul, ol {
        padding-left: 1rem !important;
    }
    
    li {
        margin-bottom: 0.5rem !important;
    }
}

/* ========== 画像・メディア ========== */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* ========== Flexアイテム ========== */
@media (max-width: 768px) {
    [style*="display: flex"] {
        flex-wrap: wrap !important;
    }
}

/* ========== クリニックカード ========== */
@media (max-width: 768px) {
    .clinic-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .clinic-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========== FAQ カード ========== */
@media (max-width: 768px) {
    .premium-card {
        padding: 1.5rem !important;
    }
}

/* ========== CTAセクション ========== */
@media (max-width: 768px) {
    section[style*="background: linear-gradient"][style*="text-align: center"] {
        padding: 3rem 1.5rem !important;
    }
}

/* ========== ヒーローセクション ========== */
@media (max-width: 768px) {
    .hero-premium {
        padding: 4rem 1.5rem !important;
    }
    
    .hero-title-main {
        font-size: 2rem !important;
    }
    
    .hero-title-sub {
        font-size: 1.1rem !important;
    }
}

/* ========== 横スクロール防止 ========== */
.no-overflow {
    max-width: 100%;
    overflow-x: hidden;
}

/* ========== グリッドの一般的な修正 ========== */
@media (max-width: 768px) {
    [style*="display: grid"][style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ========== 絶対配置要素の調整 ========== */
@media (max-width: 768px) {
    div[style*="position: absolute"][style*="top: -15px"] {
        position: static !important;
        transform: none !important;
        margin-bottom: 1rem !important;
        display: inline-block !important;
    }
}

/* ========== マージン・ギャップの調整 ========== */
@media (max-width: 768px) {
    div[style*="gap: 3rem"] {
        gap: 1.5rem !important;
    }
    
    div[style*="gap: 2rem"] {
        gap: 1rem !important;
    }
    
    div[style*="margin-bottom: 3rem"] {
        margin-bottom: 2rem !important;
    }
}

/* ========== ボーダー・シャドウの軽減 ========== */
@media (max-width: 768px) {
    [style*="box-shadow"] {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    }
}

/* ========== フォントサイズのクランプ対応 ========== */
@media (max-width: 480px) {
    [style*="clamp"] {
        font-size: 1.5rem !important;
    }
}

/* ========== プログレスバー ========== */
@media (max-width: 768px) {
    .progress-bar {
        height: 3px !important;
    }
}

/* ========== ユーティリティクラス ========== */
.mobile-only {
    display: none;
}

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

/* ========== Back to Topボタンの追加修正 ========== */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 8rem !important;
        right: 1.5rem !important;
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
    }
}

@media (max-width: 480px) {
    .back-to-top {
        bottom: 8rem !important;
        right: 1.25rem !important;
    }
}

@media (max-width: 360px) {
    .back-to-top {
        bottom: 8rem !important;
        right: 1rem !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }
}

/* ========== モバイルメニュー閉じるボタンの追加修正 ========== */
@media (max-width: 768px) {
    .mobile-menu-close {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        font-size: 26px !important;
    }
}

@media (max-width: 480px) {
    .mobile-menu-close {
        top: 16px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 24px !important;
    }
}

@media (max-width: 360px) {
    .mobile-menu-close {
        top: 12px !important;
        right: 12px !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 22px !important;
    }
}

/* ========== スペーシング調整 ========== */
@media (max-width: 768px) {
    .stat-item {
        padding: 1.5rem !important;
    }
    
    .timeline-item {
        padding-bottom: 1.5rem !important;
    }
}

/* ========== アニメーションの軽減 ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
