/* ヒトヤク - モバイル最適化CSS */

/* ベースのモバイル対応 */
@media (max-width: 768px) {
    
    /* ヘッダーナビゲーションの最適化 */
    header .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    header .flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* ロゴとサイト名のサイズ調整 */
    header h1 {
        font-size: 1.25rem; /* 20px */
        line-height: 1.75rem;
    }
    
    header .w-10.h-10 {
        width: 2rem; /* 32px */
        height: 2rem; /* 32px */
    }
    
    header .w-10.h-10 i {
        font-size: 1rem;
    }
    
    /* ログイン・会員登録ボタンの最適化 */
    .auth-buttons {
        display: flex;
        gap: 0.25rem;
    }
    
    .auth-buttons a {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important; /* 12px */
        line-height: 1rem;
        font-weight: 500;
        border-radius: 0.375rem;
        white-space: nowrap;
        min-width: fit-content;
    }
    
    /* ハンバーガーメニュー風の調整 */
    .mobile-nav-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.25rem;
        color: #374151;
        cursor: pointer;
        padding: 0.5rem;
    }
    
    /* デスクトップナビの非表示 */
    .nav.hidden.md\\:flex {
        display: none;
    }
    
    /* モバイルナビメニュー */
    .mobile-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        z-index: 50;
    }
    
    .mobile-nav.show {
        display: block;
    }
    
    .mobile-nav a {
        display: block;
        padding: 0.75rem 1rem;
        color: #374151;
        text-decoration: none;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .mobile-nav a:hover {
        background-color: #f9fafb;
        color: #2563eb;
    }
}

