/* ブラウザー版の見た目。色は Windows・Android 版（Resources/Styles/Colors.xaml）に合わせる */
:root {
    --pizza-red: #FF0000;
    --pizza-red-dark: #C00000;
    --pizza-red-light: #FFD6D6;
    --gray-300: #ACACAC;
    --gray-500: #6E6E6E;
    --text: #212121;
    --background: #FFFFFF;
    --tab-height: 56px;
    /* Windows・Android 版と同じく、常にライトモードで表示する */
    color-scheme: light only;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

h1 {
    font-size: 22px;
    margin: 4px 0 12px;
}

/* ---- 全体の枠（上の帯・下のタブ） ---- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--pizza-red);
    color: #FFFFFF;
    font-weight: bold;
    font-size: 17px;
    text-align: center;
    padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}

.app-main {
    padding-bottom: calc(var(--tab-height) + env(safe-area-inset-bottom) + 16px);
}

.tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    background: var(--pizza-red);
    padding-bottom: env(safe-area-inset-bottom);
}

.tab {
    flex: 1;
    height: var(--tab-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pizza-red-light);
    text-decoration: none;
    font-weight: bold;
}

    .tab.active {
        color: #FFFFFF;
        box-shadow: inset 0 -3px 0 #FFFFFF;
    }

.page {
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

    .page p {
        margin: 0;
    }

/* ---- 文字 ---- */
.field-label {
    font-weight: bold;
    margin-top: 4px;
}

.note {
    color: var(--gray-500);
    font-size: 13px;
}

    .note.small {
        font-size: 12px;
    }

.pre {
    white-space: pre-line;
}

.error {
    color: var(--pizza-red-dark);
}

.warning {
    color: #B35C00;
    font-size: 13px;
}

.warning-box {
    border: 1px solid #E6A23C;
    background: #FFF6E5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
}

/* ---- 入力 ---- */
input[type=text], input[type=date], input[type=time] {
    font: inherit;
    /* iPhone は 16px 未満の入力欄をタップすると画面が拡大されるため、16px にする */
    font-size: 16px;
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: #FFFFFF;
    color: var(--text);
    min-width: 0;
}

    input[type=text]:focus, input[type=date]:focus, input[type=time]:focus {
        outline: 2px solid var(--pizza-red);
        outline-offset: -1px;
    }

.date-input {
    align-self: flex-start;
}

.num {
    text-align: right;
    width: 100%;
}

    .num.wide {
        width: 140px;
    }

input[type=checkbox] {
    width: 22px;
    height: 22px;
    accent-color: var(--pizza-red);
    margin: 0;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.during {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 残数の表。スマホの幅でも 1 行に収まるよう、生地名の列を固定にして残りを 3 等分する */
.stock-grid {
    display: grid;
    grid-template-columns: 52px 1fr 1fr 1fr;
    gap: 6px;
    align-items: center;
}

    .stock-grid.header {
        margin-top: 8px;
        font-weight: bold;
    }

.dough-name {
    font-size: 18px;
}

.stock-grid.header .dough-name {
    font-size: 16px;
}

.color-badge {
    display: block;
    text-align: center;
    font-weight: bold;
    white-space: nowrap;
    border-radius: 6px;
    padding: 4px;
}

    .color-badge.large {
        align-self: flex-start;
        display: inline-block;
        font-size: 22px;
        padding: 2px 8px;
        margin-top: 8px;
    }

.sold-out {
    display: flex;
    flex-wrap: wrap;
    column-gap: 16px;
}

/* ---- ボタン ---- */
button, .file-button {
    font: inherit;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    text-align: center;
}

    button.primary {
        background: var(--pizza-red);
        color: #FFFFFF;
        border: none;
        font-weight: bold;
    }

        button.primary.big {
            font-size: 20px;
            min-height: 56px;
        }

    button.secondary, .file-button {
        background: #FFFFFF;
        color: var(--pizza-red);
        border: 1px solid var(--pizza-red);
        font-weight: bold;
    }

    button:disabled, .file-button.disabled {
        opacity: 0.5;
        cursor: default;
    }

/* ファイル選択の入力欄は見えなくし、ボタンの形の枠全体で選べるようにする */
.file-button {
    position: relative;
    display: block;
}

    .file-button input[type=file] {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
    }

/* ---- 結果 ---- */
.completed {
    border: 1px solid #2E7D32;
    background: #E8F5E9;
    color: #2E7D32;
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
    font-weight: bold;
}

/* 計算後に自動でスクロールしたとき、上の帯に隠れないようにする */
.scroll-anchor {
    scroll-margin-top: calc(env(safe-area-inset-top) + 60px);
}

.result {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-card {
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .result-card .num {
        width: 90px;
    }

.result-name {
    font-size: 22px;
    font-weight: bold;
}

.result-quantity {
    font-size: 28px;
    font-weight: bold;
    color: var(--pizza-red);
}

.basis {
    font-size: 13px;
}

/* ---- 読み込み中・エラー ---- */
.loading {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--pizza-red);
    color: #FFFFFF;
}

.loading-title {
    font-size: 24px;
    font-weight: bold;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem calc(0.7rem + env(safe-area-inset-bottom)) 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }
