/* ===== リセットと基本スタイル ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== ヘッダースタイル ===== */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.header h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    text-align: center;
    color: #7f8c8d;
    font-size: 1.1em;
}

/* ===== アップロードセクション ===== */
.upload-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.upload-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.upload-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.upload-box h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ===== ファイル入力スタイル ===== */
input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    background: #f8f9fa;
    transition: border-color 0.3s ease;
}

input[type="file"]:hover {
    border-color: #667eea;
}

/* ===== フォルダ一覧スタイル ===== */
.folder-list-section {
    margin-bottom: 30px;
}

.section-title {
    color: white;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.folder-item {
    min-height: 140px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.folder-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.folder-item:hover::before {
    left: 100%;
}

.folder-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

/* ===== フォルダサムネイルスタイル - 横並び版 ===== */
.folder-thumbnails-horizontal {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    height: 50px;
}

.folder-thumbnail-horizontal {
    width: 45px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: #f8f9fa;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.folder-thumbnail-horizontal:hover {
    transform: scale(1.05);
}

.folder-thumbnail-horizontal img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.folder-thumbnail-horizontal.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.2em;
}

.folder-info {
    text-align: center;
    width: 100%;
}

.folder-name {
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 4px;
    color: #2c3e50;
}

.folder-count {
    font-size: 0.8em;
    color: #7f8c8d;
    margin-bottom: 8px;
}

/* フォルダ削除ボタン - 確実に小さくする */
.folder-delete-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 2px 4px !important;
    border-radius: 3px;
    font-size: 0.55em !important;
    font-weight: 600;
    cursor: pointer;
    width: 60px;
    margin: 2px auto 0 auto;
    transition: all 0.2s ease;
    line-height: 1;
    display: block;
    text-align: center;
    min-height: auto;
}

.folder-delete-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.4);
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

/* より確実な指定 */
.folder-info .folder-delete-btn {
    padding: 1px 3px !important;
    font-size: 0.5em !important;
    width: 55px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .folder-delete-btn {
        padding: 1px 3px !important;
        font-size: 0.45em !important;
        width: 50px;
    }
}

@media (max-width: 480px) {
    .folder-delete-btn {
        padding: 1px 2px !important;
        font-size: 0.4em !important;
        width: 45px;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .folder-delete-btn {
        padding: 1px 4px;
        font-size: 0.55em;
        width: 65%;
    }
}

@media (max-width: 480px) {
    .folder-delete-btn {
        padding: 1px 3px;
        font-size: 0.5em;
        width: 60%;
    }
}
}

/* ===== 画像グリッドスタイル ===== */
.image-section {
    margin-bottom: 30px;
}

.image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.image-header h2 {
    color: #2c3e50;
    font-size: 1.5em;
}

.image-count {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: 5px;
}

.back-button {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.image-item {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.image-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.image-container {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.image-container img:hover {
    transform: scale(1.05);
}

.image-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filename {
    font-size: 0.8em;
    color: #2c3e50;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
    font-weight: 500;
}

.delete-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.4);
}

/* ===== テストボタン ===== */
.test-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.test-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.4);
}

/* ===== モーダルギャラリースタイル ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ナビゲーションボタン */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 2em;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1001;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

/* 画像表示エリア */
.image-viewer {
    position: relative;
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#modalImage {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* 画像カウンター */
.image-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 1001;
}

/* 閉じるボタン */
.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0,0,0,0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.close:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.1);
}

/* 画像情報 */
.modal-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-align: center;
    background: rgba(0,0,0,0.7);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    max-width: 80%;
    word-break: break-all;
    backdrop-filter: blur(10px);
    z-index: 1001;
}

/* ===== 一括操作バー ===== */
.bulk-actions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    display: none;
    z-index: 999;
    min-width: 300px;
}

.bulk-actions form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* ===== メッセージスタイル ===== */
.success, .error {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

.success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

/* ===== 空のフォルダ表示 ===== */
.empty-folder {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.empty-folder h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.empty-folder p {
    color: #7f8c8d;
    margin-bottom: 0;
    font-size: 1.1em;
}

/* ===== チェックボックススタイル ===== */
.checkbox-item {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    z-index: 10;
    accent-color: #667eea;
}

/* ===== ローディングアニメーション ===== */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    display: none;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.8);
    padding: 30px;
    border-radius: 15px;
}

.loading {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== エラーメッセージスタイル ===== */
#errorMessage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    display: none;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.9);
    padding: 30px;
    border-radius: 15px;
    color: white;
    text-align: center;
    border: 2px solid #e74c3c;
}

.modal-info.error {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    border-radius: 5px;
}

/* ===== レスポンシブデザイン ===== */

/* スマホ用スタイル */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .upload-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .folder-item {
        min-height: 130px;
        padding: 10px 6px;
    }
    
    .folder-thumbnails-horizontal {
        height: 45px;
    }
    
    .folder-thumbnail-horizontal {
        width: 40px;
        height: 40px;
    }
    
    .folder-name {
        font-size: 0.85em;
    }
    
    .folder-count {
        font-size: 0.75em;
    }
    
    .nav-btn {
        display: none;
    }
    
    .image-viewer {
        max-width: 95%;
        max-height: 70vh;
    }
    
    #modalImage {
        max-height: 70vh;
    }
    
    .close {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .image-counter {
        top: 10px;
        font-size: 0.8em;
        padding: 6px 12px;
    }
    
    .modal-info {
        bottom: 10px;
        font-size: 0.8em;
        padding: 8px 16px;
    }
    
    .bulk-actions {
        min-width: 280px;
        bottom: 10px;
    }
    
    .image-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* タブレット用スタイル */
@media (min-width: 769px) and (max-width: 1024px) {
    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 25px;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 25px;
    }
    
    .folder-item {
        min-height: 150px;
    }
    
    .folder-thumbnails-horizontal {
        height: 55px;
    }
    
    .folder-thumbnail-horizontal {
        width: 50px;
        height: 50px;
    }
    
    .nav-btn {
        font-size: 1.8em;
        padding: 12px 16px;
    }
    
    .prev-btn {
        left: 15px;
    }
    
    .next-btn {
        right: 15px;
    }
}

