/* ベースフォントサイズを定義 */
:root {
    --base-font-size: 16px; /* 例: デフォルトのフォントサイズ */
}
.sfdm-status-radio-group {
    position: relative;
    display: inline-block;
    min-height: 20px;
}

.sfdm-status-radio-group label {
    margin-right: 15px;
    display: inline-block;
    cursor: pointer;
}

.sfdm-status-radio-group input[type="radio"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sfdm-status-radio-group label:has(input[type="radio"]:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ローディング状態 */
.sfdm-status-radio-group.sfdm-loading {
    opacity: 0.8;
}

.sfdm-loading-text {
    margin-left: 10px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* 成功状態 */
.sfdm-success-text {
    margin-left: 10px;
    font-size: 12px;
    color: #46b450;
    font-weight: bold;
}

/* エラー状態 */
.sfdm-error-text {
    margin-left: 10px;
    font-size: 12px;
    color: #dc3232;
    font-weight: bold;
}
/* ファイルダウンロードアイテムのスタイル */
.file-download-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin: 20px 0;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.file-download-item h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: calc(18px * 0.9); /* 90%に調整 */
}

.file-download-item p {
    margin: 0 0 15px 0;
    color: #666;
    line-height: 1.5;
    font-size: calc(16px * 0.9); /* 90%に調整 */
}

.file-info {
    margin: 15px 0;
    padding: 10px 0;
    border-top: 1px solid #eee;
}

.file-info span {
    display: inline-block;
    margin-right: 20px;
    color: #777;
    font-size: calc(14px * 0.9); /* 90%に調整 */
}

.file-size:before {
    content: "📁 ";
}

.download-count:before {
    content: "⬇️ ";
}

/* ダウンロードボタンのスタイル */
.download-btn {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 11px 22px; /* 90%に調整 */
    border-radius: 4px;
    cursor: pointer;
    font-size: calc(16px * 0.9); /* 90%に調整 */
    font-weight: bold;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.download-btn:hover {
    background-color: #005a87;
}

.download-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.download-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ローディング表示 */
.download-btn.loading {
    position: relative;
    color: transparent;
}

.download-btn.loading:after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    animation: spin 1s linear infinite;
}

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

/* --- 公開画面用スタイル --- */

/* ファイル一覧コンテナ */
.sfdm-file-list-container {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: calc(var(--base-font-size) * 0.9); /* ベースフォントの90% */
}

/* リストヘッダー（検索フォームなど） */
.sfdm-list-header {
    display: flex;
    justify-content: flex-end; /* 右寄せ */
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* 検索フォーム */
.sfdm-search-form {
    display: flex;
    gap: 10px;
}

.sfdm-search-form input[type="text"] {
    padding: 7px 11px; /* 90%に調整 */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: calc(14px * 0.9); /* 90%に調整 */
    width: 250px;
}

.sfdm-search-form input[type="submit"],
.sfdm-search-btn,
.sfdm-search-form button[type="submit"] {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 8px 12px; /* SVGアイコン用に調整 */
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: normal;
    transition: background-color 0.3s ease, transform 0.2s ease;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG検索アイコンのスタイル */
.sfdm-search-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1); /* 白色に変更 */
    pointer-events: none; /* クリックイベントを親要素に委譲 */
}

.sfdm-search-form input[type="submit"]:hover,
.sfdm-search-btn:hover,
.sfdm-search-form button[type="submit"]:hover {
    background-color: #005a87;
    transform: scale(1.05);
}

.sfdm-search-form input[type="submit"]:active,
.sfdm-search-btn:active,
.sfdm-search-form button[type="submit"]:active {
    transform: scale(0.95);
}


/* テーブルコンテナ */
.sfdm-table-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

/* scroll-hintライブラリ用のカスタムスタイル */
.js-scrollable {
    position: relative;
}

/* scroll-hintアイコンのカスタマイズ */
.scroll-hint-icon-white {
    background: rgba(0, 115, 170, 0.7) !important;
    color: white !important;
    border-radius: 20px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    animation: sfdm-pulse 2s infinite !important;
}

/* scroll-hintアイコンのアニメーション */
@keyframes sfdm-pulse {
    0%, 100% { 
        opacity: 0.9; 
        transform: scale(1);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.05);
    }
}

/* スマホ用のscroll-hintカスタマイズ */
@media (max-width: 768px) {
    .scroll-hint-icon-white {
        padding: 6px 10px !important;
        font-size: 12px !important;
        border-radius: 15px !important;
    }
}

/* テーブルラッパー（スクロール対応） */
.sfdm-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* iOS用のスムーズスクロール */
    border: 1px solid #eee;
    border-radius: 5px;
    position: relative;
}

