html,
body{
    height:100%;
}

body{
    min-height:100vh;
    display:flex;
    flex-direction:column;
}

main{
    flex:1;
}

/* =========================
   ベース
========================= */
body{
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
}

#customLegend{
    display:grid;
    grid-template-columns: repeat(2,1fr);
    gap:10px;
}

/* =========================
   ナビバー固定
========================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;

    background: #5cae56;
    color: white;
    border-bottom: 1px solid #ddd;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 0 20px;
    z-index: 1000;

    box-sizing: border-box; /* ★これを追加 */
}

.navbar a {
    color: white;
    text-decoration: none;
    margin-left: 15px;
}

/* ナビバー分の余白を確保 */
body {
    padding-top: 50px;
}

.navbar div:last-child {
    white-space: nowrap;
}

/* =========================
   ナビバーボタン
========================= */
.nav-btn{
    color: #fff;
    text-decoration: none;

    border: 1.5px solid #fff;
    border-radius: 20px;

    padding: 6px 14px;
    margin-left: 10px;

    display: inline-block;
    font-size: 14px;

    transition: all 0.2s ease;
}

/* ホバーで少しだけ変化 */
.nav-btn:hover{
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* =========================
   フッター
========================= */
.footer{
    background:#5cae56;
    color:white;

    display:flex;
    justify-content:space-between;
    align-items:center;

    padding:12px 20px;
    margin-top:30px;
}

.footer a{
    color:white;
    text-decoration:none;
}

.footer a:hover{
    text-decoration:underline;
}

/* =========================
   ハンバーガーメニュー
========================= */

.hamburger-area{
    position:relative;
}

.hamburger-btn{
    background:none;
    border:none;
    color:white;
    font-size:24px;
    cursor:pointer;
    box-shadow:none;
    padding:0 10px;
}

.hamburger-btn:hover{
    background:none;
}

.hamburger-menu{
    display:none;
    position:absolute;
    right:0;
    top:50px;
    background:white;
    min-width:220px;
    border-radius:10px;
    box-shadow:0 4px 15px rgba(0,0,0,0.2);
    overflow:hidden;
    z-index:2000;
}

.hamburger-menu.show{
    display:block;
}

.hamburger-menu a{
    display:block;
    padding:12px 16px;
    color:#333;
    text-decoration:none;
    border-bottom:1px solid #eee;
}

.hamburger-menu a:hover{
    background:#f5f5f5;
}

.user-email{
    margin-right:10px;
}

/* =========================
   レイアウト
========================= */
.container{
    padding:0px;
}

h1{
    text-align:center;
}

/* =========================
   カード　width:96.5%; e5e5e5
========================= */
.card{
    background:rgb(255, 255, 255);
    border:2px solid #e5e5e5;
    padding: 15px 20px 15px;
    border-radius:12px;
    box-shadow:0 4px 10px rgba(0, 0, 0, 0.08);
    margin-bottom:10px;
    line-height:1.2;
}

.card__title {
  padding: 0rem 0rem 0;
  font-size: 1.25rem;
}

.card h3{
    margin-top: 0px;
    margin-bottom: 10px;
}

.card-input{
    line-height:1.0;
}

.card-section{
    padding-top: 0px;
    margin-bottom:0px;
}

.separator-rownormal{
    border-top:2px solid #ccc;
    padding-top:15px;
    margin:10px 0;
}

/* =========================
   フレックス
========================= */
.flex{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

/* 横並びの本体 */
.row-flex{
    display:flex;
    justify-content:space-between;
    align-items:center;
    white-space:nowrap; /* ← 折り返し禁止の本体 */
}

/* =========================
   画像
========================= */
img{
    border-radius:8px;
}

.preview{width:400px;}
.result{width:400px;}
.crop{width:200px;}

/* =========================
   ファイル選択とカメラボタン
========================= */
/* 本物の input は非表示 */
.hidden-file-input {
    display: none;
}

/* おしゃれなボタン風ラベル */
.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 2px;
    height: 28px;

    background: #868aa5;
    color: white;

    padding: 5px 15px;
    border-radius: 8px;

    font-size: 14px;
    cursor: pointer;

    /* ← 影を強化 */
    box-shadow: 0 6px 14px rgba(0,0,0,0.22);

    transition: 0.2s;
    text-align: center;
}

.upload-btn:hover {
    background: #74778e;

    /* hover時さらに少し浮かせる */
    box-shadow: 0 8px 18px rgba(0,0,0,0.28);
}

/* アイコン */
.btn-icon {
    width: 36px;
    height: 36px;

    display: block;
    flex-shrink: 0;

    position: relative;
    top: 6px;
}

/* 文字 */
.upload-btn span {
    line-height: 1;
}

/* 上下ボタン間のマージン */
.upload-group {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.action-group {
    display: flex;
    gap: 8px;
}

/* =========================
   ボタン
========================= */
button{
    padding:8px 20px;
    font-size: 14px;

    border:none;
    border-radius:8px;

    background:#007aff;
    color:white;
    cursor:pointer;

    /* ← 影追加 */
    box-shadow: 0 5px 12px rgba(0,0,0,0.20);
    transition: 0.2s;
}

button:hover{
    background:#005ecb;

    /* hover時 */
    box-shadow: 0 7px 16px rgba(0,0,0,0.28);
}

button:disabled{
    background:#aaa;
    cursor:not-allowed;
}

/* =========================
   管理者ボタン
========================= */
.admin-buttons{
    display:flex;
    gap:10px;
    margin-bottom:15px;
}

.admin-buttons button{
    min-width:120px;
}

/* =========================
   完了状態ボタン
========================= */
button.done{
    background:#28a745 !important;
}

button.done:hover{
    background:#218838 !important;
}

/* =========================
   入力
========================= */
input{
    border-radius:6px;
    border:1px solid #ccc;
}

input[type="text"]{
    padding:5px;
    width:200px;
}

input[type="date"]{
    padding:4px;
    width:100px;
}

input[type="number"]{
    padding:5px;
    width:100px;
}

.input-unit{
    display:inline-flex;
    align-items:center;
    gap:8px;
}

/* =========================
   メモ入力
========================= */
.memo-row{
    display:flex;
    align-items:center;
    gap:4px;
}

.memo-row textarea{
    flex:1;

    padding:3px 8px;

    border-radius:6px;
    border:1px solid #ccc;

    font-size:14px;
    line-height:1.4;

    font-family:inherit;

    resize:vertical;
    box-sizing:border-box;
}

/* =========================
   メッセージ
========================= */
#loading{
    display:none;
    text-align:center;
    font-weight:bold;
    color:#007aff;
}

#error{
    color:red;
    font-weight:bold;
    text-align:center;
    margin-bottom:10px;
}