/* デスクトップ用 */
@media (min-width: 1025px) {
    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 30px;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 30px;
    }
    
    .folder-item {
        min-height: 160px;
    }
    
    .folder-thumbnails-horizontal {
        height: 60px;
        gap: 5px;
    }
    
    .folder-thumbnail-horizontal {
        width: 55px;
        height: 55px;
    }
}

/* 高解像度ディスプレイ用 */
@media (min-width: 1200px) {
    .nav-btn {
        font-size: 2.5em;
        padding: 20px 25px;
    }
    
    .prev-btn {
        left: 40px;
    }
    
    .next-btn {
        right: 40px;
    }
}

/* 縦長画面用 */
@media (max-height: 600px) {
    .image-viewer {
        max-height: 60vh;
    }
    
    #modalImage {
        max-height: 60vh;
    }
    
    .close {
        top: 10px;
        right: 10px;
    }
    
    .image-counter {
        top: 10px;
    }
    
    .modal-info {
        bottom: 10px;
    }
}

/* ===== ダークモード対応 ===== */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .header, .upload-box, .folder-item, .image-item, .image-header, .empty-folder {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
    
    .folder-name, .filename {
        color: #ecf0f1;
    }
    
    .folder-count {
        color: #bdc3c7;
    }
    
    input[type="file"] {
        background: #34495e;
        border-color: #7f8c8d;
        color: #ecf0f1;
    }
}

/* ===== アニメーション ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.folder-item, .image-item, .upload-box {
    animation: fadeIn 0.5s ease-out;
}

/* ===== スクロールバーカスタマイズ ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* ===== フォーカススタイル ===== */
button:focus, input:focus, .folder-item:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ===== 画像読み込みエラーフォールバック ===== */
.folder-thumbnail-horizontal img[style*="display: none"] + .folder-thumbnail-horizontal::after {
    content: "📷";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #e9ecef;
    color: #6c757d;
    font-size: 1.2em;
}

/* ===== 印刷用スタイル ===== */
@media print {
    .upload-section, .bulk-actions, .delete-btn, .folder-delete-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .folder-item, .image-item {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* ===== ユーティリティクラス ===== */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* ===== アクセシビリティ ===== */
.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;
}

/* ===== タッチデバイス最適化 ===== */
@media (hover: none) and (pointer: coarse) {
    .folder-item:hover,
    .image-item:hover,
    .upload-box:hover {
        transform: none;
    }
    
    .nav-btn {
        padding: 20px;
        font-size: 1.5em;
    }
}
/* モーダルのスマホ対応を強化 */
@media (max-width: 768px) {
    .modal {
        display: none;
        position: fixed;
        z-index: 10000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.95);
        justify-content: center;
        align-items: center;
        padding: 10px;
        box-sizing: border-box;
    }
    
    .modal-content {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
    }
    
    .image-viewer {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }
    
    #modalImage {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    
    .nav-btn {
        display: block !important; /* スマホでも表示 */
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255,255,255,0.3);
        border: none;
        color: white;
        font-size: 24px;
        padding: 15px;
        cursor: pointer;
        border-radius: 50%;
        z-index: 10001;
    }
    
    .prev-btn {
        left: 10px;
    }
    
    .next-btn {
        right: 10px;
    }
    
    .close {
        position: fixed;
        top: 20px;
        right: 20px;
        color: white;
        font-size: 30px;
        font-weight: bold;
        cursor: pointer;
        z-index: 10001;
        background: rgba(0,0,0,0.5);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .image-counter {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.7);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 14px;
        z-index: 10001;
    }
    
    .modal-info {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        color: white;
        text-align: center;
        background: rgba(0,0,0,0.7);
        padding: 10px 15px;
        border-radius: 10px;
        font-size: 12px;
        max-width: 90%;
        z-index: 10001;
    }
}

/* タッチデバイス用の最適化 */
@media (hover: none) and (pointer: coarse) {
    .image-container img {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .nav-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* 画像読み込み中のスタイル */
#modalImage[src=""] {
    display: none;
}

/* 確実な表示制御 */
.modal {
    display: none;
}

.modal.show {
    display: flex !important;
}
/* キャンセルボタン */
.cancel-button {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    flex: 1;
}

.cancel-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

/* ボタングループ */
.upload-box .flex-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.upload-button, .cancel-button {
    flex: 1;
}
/* アップロードメッセージスタイル */
.upload-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

.upload-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.upload-error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

/* キャンセルボタン */
.cancel-button {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    flex: 1;
}

.cancel-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

/* ボタングループ */
.upload-box form > div {
    display: flex;
    gap: 10px;
    width: 100%;
}

.upload-button, .cancel-button {
    flex: 1;
}
