/**
 * モバイル対応改善CSS
 * レスポンシブテーブル表示とアクセシビリティ向上
 */

/* =========================================
   レスポンシブテーブル改善
   ========================================= */

/* タブレット以下でのテーブル表示改善 */
@media (max-width: 960px) {
    .uk-table-responsive {
        font-size: 0.9rem;
    }
    
    .uk-table-responsive th,
    .uk-table-responsive td {
        padding: 8px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
}

/* スマートフォン用テーブル表示（カード形式） */
@media (max-width: 768px) {
    .uk-table-responsive {
        border: 0;
    }
    
    .uk-table-responsive caption {
        font-size: 1.3rem;
    }
    
    .uk-table-responsive thead {
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }
    
    .uk-table-responsive tr {
        border: 1px solid #e5e5e5;
        display: block;
        margin-bottom: 10px;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .uk-table-responsive td {
        border: none;
        display: block;
        font-size: 0.9rem;
        text-align: right;
        padding: 12px 15px !important;
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        border-bottom: 1px solid #f5f5f5;
    }
    
    .uk-table-responsive td:last-child {
        border-bottom: none;
    }
    
    .uk-table-responsive td:before {
        content: attr(data-label) ": ";
        float: left;
        font-weight: bold;
        color: #666;
        min-width: 100px;
    }
    
    /* ボタン類の調整 */
    .uk-table-responsive td .uk-button {
        margin: 2px;
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .uk-table-responsive td .uk-button-group {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* =========================================
   モバイル用ボタン改善
   ========================================= */

/* タッチターゲットサイズ改善 */
@media (max-width: 768px) {
    .uk-button {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .uk-button-small {
        min-height: 36px;
        min-width: 36px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    /* ナビゲーションボタンの改善 */
    .uk-navbar-toggle {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* 検索フォームボタンの改善 */
    .uk-search-input {
        height: 44px;
        font-size: 1rem;
    }
}

/* =========================================
   フォーム入力の改善
   ========================================= */

@media (max-width: 768px) {
    .uk-input,
    .uk-select,
    .uk-textarea {
        min-height: 44px;
        font-size: 1rem;
        padding: 12px;
    }
    
    .uk-form-label {
        font-size: 0.9rem;
        margin-bottom: 5px;
        font-weight: 600;
    }
    
    /* グリッドフォームの調整 */
    .uk-grid-small .uk-form-label {
        margin-bottom: 8px;
    }
    
    /* 検索フォームの改善 */
    .uk-card-body .uk-grid-small > div {
        margin-bottom: 15px;
    }
}

/* =========================================
   モバイル用ページネーション改善
   ========================================= */

@media (max-width: 768px) {
    .uk-pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .uk-pagination > * > * {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 12px;
        margin: 2px;
    }
    
    /* 数字のページネーションを小さくして表示 */
    .uk-pagination .uk-pagination-numbers {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* =========================================
   検索フォームの改善
   ========================================= */

@media (max-width: 768px) {
    /* 検索フォームを縦並びに */
    .uk-child-width-1-2\@s,
    .uk-child-width-1-3\@m,
    .uk-child-width-1-4\@m {
        display: block !important;
    }
    
    .uk-child-width-1-2\@s > *,
    .uk-child-width-1-3\@m > *,
    .uk-child-width-1-4\@m > * {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    /* 検索ボタンを横並びに */
    .uk-margin-top .uk-button {
        margin: 5px;
        width: auto;
        display: inline-block;
    }
}

/* =========================================
   アクセシビリティ改善
   ========================================= */

/* フォーカス表示の改善 */
.uk-button:focus,
.uk-input:focus,
.uk-select:focus,
.uk-textarea:focus {
    outline: 2px solid #1e87f0;
    outline-offset: 2px;
}

/* スクリーンリーダー用のスキップリンク */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 9999;
}

.skip-link:focus {
    top: 6px;
}

/* =========================================
   ダークモード対応
   ========================================= */

@media (prefers-color-scheme: dark) {
    .uk-table-responsive tr {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .uk-table-responsive td {
        border-bottom-color: #4a5568;
        color: #e2e8f0;
    }
    
    .uk-table-responsive td:before {
        color: #a0aec0;
    }
}

/* =========================================
   カスタムユーティリティクラス
   ========================================= */

/* モバイル専用の非表示 */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
}

/* デスクトップ専用の非表示 */
@media (min-width: 769px) {
    .desktop-hidden {
        display: none !important;
    }
}

/* タッチ用の大きめマージン */
.touch-margin {
    margin: 8px 0;
}

/* カード形式のコンテンツ間隔 */
.mobile-card-spacing {
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .mobile-card-spacing {
        margin-bottom: 20px;
    }
}