/* =========================================================
   SMPS2 シンプル写真グリッド (smps2-simple-photo-grid.css)
========================================================= */

#smps2-photo-select-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 15px 60px 15px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ヘッダーエリア */
.smps2-selection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 18px;
}

.selection-status-badge {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.selection-status-badge strong {
    color: #0073aa;
    font-size: 19px;
}

/* 写真一覧グリッド：余白を詰めてすっきり整列 */
.smps2-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 10px 0;
}

/* 各写真カード：枠線と角丸のみのミニマルデザイン */
.smps2-photo-card {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
}

.smps2-photo-card:hover {
    border-color: #cbd5e1;
}

/* 選択時の太枠ハイライト */
.smps2-photo-card.is-selected,
.smps2-photo-card.selected {
    border: 3px solid #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.25);
}

/* 写真コンテナ（パン＆ズーム対応） */
.smps2-photo-card .photo-img-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f8fafc;
    overflow: hidden;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px;
    box-sizing: border-box;
    cursor: grab;
    user-select: none;
    touch-action: none; /* スマホ・タブレットでのスクロール競合防止 */
}

.smps2-photo-card .photo-img-box.is-dragging {
    cursor: grabbing;
}

/* 写真画像本体（天地を切らず全体表示＋変形アニメーション） */
.smps2-photo-card .photo-img-box img,
.smps2-photo-card img.smps2-photo {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    transition: transform 0.08s ease-out;
    transform-origin: center center;
    pointer-events: none; /* マウスイベントを親コンテナで一括処理 */
    display: block !important;
    margin: auto !important;
    box-sizing: border-box !important;
    will-change: transform;
}

/* チェックボックス（左上に小さく配置） */
.smps2-photo-card .photo-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    z-index: 10;
    cursor: pointer;
    accent-color: #0073aa;
}

/* カード下部の極小ツールバー */
.smps2-photo-card .card-mini-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    gap: 4px;
    z-index: 5;
}

.card-mini-toolbar .mini-file-name {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75px;
}

/* 小さな操作ボタン群 */
.card-mini-toolbar .btn-group {
    display: flex;
    gap: 3px;
    align-items: center;
}

.card-mini-toolbar .btn-mini {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    color: #334155;
    cursor: pointer;
    line-height: 1.2;
    transition: all 0.15s ease;
    user-select: none;
}

.card-mini-toolbar .btn-mini:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.card-mini-toolbar .btn-mini:active {
    transform: scale(0.92);
}

/* 次へ進むエリア */
.smps2-next-area {
    margin-top: 35px;
    text-align: center;
}

.smps2-next-btn {
    width: 100%;
    max-width: 440px;
    background: #ff9900;
    color: #ffffff;
    padding: 15px 24px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255, 153, 0, 0.35);
    transition: all 0.2s ease;
    text-decoration: none;
}

.smps2-next-btn:hover {
    background: #e68a00;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 153, 0, 0.4);
}

/* モバイル対応 */
@media (max-width: 600px) {
    .smps2-selection-header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .selection-status-badge {
        text-align: right;
    }

    .smps2-photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .card-mini-toolbar .mini-file-name {
        max-width: 55px;
    }
}
