/* style.css */

/* 基本的なリセットとフォント設定 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

header {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    color: #2c3e50;
}

main {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 15px;
}

section {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* アップロードセクション */
.upload-section input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: 10px;
    box-sizing: border-box; /* paddingとborderをwidthに含める */
}

.upload-section .instruction {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* プレビューセクション */
.image-container {
    border: 2px dashed #a0a0a0;
    border-radius: 8px;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* 画像がはみ出さないように */
    position: relative; /* canvasの重ね合わせのため */
    background-color: #e9ecef;
}

#imagePreview {
    max-width: 100%;
    max-height: 400px; /* プレビューの高さを制限 */
    height: auto;
    display: block; /* 余分なスペースを削除 */
}

#analysisCanvas {
    position: absolute; /* プレビュー画像に重ねる */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 中央配置 */
    /* widthとheightはJavaScriptで設定するため、ここではmin-width/height程度 */
    max-width: 100%;
    max-height: 400px;
    display: block;
}


/* メッセージ表示 */
.loading-message {
    text-align: center;
    font-weight: bold;
    color: #3498db; /* 青色 */
    margin-top: 15px;
}

.error-message {
    text-align: center;
    font-weight: bold;
    color: #e74c3c; /* 赤色 */
    margin-top: 15px;
}

/* 結果表示セクション */
.results-display {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-height: 100px;
    background-color: #f8f9fa;
}

.results-display p {
    margin: 5px 0;
    font-size: 1.1em;
}

.results-display span.label {
    font-weight: bold;
    color: #555;
    display: inline-block;
    width: 80px; /* ラベルの幅を固定して揃える */
}

/* フッター */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    color: #7f8c8d;
    font-size: 0.85em;
    border-top: 1px solid #eee;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    main {
        margin: 10px auto;
        padding: 0 10px;
    }

    section {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.4em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.2em;
    }
    
    .results-display span.label {
        width: 60px; /* モバイルではラベル幅を調整 */
    }
}