/* =========================
   地図
========================= */
#map{
    width:100%;
    height:350px;
    border-radius:12px;
    margin-top:10px;
    border:2px solid #ddd;
}

/* =========================
   グラフ
========================= */
.chart-wrapper{
    width:100%;
    display:flex;
    justify-content:center;
    align-items:center;
    margin:auto;
    max-width:500px;
    height:500px;
}

.chart-wrapper canvas{
    width:100% !important;
    height:100% !important;
}

/* =========================
   アオコレベル判定確率棒グラフ
========================= */
.bar-chart {
    margin-top: 10px;
}

.bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.bar-label {
    width: 40px;
    font-size: 13px;
}

.bar-container {
    flex: 1;
    background: #eee;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin: 0 8px;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.bar-value {
    width: 50px;
    text-align: right;
    font-size: 12px;
}

.bar-fill.active {
    background: linear-gradient(90deg, #ff7e5f, #feb47b);
}

/* =========================
   テーブル
========================= */
.result-table{
    width:100%;
    table-layout:fixed;
    border-collapse:collapse;
}

.result-table tr{
    background:#fff;
    box-shadow:0 2px 6px rgba(0,0,0,0.08);
    border-radius:10px;
}

.result-table td{
    padding:10px;
    border:none;
}

.separator-row td{
    border-top:2px solid #ccc;
    padding-top:15px;
}

.result-label{
    overflow:hidden;
    text-overflow:ellipsis;
}

.result-value{
    width:40%;
    text-align:right;
    white-space:nowrap;
}

.total-cell{
    font-size:22px;
    font-weight:bold;
}


#resultTable {
    width: 100%;
    border-collapse: collapse;
}

