/* Brine calculator styles keep the tool compact while matching the app shell. */
#brineCalcView {
    max-width: 720px;
}

.brine-calc-container {
    padding: 16px;
}

.brine-calc-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.brine-calc-header h2 {
    margin: 0 0 6px;
}

.brine-calc-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.brine-preset-dropdown {
    position: relative;
    margin-bottom: 14px;
}

.brine-preset-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #5f6f52;
    text-align: left;
}

.brine-preset-caret {
    flex: 0 0 auto;
    font-size: 18px;
    line-height: 1;
}

.brine-preset-buttons {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    max-height: min(420px, 56vh);
    padding: 10px;
    overflow-y: auto;
    border: 1px solid rgba(95, 111, 82, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.brine-preset-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 42px;
    padding: 8px;
    border: 1px solid rgba(95, 111, 82, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    color: #2f3f28;
    font-size: 13px;
    line-height: 1.2;
}

.brine-preset-btn small {
    color: inherit;
    font-size: 11px;
    opacity: 0.72;
}

.brine-preset-btn:hover,
.brine-preset-btn.active {
    background: #5f6f52;
    color: #fff;
    opacity: 1;
}

.brine-calc-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.brine-calc-method {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: 1 / -1;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.brine-calc-method legend {
    grid-column: 1 / -1;
    margin-bottom: 2px;
    color: #333;
    font-weight: bold;
}

.brine-calc-method label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    font-weight: bold;
}

.brine-method-help {
    grid-column: 1 / -1;
    width: fit-content;
    padding: 0;
    border: 0;
    background: transparent;
    color: #405235;
    text-align: left;
    font-size: 12px;
    font-weight: bold;
    text-decoration: underline;
    flex: 0 0 auto;
}

.brine-method-help:hover {
    opacity: 0.75;
}

.brine-calc-method input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #4CAF50;
}

.brine-calc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #333;
    font-weight: bold;
}

.brine-calc-field.disabled {
    opacity: 0.48;
}

.brine-calc-field.disabled input,
.brine-calc-field.disabled select {
    cursor: not-allowed;
}

.brine-calc-input-row {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
}

.brine-calc-input-row input {
    width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.brine-calc-unit,
.brine-calc-unit-select {
    min-width: 58px;
    padding: 0 10px;
    border: 0;
    border-left: 1px solid #ddd;
    background: rgba(95, 111, 82, 0.08);
    color: #555;
    text-align: center;
    font: inherit;
    font-weight: bold;
}

.brine-calc-unit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brine-calc-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #333;
    font-size: 16px;
}

.brine-calc-buttons {
    display: flex;
    grid-column: 1 / -1;
    gap: 10px;
    margin-top: 2px;
}

.brine-calc-buttons .secondary-btn {
    background: #666;
}

.brine-calc-result {
    margin-top: 16px;
    padding: 16px;
    border-left: 4px solid #4CAF50;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.brine-calc-result-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    align-items: center;
    text-align: center;
    font-weight: bold;
}

.brine-calc-result-main strong {
    color: #2e7d32;
    font-size: 42px;
    line-height: 1.05;
}

.brine-calc-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 8px;
    color: #555;
    font-size: 14px;
}

.brine-preset-result-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(95, 111, 82, 0.28);
    color: #444;
    font-size: 13px;
    line-height: 1.45;
}

.brine-preset-result-details div + div {
    margin-top: 4px;
}

.brine-preset-content-search {
    width: 100%;
    margin-top: 10px;
    padding: 7px 8px;
    border: 1px solid rgba(95, 111, 82, 0.26);
    border-radius: 8px;
    background: rgba(95, 111, 82, 0.10);
    color: #405235;
    font-size: 12px;
    font-weight: bold;
}

.brine-preset-content-search:hover {
    background: #5f6f52;
    color: #fff;
    opacity: 1;
}

.brine-calc-note {
    margin: 12px 0 0;
    color: #666;
    font-size: 13px;
    line-height: 1.45;
}

.brine-preset-image-wrap {
    position: relative;
    margin: -4px 0 14px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.brine-preset-image {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
}

.brine-preset-image-nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    width: 28px;
    height: 42px;
    min-width: 28px;
    padding: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.36);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    transform: translateY(-50%);
    flex: 0 0 auto;
}

.brine-preset-image-nav:hover {
    background: rgba(0, 0, 0, 0.52);
    opacity: 1;
}

.brine-preset-image-prev {
    left: 8px;
}

.brine-preset-image-next {
    right: 8px;
}

.brine-preset-image-indicator {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 8px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.52);
    color: #fff;
    font-size: 11px;
    line-height: 1.2;
    transform: translateX(-50%);
}

.brine-preset-image-attribution {
    position: absolute;
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    padding: 4px 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 11px;
    line-height: 1.25;
}

.brine-preset-image-attribution a {
    color: inherit;
    text-decoration: none;
}

.brine-preset-image-attribution a:hover {
    text-decoration: underline;
}

.brine-help-modal {
    position: fixed;
    z-index: 2600;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.32);
}

.brine-help-modal-content {
    position: relative;
    width: min(360px, 100%);
    padding: 18px;
    border-radius: 10px;
    background: #fff;
    color: #222;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.brine-help-modal-content h3 {
    margin: 0 34px 10px 0;
}

.brine-help-modal-content p {
    margin: 8px 0 0;
    color: #444;
    font-size: 14px;
    line-height: 1.45;
}

.brine-help-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    border-radius: 50%;
    background: #666;
    line-height: 1;
    flex: 0 0 auto;
}

body.dark-theme .brine-calc-header p,
body.dark-theme .brine-calc-unit,
body.dark-theme .brine-calc-unit-select,
body.dark-theme .brine-calc-result-meta,
body.dark-theme .brine-preset-result-details,
body.dark-theme .brine-calc-note {
    color: #bbb;
}

body.dark-theme .brine-calc-field,
body.dark-theme .brine-calc-method legend {
    color: #eee;
}

body.dark-theme .brine-method-help {
    color: #cfe8cf;
}

body.dark-theme .brine-preset-content-search {
    border-color: #555;
    background: rgba(255, 255, 255, 0.06);
    color: #cfe8cf;
}

body.dark-theme .brine-preset-btn,
body.dark-theme .brine-preset-buttons,
body.dark-theme .brine-calc-method label,
body.dark-theme .brine-calc-input-row,
body.dark-theme .brine-calc-select,
body.dark-theme .brine-calc-result {
    border-color: #555;
    background: rgba(68, 68, 68, 0.86);
    color: #fff;
}

body.dark-theme .brine-preset-btn:hover,
body.dark-theme .brine-preset-btn.active {
    background: #6f805f;
}

body.dark-theme .brine-calc-unit,
body.dark-theme .brine-calc-unit-select {
    border-color: #555;
    background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .brine-calc-result-main strong {
    color: #9adf9d;
}

body.dark-theme .brine-help-modal-content {
    background: #2d2d2d;
    color: #fff;
}

body.dark-theme .brine-preset-image-wrap {
    background: rgba(68, 68, 68, 0.86);
}

body.dark-theme .brine-help-modal-content p {
    color: #ddd;
}

@media (max-width: 640px) {
    .brine-calc-header {
        flex-direction: column;
    }

    .brine-calc-header .back-btn {
        width: 100%;
    }

    .brine-preset-buttons {
        grid-template-columns: 1fr;
    }

    .brine-calc-form {
        grid-template-columns: 1fr;
    }

    .brine-calc-buttons {
        flex-direction: column;
    }

    .brine-calc-result-main {
        flex-direction: column;
        gap: 4px;
    }
}
