/* ファイルアップロード領域のスタイル */
.file-upload-area {
    position: relative;
    width: 100%;
    min-height: 120px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background-image: url('{% items[/icon_upload.png] %}'),linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: center;
    background-size: 60px auto, 100%;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 15px 0;
}

.file-upload-area:hover {
    border-color: #007bff;
    background-image: url('{% items[/icon_upload.png] %}'),linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: center;
    background-size: 60px auto, 100%;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.file-upload-area.dragover {
    border-color: #28a745;
    background-image: url('{% items[/icon_upload.png] %}'),linear-gradient(135deg, #e8f5e8 0%, #c3e6c3 100%);
    background-repeat: no-repeat, no-repeat;
    background-position: center;
    background-size: 60px auto, 100%;
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.2);
}

.file-upload-area.has-file {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6c3 100%);
}

/* アップロードアイコン */
.upload-icon {
    font-size: 2.5rem;
    color: #6c757d;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.file-upload-area:hover .upload-icon {
    color: #007bff;
    transform: scale(1.1);
}

.file-upload-area.dragover .upload-icon {
    color: #28a745;
    transform: scale(1.2);
}

/* アップロードテキスト */
.upload-text {
    font-size: 1rem;
    color: #495057;
    text-align: center;
    margin-bottom: 5px;
    font-weight: 500;
}

.upload-subtext {
    font-size: 0.875rem;
    color: #6c757d;
    text-align: center;
    margin-bottom: 15px;
}

/* ファイル選択ボタン */
.file-select-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.file-select-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

/* ファイル情報表示 */
.file-info {
    display: none;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 8px;
    border-left: 4px solid #28a745;
    margin-top: 10px;
    margin-bottom: 15px;
    clear: both;
}

.file-info.show {
    display: flex;
}

 .file-preview {
     flex-shrink: 0;
 }

 .file-thumbnail {
     width: 80px;
     height: 80px;
     border-radius: 6px;
     overflow: hidden;
     border: 2px solid #e9ecef;
 }

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

 .file-icon {
     width: 60px;
     height: 60px;
     display: flex;
     align-items: center;
     justify-content: center;
     background: #f8f9fa;
     border-radius: 8px;
     border: 2px solid #e9ecef;
 }

 .file-icon img {
     width: 40px;
     height: 40px;
     object-fit: contain;
 }

 .file-details {
     flex: 1;
     min-width: 0;
 }

 .file-name {
     font-weight: 500;
     color: #155724;
     margin-bottom: 5px;
     word-break: break-word;
 }

 .file-size {
     font-size: 0.875rem;
     color: #6c757d;
     margin-bottom: 8px;
 }

 .generated-filename {
     font-size: 0.8rem;
     color: #495057;
     background: #f8f9fa;
     padding: 4px 8px;
     border-radius: 4px;
     font-family: monospace;
 }

 /* ファイル削除ボタン */
 .file-remove-btn {
     background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
     color: white;
     border: none;
     padding: 6px 12px;
     border-radius: 6px;
     font-size: 0.75rem;
     cursor: pointer;
     transition: all 0.3s ease;
     flex-shrink: 0;
     align-self: flex-start;
 }

 .file-remove-btn:hover {
     background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
     transform: scale(1.05);
 }

/* プログレスバー */
.upload-progress {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
    display: none;
}

.upload-progress.show {
    display: block;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* アップロード成功/エラー状態 */
.file-upload-area.upload-success {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6c3 100%);
}

.file-upload-area.upload-error {
    border-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .file-upload-area {
        min-height: 100px;
        padding: 15px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .upload-text {
        font-size: 0.875rem;
    }
    
    .upload-subtext {
        font-size: 0.75rem;
    }
}

/* アニメーション */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.file-upload-area.uploading {
    animation: pulse 2s infinite;
}

/* ドラッグ&ドロップ時の視覚的フィードバック */
.file-upload-area.drag-enter {
    border-color: #007bff;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: scale(1.02);
}

 /* ファイルタイプ別アイコン */
 .file-type-icon {
     font-size: 1.5rem;
     margin-right: 8px;
     vertical-align: middle;
 }

 .file-type-icon.image { color: #28a745; }
 .file-type-icon.document { color: #007bff; }
 .file-type-icon.design { color: #6f42c1; }

 /* ローディングオーバーレイ */
 #upload-loading-overlay {
     position: fixed;
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
     background: rgba(0, 0, 0, 0.8);
     display: flex;
     align-items: center;
     justify-content: center;
     z-index: 99999;
     opacity: 0;
     transition: opacity 0.3s ease;
     pointer-events: auto;
 }

 #upload-loading-overlay.show {
     opacity: 1;
 }

 /* デバッグ用：オーバーレイが表示されているか確認 */
 #upload-loading-overlay:not(.show) {
     background: rgba(255, 0, 0, 0.3) !important;
 }

 .loading-content {
     background: white;
     padding: 40px;
     border-radius: 12px;
     text-align: center;
     box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
     max-width: 400px;
     width: 90%;
 }

 .loading-spinner {
     width: 60px;
     height: 60px;
     border: 4px solid #f3f3f3;
     border-top: 4px solid #007bff;
     border-radius: 50%;
     animation: spin 1s linear infinite;
     margin: 0 auto 20px;
 }

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

 .loading-text {
     font-size: 1.25rem;
     font-weight: 600;
     color: #333;
     margin-bottom: 8px;
 }

 .loading-subtext {
     font-size: 0.875rem;
     color: #666;
     margin-bottom: 20px;
 }

 .loading-progress {
     width: 100%;
     height: 6px;
     background: #e9ecef;
     border-radius: 3px;
     overflow: hidden;
     margin-top: 15px;
 }

 .loading-progress .progress-bar {
     height: 100%;
     background: linear-gradient(90deg, #007bff, #28a745);
     width: 0%;
     transition: width 0.3s ease;
     border-radius: 3px;
 }

 /* レスポンシブ対応 */
 @media (max-width: 768px) {
     .loading-content {
         padding: 30px 20px;
         margin: 20px;
     }
     
     .loading-spinner {
         width: 50px;
         height: 50px;
         border-width: 3px;
     }
     
     .loading-text {
         font-size: 1.1rem;
     }
     
     .loading-subtext {
         font-size: 0.8rem;
     }
 }