/* =========================
   テーブル list.html用
========================= */
#resultTable th,
#resultTable td {
    text-align: center;
    vertical-align: middle;
    padding: 5px;
}

#resultTable img {
    display: block;
    margin: 0 auto;
}

/* =========================
   総細胞数 強調
========================= */
.total-row td{
    font-size:1.2rem;
    font-weight:bold;
}

/* ラベル側だけ少し控えめにしたい場合 */
.total-row .result-label{
    font-size:1.2rem;
}

/* 数値をさらに強調 */
.total-row .total-cell{
    font-size:1.4rem;
    font-weight:bold;
    color:#000000;
}

/* =========================
   アオコレベル数値色
========================= */
.level-high{color:red;font-weight:bold;}
.level-mid{color:orange;font-weight:bold;}
.level-low{color:green;font-weight:bold;}
.level-none{color:#999;font-style:italic;}

/* =========================
   凡例
========================= */
.custom-legend{
    display:grid;
    grid-template-columns: repeat(2, 1fr);
    gap:10px 20px;
    margin-top:15px;
}

.legend-item{
    display:flex;
    align-items:center;
    gap:10px;
    background:#f9fafb;
    padding:10px 12px;
    border-radius:10px;
}

.legend-left{
    display:flex;
    align-items:center;
    gap:8px;
}

.legend-color{
    width:12px;
    height:12px;
    border-radius:50%;
}

.legend-value{
    margin-left:8px;
    font-weight:bold;
}

/* =========================
   レスポンシブ
========================= */
@media (max-width:600px){

    .chart-wrapper{
        max-width:250px;
        height:250px;
    }

    .custom-legend{
        grid-template-columns: 1fr;
    }

    .result-table tr{
        display:block;
        margin-bottom:10px;
    }

    .result-table td{
        display:block;
    }

    .result-value{
        text-align:right;
        margin-top:5px;
    }
}

/* =========================
   投稿一覧編集
========================= */
.edit-lake,
.edit-location,
.edit-date{
    width:140px;
}

.edit-memo{
    width:100px;
    min-height:100px;
}

.save-btn{
    min-width:70px;
}

.delete-btn{
    background:#dc3545;
}

.delete-btn:hover{
    background:#bb2d3b;
}

/* =========================
   ユーザーテーブル
========================= */
#userTable{
    width:100%;
    border-collapse:collapse;
}

#userTable th,
#userTable td{
    padding:8px;
    text-align:center;
}

#userTable textarea{
    width:250px;

}

#userTable input{
    width:180px;
}

/* =========================
   管理者ページ
========================= */

.admin-container{
    width:100%;
    max-width:none;
    padding:10px;
}

.admin-card{
    width:100%;
}

/* テーブル */
#userTable{
    width:100%;
    table-layout:fixed;
    border-collapse:collapse;
}

/* セル */
#userTable th,
#userTable td{
    padding:8px;
    vertical-align:top;

    white-space:normal;
    word-break:break-word;
    overflow-wrap:anywhere;
}

/* 入力欄 */
#userTable input{
    width:100%;
    min-width:120px;
    box-sizing:border-box;
}

/* メモ欄 */
#userTable textarea{
    width:100%;
    min-height:50px;

    resize:vertical;
    box-sizing:border-box;

    white-space:pre-wrap;
    word-break:break-word;
}