/* ファイル一覧テーブル */
.sfdm-file-list-table {
    width: 100%;
    min-width: 600px; /* テーブルの最小幅を設定 */
    border-collapse: collapse;
    margin-bottom: 0; /* ラッパーで余白を管理するため0に */
    background-color: white;
    box-shadow: none; /* ラッパーでシャドウを管理 */
}

.sfdm-file-list-table th,
.sfdm-file-list-table td {
    border: 1px solid #eee;
    padding: 11px 14px; /* 90%に調整 */
    text-align: left;
    vertical-align: middle;
    font-size: calc(16px * 0.9); /* 90%に調整 */
    white-space: nowrap; /* テキストの折り返しを防ぐ */
    min-width: 80px; /* セルの最小幅を設定 */
}

/* 各列の幅調整 */
.sfdm-file-list-table th:nth-child(1),
.sfdm-file-list-table td:nth-child(1) {
    min-width: 120px; /* Model Name */
}

.sfdm-file-list-table th:nth-child(2),
.sfdm-file-list-table td:nth-child(2) {
    min-width: 100px; /* Date */
}

.sfdm-file-list-table th:nth-child(3),
.sfdm-file-list-table td:nth-child(3) {
    min-width: 80px; /* Size */
}

.sfdm-file-list-table th:nth-child(4),
.sfdm-file-list-table td:nth-child(4) {
    min-width: 120px; /* Download File */
}

.sfdm-file-list-table th:nth-child(5),
.sfdm-file-list-table td:nth-child(5) {
    min-width: 150px; /* Notes */
    white-space: normal; /* Notes列のみ折り返しを許可 */
}

.sfdm-file-list-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #333;
    cursor: pointer; /* ソート可能なヘッダーのカーソル */
    position: relative;
    padding-right: 30px; /* ソートアイコンのためのスペース */
    font-size: calc(16px * 0.9); /* 90%に調整 */
}

.sfdm-file-list-table th a {
    text-decoration: none;
    color: inherit;
    display: block; /* リンク全体をクリック可能に */
}

/* ソートインジケーター */
.sfdm-sortable-header:after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
}

.sfdm-sortable-header.sfdm-sorted-desc:after {
    border-top-color: #333; /* 下向き矢印 */
}

.sfdm-sortable-header.sfdm-sorted-asc:after {
    border-bottom-color: #333; /* 上向き矢印 */
}


.sfdm-file-list-table tr:nth-child(even) {
    background-color: #fcfcfc;
}

.sfdm-file-list-table td:last-child {
    text-align: center;
}

/* ページネーションスタイル */
.sfdm-pagination {
    margin-top: 20px;
    text-align: center;
    font-size: calc(14px * 0.9); /* 90%に調整 */
}

.sfdm-pagination .page-numbers {
    display: inline-block;
    padding: 7px 11px; /* 90%に調整 */
    margin: 0 4px;
    border: 1px solid #eee;
    background-color: white;
    color: #0073aa;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sfdm-pagination .page-numbers:hover {
    background-color: #e5f5fa;
    color: #005a87;
}

.sfdm-pagination .page-numbers.current {
    background-color: #0073aa;
    color: white;
    border-color: #0073aa;
    font-weight: bold;
}

.sfdm-pagination .page-numbers.dots {
    border: none;
    background: none;
    cursor: default;
}

/* --- 管理画面用スタイル --- */

.wp-admin .sfdm-admin-list-header {
    display: flex;
    justify-content: flex-end; /* 右寄せ */
    align-items: center;
    margin-bottom: 15px; /* テーブルとの間隔を少し狭く */
}

.wp-admin .sfdm-admin-search-form {
    display: flex;
    gap: 10px;
}

.wp-admin .sfdm-admin-search-form input[type="text"] {
    padding: 6px 10px; /* WordPressのデフォルトに合わせる */
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    width: 200px; /* 管理画面に合わせる */
}

