/* 全体のリセットと基本設定 */
body {
    font-family: 'Inter', Arial, sans-serif; /* Interフォントを優先、なければArial */
    margin: 0;
    padding: 0;
    background-color: #e0e6ed; /* やや薄い背景色 */
    color: #333;
    line-height: 1.6;
    display: flex; /* bodyをflexコンテナにして中央寄せしやすくする */
    flex-direction: column;
    min-height: 100vh; /* 最小高さをビューポートの高さに設定 */
}

/* アプリケーション全体を囲むコンテナ */
#app {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* コンテンツが少ない場合でもフッターを下に配置 */
}

/* ヘッダーセクション */
header {
    background-color: #004d99; /* ダークブルー */
    color: #fff;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 影を追加 */
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

header h1 {
    font-size: 2.5em; /* 大きめのフォント */
    margin: 0;
    letter-spacing: 1px;
    font-weight: bold;
}

/* エラーメッセージのスタイル */
.error-message {
    color: #e74c3c; /* 赤色 */
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 10px;
    opacity: 0; /* デフォルトで非表示 */
    transition: opacity 0.3s ease-in-out; /* フェードイン/アウト */
}

.error-message.visible {
    opacity: 1; /* 表示時にフェードイン */
}

/* メインコンテンツコンテナ */
.container {
    width: 98%; /* 幅を広めに */
    max-width: 1400px; /* ★変更点: 最大幅を1100pxに増加 */
    margin: 30px auto; /* 上下のマージンを増やす */
    background: #ffffff;
    padding: 30px;
    border-radius: 10px; /* 角を丸く */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); /* より強い影 */
    flex-grow: 1; /* コンテンツが少ない場合でもフッターを下に配置 */
    text-align: center; /* コンテンツを中央寄せ */
}

/* システム名バッジ */
.system-name-badge {
    background-color: #3498db; /* 青色 */
    color: white;
    padding: 10px 20px;
    border-radius: 25px; /* 丸いバッジ */
    display: inline-block; /* インラインブロックにして中央寄せ */
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 25px; /* 下にスペース */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 情報表示バッジの共通スタイル */
.info-badge {
    background-color: #f5f7fa; /* 明るい背景 */
    color: #555;
    padding: 8px 15px;
    border-radius: 20px; /* 丸いバッジ */
    display: inline-block;
    font-size: 1.1em;
    margin: 5px; /* バッジ間のスペース */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    /* white-space: nowrap; ★変更点: デフォルトのnowrapを削除または調整 */
    white-space: normal; /* テキストを折り返すように変更 */
    word-break: break-word; /* 長い単語も折り返す */
}

.info-section {
    margin-bottom: 20px;
}

.ai-result-badge {
    background-color: #2ecc71; /* 緑色 */
    color: white;
    font-weight: bold;
}

.environment-info .info-badge.status-success {
    background-color: #28a745; /* 緑 */
    color: white;
}

.environment-info .info-badge.status-danger {
    background-color: #dc3545; /* 赤 */
    color: white;
}

.threshold-info {
    font-size: 0.9em;
    color: #777;
    background-color: #f0f0f0;
    padding: 5px 10px;
    border-radius: 15px;
}

/* 画像コンテナ */
.image-container {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden; /* 角丸を適用 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background-color: #eee; /* 画像読み込み中の背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px; /* 画像がない場合の最小高さ */
}

.live-cam-image {
    max-width: 100%;
    height: auto;
    display: block; /* 余分な下マージンを削除 */
    border-radius: 8px; /* 画像自体の角丸 */
}

/* ボタンのグループ */
.button-group {
    margin-top: 30px;
    text-align: center;
}

/* アクションボタンの共通スタイル */
.action-button {
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 8px; /* 角を丸く */
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    margin: 0 10px; /* ボタン間のスペース */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: white;
    background-color: #007bff; /* デフォルトの青 */
}

.action-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

/* フッターセクション */
footer {
    text-align: center;
    padding: 20px;
    background-color: #004d99; /* ヘッダーと同じ色 */
    color: #ecf0f1;
    margin-top: auto; /* コンテンツが少ない場合でも下に固定 */
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.2); /* 上向きの影 */
}

footer a {
    color: #3498db; /* 青色のリンク */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease-in-out;
}
footer a:hover {
    color: #2980b9;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
    }
    header h1 {
        font-size: 2em;
    }
    .system-name-badge {
        font-size: 1.5em;
        padding: 8px 15px;
    }
    .info-badge {
        font-size: 1em;
        padding: 6px 12px;
        margin: 3px;
    }
    .action-button {
        padding: 10px 20px;
        font-size: 1em;
        margin: 5px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }
    .system-name-badge {
        font-size: 1.2em;
        padding: 6px 12px;
    }
    .info-badge {
        font-size: 0.9em;
        padding: 5px 10px;
        display: block; /* 小さい画面ではブロック要素にして縦に並べる */
        margin: 5px auto; /* 中央寄せ */
        white-space: normal; /* ★変更点: 小さい画面でも折り返す */
        word-break: break-word; /* 長い単語も折り返す */
    }
    .threshold-info {
        font-size: 0.8em;
    }
    .action-button {
        width: calc(100% - 20px); /* 幅いっぱいに広げる */
        margin: 5px auto; /* 中央寄せ */
    }
}