/* スマートフォンサイズ（640px以下）の追加最適化 */
@media (max-width: 640px) {
    
    /* さらに小さいログイン・会員登録ボタン */
    .auth-buttons a {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.625rem !important; /* 10px */
        font-weight: 600;
    }
    
    /* ロゴのさらなる小型化 */
    header h1 {
        font-size: 1rem; /* 16px */
    }
    
    header .w-10.h-10 {
        width: 1.75rem; /* 28px */
        height: 1.75rem; /* 28px */
    }
    
    /* ヒーローセクションの調整 */
    .hero-gradient {
        padding: 2rem 0;
    }
    
    .hero-gradient h2 {
        font-size: 2rem !important; /* 32px */
        line-height: 2.25rem;
        margin-bottom: 1rem;
    }
    
    .hero-gradient p {
        font-size: 1rem !important;
        margin-bottom: 2rem;
    }
    
    /* CTAボタンの調整 */
    .hero-gradient .btn-primary,
    .hero-gradient button {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.875rem !important;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* 統計情報の調整 */
    .hero-gradient .grid-cols-1.md\\:grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 1rem;
        text-align: center;
    }
    
    .hero-gradient .text-4xl {
        font-size: 2rem !important;
    }
    
    /* 検索セクションの調整 */
    .bg-gray-50.rounded-xl.p-6 {
        padding: 1rem !important;
        border-radius: 0.5rem !important;
    }
    
    .bg-gray-50.rounded-xl.p-6 .grid-cols-1.md\\:grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 0.75rem;
    }
    
    .bg-gray-50.rounded-xl.p-6 select,
    .bg-gray-50.rounded-xl.p-6 input {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* 薬剤師カードの調整 */
    .pharmacist-card {
        padding: 1rem !important;
        margin-bottom: 1rem;
    }
    
    .pharmacist-card h4 {
        font-size: 1.125rem !important;
    }
    
    .pharmacist-card .w-16.h-16 {
        width: 3rem !important;
        height: 3rem !important;
        font-size: 1.25rem !important;
    }
    
    /* 薬剤師カード内のボタン */
    .pharmacist-card .flex.space-x-2 {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .pharmacist-card .flex.space-x-2 button {
        width: 100%;
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* 特徴セクションの調整 */
    .bg-white.rounded-xl.p-8.card-shadow {
        padding: 1.5rem !important;
    }
    
    .text-4xl.font-bold.text-gray-800 {
        font-size: 1.875rem !important;
    }
    
    .text-xl.font-bold.text-gray-800 {
        font-size: 1.125rem !important;
    }
    
    /* 動画セクションの調整 */
    .video-play-btn .w-20.h-20 {
        width: 4rem !important;
        height: 4rem !important;
    }
    
    .video-play-btn .fa-play {
        font-size: 1rem !important;
    }
    
    /* フッターの調整 */
    footer .grid-cols-1.md\\:grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 2rem;
        text-align: center;
    }
    
    footer h4,
    footer h5 {
        font-size: 1rem !important;
    }
}

/* 極小スマートフォン（320px〜480px）の対応 */
@media (max-width: 480px) {
    
    /* 最小限のヘッダー */
    header .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* 極小ログイン・会員登録ボタン */
    .auth-buttons {
        gap: 0.125rem;
    }
    
    .auth-buttons a {
        padding: 0.25rem 0.375rem !important;
        font-size: 0.5rem !important; /* 8px */
        line-height: 0.75rem;
        border-radius: 0.25rem;
    }
    
    /* ロゴの最小化 */
    header h1 {
        font-size: 0.875rem; /* 14px */
    }
    
    header .w-10.h-10 {
        width: 1.5rem; /* 24px */
        height: 1.5rem; /* 24px */
    }
    
    header .w-10.h-10 i {
        font-size: 0.75rem;
    }
    
    /* ヒーローセクションの最小化 */
    .hero-gradient h2 {
        font-size: 1.5rem !important; /* 24px */
        line-height: 2rem;
    }
    
    .hero-gradient p {
        font-size: 0.875rem !important;
    }
    
    /* 統計情報のさらなる調整 */
    .hero-gradient .text-4xl {
        font-size: 1.5rem !important;
    }
    
    /* セクションパディングの調整 */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* 横向き表示の調整 */
@media (max-width: 768px) and (orientation: landscape) {
    
    /* ヒーローセクションの高さ調整 */
    .hero-gradient {
        padding: 1rem 0;
    }
    
    .hero-gradient h2 {
        font-size: 1.875rem !important;
        margin-bottom: 0.5rem;
    }
    
    .hero-gradient p {
        font-size: 0.875rem !important;
        margin-bottom: 1rem;
    }
    
    /* 統計情報を横並びに */
    .hero-gradient .grid-cols-1.md\\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }
    
    /* CTAボタンを横並びに */
    .hero-gradient .flex-col.sm\\:flex-row {
        flex-direction: row !important;
        gap: 0.5rem;
    }
    
    .hero-gradient .btn-primary,
    .hero-gradient button {
        width: auto !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.75rem !important;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    
    .mobile-nav {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .mobile-nav a {
        color: #f9fafb;
        border-bottom-color: #374151;
    }
    
    .mobile-nav a:hover {
        background-color: #374151;
        color: #60a5fa;
    }
    
    .mobile-nav-toggle {
        color: #f9fafb;
    }
}

/* アクセシビリティ - 大きな文字設定への対応 */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    
    /* タッチターゲットの最小サイズ確保 */
    .auth-buttons a {
        min-height: 2.75rem; /* 44px - iOS推奨 */
        min-width: 2.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* ボタンのタップ領域拡大 */
    .pharmacist-card button {
        min-height: 2.75rem;
        touch-action: manipulation;
    }
}

/* 高コントラスト対応 */
@media (prefers-contrast: high) and (max-width: 768px) {
    
    .auth-buttons a {
        border-width: 2px !important;
        font-weight: 700;
    }
    
    .mobile-nav {
        border-width: 2px;
    }
    
    .mobile-nav a {
        border-bottom-width: 2px;
    }
}

/* フォントサイズの動的調整 */
@supports (font-size: clamp(0.5rem, 2.5vw, 0.75rem)) {
    
    @media (max-width: 640px) {
        .auth-buttons a {
            font-size: clamp(0.5rem, 2.5vw, 0.75rem) !important;
        }
        
        header h1 {
            font-size: clamp(0.875rem, 4vw, 1.25rem) !important;
        }
        
        .hero-gradient h2 {
            font-size: clamp(1.5rem, 8vw, 2rem) !important;
        }
    }
}

/* 認証ページのモバイル最適化 */
@media (max-width: 768px) {
    
    /* 認証フォームの調整 */
    .max-w-md {
        max-width: calc(100vw - 2rem);
    }
    
    .max-w-2xl {
        max-width: calc(100vw - 2rem);
    }
    
    .bg-white.rounded-xl.p-8 {
        padding: 1.5rem !important;
        margin: 1rem;
    }
    
    /* ユーザータイプ選択カード */
    .user-type-card {
        padding: 1rem !important;
        font-size: 0.875rem;
    }
    
    .user-type-card h3 {
        font-size: 1rem !important;
    }
    
    .user-type-card ul {
        font-size: 0.75rem;
    }
    
    /* ステップインジケーター */
    .flex.items-center.justify-center.space-x-4 {
        gap: 0.5rem;
    }
    
    .flex.items-center.justify-center.space-x-4 span {
        font-size: 0.75rem;
    }
    
    .w-8.h-0\.5 {
        width: 1rem !important;
    }
    
    /* フォームフィールド */
    .grid.grid-cols-1.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    input, select, textarea {
        font-size: 1rem; /* iOSでズームされないよう16px以上 */
    }
    
    /* ボタンの調整 */
    .auth-gradient {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .flex.space-x-4 {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .flex.space-x-4 button {
        width: 100%;
    }
    
    /* ソーシャルログインボタン */
    .space-y-3 button {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 640px) {
    
    /* 認証ページのタイトル */
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    /* ユーザータイプ選択を縦並び */
    .grid.grid-cols-1.md\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* ユーザータイプボタンのさらなる調整 */
    .user-type-btn {
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    .user-type-btn i {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }
    
    /* フォームの縦幅調整 */
    .py-16 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* 動画プレーヤーのモバイル最適化 */
@media (max-width: 768px) {
    
    #video-modal .relative.w-full {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    #video-content .max-w-2xl {
        max-width: none;
        padding: 1rem;
    }
    
    #video-content h3 {
        font-size: 1.25rem !important;
    }
    
    #video-content p {
        font-size: 0.875rem;
    }
    
    #video-content .grid-cols-1.md\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    #video-content .grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    #video-content .flex.flex-col.sm\\:flex-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #video-content button {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* 動画コントロール */
    #video-controls {
        padding: 0.75rem;
    }
    
    #video-controls .flex {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }
    
    #video-controls button {
        font-size: 0.875rem;
    }
    
    /* 動画情報パネル */
    .bg-white.rounded-lg.p-4 {
        padding: 1rem !important;
        margin-top: 1rem;
    }
    
    .bg-white.rounded-lg.p-4 h3 {
        font-size: 1.125rem !important;
    }
    
    .bg-white.rounded-lg.p-4 .flex.items-center.space-x-4 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* モバイル専用ユーティリティクラス */
@media (max-width: 768px) {
    
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-block {
        display: block !important;
    }
    
    .mobile-flex {
        display: flex !important;
    }
    
    .mobile-grid {
        display: grid !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
    
    .mobile-p-2 {
        padding: 0.5rem !important;
    }
    
    .mobile-p-4 {
        padding: 1rem !important;
    }
    
    .mobile-mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .mobile-text-sm {
        font-size: 0.875rem !important;
    }
    
    .mobile-text-xs {
        font-size: 0.75rem !important;
    }
}