/* モダンなCSS機能
 * レイアウトを崩さない前提での機能追加
 * パフォーマンス最適化版
 */

/* パフォーマンス最適化 */
* {
    box-sizing: border-box;
}

/* 画像の最適化 */
img {
    max-width: 100%;
    height: auto;
    loading: lazy;
}

/* 遅延読み込み用 */
.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy.loaded {
    opacity: 1;
}

/* 不要なアニメーションの無効化（低性能デバイス用） */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 料金表記の非表示（後から再表示可能） */
.tab-content-head p {
    display: none !important;
}

/* 料金表記を再表示する場合は、以下のCSSを追加してください：
.tab-content-head p {
    display: block !important;
}
*/

/* 1. アクセシビリティの向上 */
.keyboard-navigation *:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* スクリーンリーダー用のテキスト */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 2. レスポンシブデザインの改善 */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    /* タッチフレンドリーなボタンサイズ */
    button, .btn, input[type="button"], input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
}

@media (min-width: 769px) {
    .desktop-hidden {
        display: none !important;
    }
}

/* 3. パフォーマンス最適化 */
.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy.loaded {
    opacity: 1;
}

/* 4. フォームの改善 */
.field-error {
    color: #d32f2f;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

input.error, textarea.error, select.error {
    border-color: #d32f2f;
    box-shadow: 0 0 0 1px #d32f2f;
}

/* 5. アニメーションの最適化 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 6. ダークモード対応 */
@media (prefers-color-scheme: dark) {
    /* 必要に応じてダークモードスタイルを追加 */
}

/* 7. 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .pagettl, .pagettl2, .pagettl3, .pagettl4, .pagettl5 {
        color: #000;
    }
    
    button, .btn {
        border: 2px solid #000;
    }
}

/* 8. フォーカス表示の改善 */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* 9. 印刷用スタイル */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .pagettl {
        color: #000 !important;
    }
}

/* 10. パフォーマンス向上のための最適化 */
img {
    max-width: 100%;
    height: auto;
}

/* 11. モバイルでのタッチ最適化 */
@media (hover: none) and (pointer: coarse) {
    .hover-effect:hover {
        transform: none;
    }
    
    button, .btn {
        padding: 12px 16px;
    }
}

/* 12. 既存レイアウトとの互換性を保つための調整 */
.contents-inner {
    position: relative;
}

/* 13. エラーメッセージのスタイリング */
.error-message {
    background-color: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
    padding: 12px;
    border-radius: 4px;
    margin: 8px 0;
}

.success-message {
    background-color: #e8f5e8;
    border: 1px solid #4caf50;
    color: #2e7d32;
    padding: 12px;
    border-radius: 4px;
    margin: 8px 0;
}

/* 14. ローディング状態の改善 */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 15. 既存のスタイルとの競合を避けるための詳細度調整 */
body.mobile .sidebar {
    /* モバイルでのサイドバー調整 */
}

body.desktop .sidebar {
    /* デスクトップでのサイドバー調整 */
}
