/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 14px;
}

/* メインコンテンツ */
main {
    flex: 1;
}

/* アップロードエリア */
.upload-area {
    background-color: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    border-color: #3182ce;
    background-color: #ebf8ff;
}

.drop-zone-content {
    pointer-events: none;
}

/* ファイル選択ボタンエリア */
.file-buttons {
    text-align: center;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.upload-icon {
    color: #cbd5e0;
    margin-bottom: 20px;
}

.file-input-label {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3182ce;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 0;
    transition: background-color 0.3s;
}

.file-input-label:hover {
    background-color: #2563eb;
}

.file-info {
    font-size: 12px;
    color: #718096;
    margin-top: 10px;
}

/* プレビューエリア */
.preview-area {
    margin-top: 20px;
    text-align: center;
}

.preview-area h3 {
    margin-bottom: 10px;
    color: #2d3748;
}

.preview-area img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    margin-bottom: 15px;
}

/* 補足情報エリア */
.supplement-area {
    margin-top: 20px;
}

.supplement-area label {
    display: block;
    margin-bottom: 5px;
    color: #4a5568;
    font-weight: 500;
}

.supplement-area input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

/* ボタンスタイル */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    margin: 10px 5px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #3182ce;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #718096;
    color: white;
}

.btn-secondary:hover {
    background-color: #4a5568;
}

.btn-success {
    background-color: #48bb78;
    color: white;
}

.btn-success:hover {
    background-color: #38a169;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3182ce;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* 結果表示エリア */
.result-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-section h2 {
    color: #2d3748;
    margin-bottom: 20px;
}

/* タイトル候補 */
.title-candidates {
    margin-bottom: 20px;
}

.title-candidate {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f7fafc;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.title-candidate:hover {
    background-color: #edf2f7;
}

.candidate-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.title-candidate input[type="radio"] {
    margin-right: 10px;
}

.title-candidate label {
    flex: 1;
    cursor: pointer;
}

.title-score {
    font-size: 12px;
    color: #718096;
    margin-left: 10px;
}

/* 関連画像セクション */
.related-images-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.related-images-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #495057;
}

.related-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.related-image {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    object-fit: cover !important;
    border-radius: 3px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    display: inline-block !important;
    cursor: pointer;
}

.related-image:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* カスタムタイトル */
.custom-title {
    margin: 20px 0;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.custom-title label {
    display: block;
    margin-bottom: 5px;
    color: #4a5568;
    font-weight: 500;
}

.custom-title input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

/* 検索サイト選択 */
.search-sites {
    margin: 20px 0;
}

.search-sites h3 {
    color: #2d3748;
    margin-bottom: 10px;
}

.search-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-outline {
    background-color: #fff;
    border: 2px solid #3182ce;
    color: #3182ce;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-outline:hover {
    background-color: #3182ce;
    color: white;
}

/* エラーメッセージ */
.error-message {
    background-color: #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

/* フッター */
footer {
    text-align: center;
    padding: 20px 0;
    color: #718096;
    font-size: 14px;
}

/* デバイス別表示 */
.desktop-text {
    display: inline;
}

.mobile-text {
    display: none;
}

.mobile-only {
    display: none;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .upload-area {
        padding: 20px;
    }
    
    .drop-zone {
        padding: 30px 20px;
    }
    
    .site-checkboxes {
        flex-direction: column;
        gap: 10px;
    }
    
    /* モバイルでの表示切り替え */
    .desktop-text {
        display: none;
    }
    
    .mobile-text {
        display: inline;
    }
    
    .mobile-only {
        display: inline-block;
    }
    
    .search-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-links .btn-outline {
        text-align: center;
        width: 100%;
    }
    
    /* モバイルでの関連画像表示 */
    .candidate-images {
        padding-left: 15px;
        gap: 6px;
    }
    
    .similar-image {
        width: 14px !important;
        height: 14px !important;
        max-width: 14px !important;
        max-height: 14px !important;
    }
}