.wp-admin .sfdm-admin-search-form input[type="submit"],
.wp-admin .sfdm-admin-search-btn,
.wp-admin .sfdm-admin-search-form button[type="submit"] {
    /* WordPressのbuttonスタイルを継承 */
    font-size: 16px !important;
    min-width: 40px;
    padding: 4px 8px !important; /* SVGアイコン用に調整 */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

/* 管理画面SVG検索アイコンのスタイル */
.wp-admin .sfdm-admin-search-icon {
    width: 16px;
    height: 16px;
    filter: none; /* WordPressボタンの色に合わせる */
    opacity: 0.7;
    pointer-events: none;
}

.wp-admin .sfdm-admin-search-btn:hover,
.wp-admin .sfdm-admin-search-form button[type="submit"]:hover {
    transform: scale(1.05);
}

.wp-admin .sfdm-admin-search-btn:active,
.wp-admin .sfdm-admin-search-form button[type="submit"]:active {
    transform: scale(0.95);
}

.wp-admin .wp-list-table th.sfdm-admin-sortable-header {
    cursor: pointer;
    position: relative;
    padding-right: 25px; /* ソートアイコンのためのスペース */
}

.wp-admin .wp-list-table th.sfdm-admin-sortable-header:after {
    content: '';
    position: absolute;
    right: 8px; /* 管理画面のレイアウトに合わせる */
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent; /* 小さめに */
}

.wp-admin .wp-list-table th.sfdm-admin-sortable-header.sfdm-admin-sorted-desc:after {
    border-top-color: #333;
}

.wp-admin .wp-list-table th.sfdm-admin-sortable-header.sfdm-admin-sorted-asc:after {
    border-bottom-color: #333;
}

.sfdm-admin-pagination {
    margin-top: 15px;
    text-align: right; /* 管理画面のページネーションに合わせる */
}

.sfdm-admin-pagination .page-numbers {
    display: inline-block;
    padding: 6px 10px;
    margin: 0 3px;
    border: 1px solid #c3c4c7;
    background-color: #f6f7f7;
    color: #007cba;
    text-decoration: none;
    border-radius: 3px;
}

.sfdm-admin-pagination .page-numbers:hover {
    background-color: #e4e7ea;
}

.sfdm-admin-pagination .page-numbers.current {
    background-color: #007cba;
    color: white;
    border-color: #007cba;
    font-weight: bold;
}

/* 公開状態のテキストカラー */
.sfdm-status-public {
    color: black;
    font-weight: bold;
}

.sfdm-status-private {
    color: red !important; /* 非公開を赤に */
    font-weight: bold;
}

/* スクロールバーのスタイリング（Webkit系ブラウザ） */
.sfdm-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.sfdm-table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sfdm-table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.sfdm-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* スマートフォン向けスタイル */
@media (max-width: 768px) {
    .sfdm-table-wrapper {
        border-radius: 3px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .sfdm-file-list-table {
        min-width: 550px; /* スマホでの最小幅を少し小さく */
    }
    
    .sfdm-file-list-table th,
    .sfdm-file-list-table td {
        padding: 8px 10px; /* スマホでパディングを小さく */
        font-size: calc(14px * 0.9); /* フォントサイズを小さく */
    }
    
    /* 各列の最小幅をスマホ用に調整 */
    .sfdm-file-list-table th:nth-child(1),
    .sfdm-file-list-table td:nth-child(1) {
        min-width: 100px; /* Model Name */
    }
    
    .sfdm-file-list-table th:nth-child(2),
    .sfdm-file-list-table td:nth-child(2) {
        min-width: 85px; /* Date */
    }
    
    .sfdm-file-list-table th:nth-child(3),
    .sfdm-file-list-table td:nth-child(3) {
        min-width: 65px; /* Size */
    }
    
    .sfdm-file-list-table th:nth-child(4),
    .sfdm-file-list-table td:nth-child(4) {
        min-width: 100px; /* Download File */
    }
    
    .sfdm-file-list-table th:nth-child(5),
    .sfdm-file-list-table td:nth-child(5) {
        min-width: 120px; /* Notes */
    }
    
    /* ダウンロードボタンをスマホ用に調整 */
    .sfdm-file-list-table .download-btn {
        padding: 6px 12px;
        font-size: calc(14px * 0.9);
        min-width: auto;
    }
    
    /* 検索ボタンをスマホ用に調整 */
    .sfdm-search-form input[type="submit"],
    .sfdm-search-btn,
    .sfdm-search-form button[type="submit"] {
        padding: 6px 10px;
        font-size: 15px;
        min-width: 36px;
    }
    
    /* スマホ用SVG検索アイコンのサイズ調整 */
    .sfdm-search-icon {
        width: 14px;
        height: 14px;
    }
}

/* レスポンシブデザイン - 管理画面テーブルも対応 */
@media (max-width: 768px) {
    .wp-admin .wp-list-table,
    .wp-admin .wp-list-table thead,
    .wp-admin .wp-list-table tbody,
    .wp-admin .wp-list-table th,
    .wp-admin .wp-list-table td,
    .wp-admin .wp-list-table tr {
        display: block;
    }
    .wp-admin .wp-list-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .wp-admin .wp-list-table tr {
        border: 1px solid #eee;
        margin-bottom: 10px;
    }
    .wp-admin .wp-list-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
        font-size: 14px; /* 管理画面デフォルトサイズ */
    }
    .wp-admin .wp-list-table td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #555;
    }
    /* 各セルのラベル */
    .wp-admin .wp-list-table td:nth-of-type(1):before { content: "ID:"; }
    .wp-admin .wp-list-table td:nth-of-type(2):before { content: "タイトル:"; }
    .wp-admin .wp-list-table td:nth-of-type(3):before { content: "説明:"; }
    .wp-admin .wp-list-table td:nth-of-type(4):before { content: "ファイルサイズ:"; }
    .wp-admin .wp-list-table td:nth-of-type(5):before { content: "ダウンロード数:"; }
    .wp-admin .wp-list-table td:nth-of-type(6):before { content: "公開状態:"; }
    .wp-admin .wp-list-table td:nth-of-type(7):before { content: "ショートコード:"; }
    .wp-admin .wp-list-table td:nth-of-type(8):before { content: "作成日:"; }
    .wp-admin .wp-list-table td:nth-of-type(9):before { content: "操作:"; }
    
    .wp-admin .sfdm-admin-list-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .wp-admin .sfdm-admin-search-form {
        width: 100%;
    }
    .wp-admin .sfdm-admin-search-form input[type="text"] {
        width: calc(100% - 50px); /* アイコンボタン分を調整 */
    }
    
    /* 管理画面の検索ボタンをスマホ用に調整 */
    .wp-admin .sfdm-admin-search-btn,
    .wp-admin .sfdm-admin-search-form button[type="submit"] {
        padding: 2px 6px !important;
        font-size: 14px !important;
        min-width: 32px;
    }
    
    /* 管理画面スマホ用SVG検索アイコンのサイズ調整 */
    .wp-admin .sfdm-admin-search-icon {
        width: 14px;
        height: 14px;
    }
}

/* デバッグ情報用スタイル */
.sfdm-debug-info {
    margin-top: 30px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background-color: #f9f9f9;
}

.sfdm-debug-info summary {
    cursor: pointer;
    font-weight: bold;
    color: #0073aa;
    padding: 5px 0;
    outline: none;
    user-select: none;
}

.sfdm-debug-info summary:hover {
    color: #005a87;
}

.sfdm-debug-info summary:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.sfdm-debug-content {
    margin-top: 10px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 13px;
    line-height: 1.5;
}

.sfdm-debug-content ul {
    margin: 5px 0 5px 20px;
}

.sfdm-debug-content li {
    margin: 3px 0;
}

.sfdm-debug-status-ok {
    color: #46b450;
    font-weight: bold;
}

.sfdm-debug-status-error {
    color: #dc3232;
    font-weight: bold;
}

.sfdm-debug-separator {
    margin: 15px 0;
    border: none;
    border-top: 1px solid #ddd;
}

/* スマートフォン向けデバッグ情報スタイル */
@media (max-width: 768px) {
    .sfdm-debug-info {
        margin-top: 20px;
    }
    
    .sfdm-debug-content {
        font-size: 12px;
        padding: 8px;
    }
}