/*
 * SCUM Tool Stylesheet
 * Defines the visual appearance of the application pages.
 */

/* Root variables for the Nord theme */
:root {
    --app-bg: #2E3440;
    --app-text: #D8DEE9;
    --app-field-bg: #525460;
    --app-field-text: #D8DEE9;
    --app-button-bg: #cc3636;
    --app-button-text: #ECEFF4;
    --app-list-bg: #3B4252;
    --app-list-text: #D8DEE9;
    --app-red: #BF616A;
    --app-green: #A3BE8C;
    --app-yellow: #EBCB8B;
    --app-blue: #ffffff;
}

/* Page-specific body styling */
body {
    background-color: var(--app-bg);
    color: var(--app-text);
}

main {
    padding: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Container for the Command Tool */
#app-container {
    background: var(--app-bg);
    border-radius: 14px;
    padding: 24px 28px 18px 28px;
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
}

/* Wider Food Guide Container */
#food-guide-container {
    width: 100%;
    max-width: 95vw;
}

h1 {
    margin: 0;
    font-size: 2.0em;
    letter-spacing: 0.04em;
    text-align: center;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.row label {
    flex-shrink: 0;
}

.col {
    flex: 1;
}

/* Styling for form elements */
select, input[type=text], input[type=number] {
    background: var(--app-field-bg);
    color: var(--app-field-text);
    border: 1px solid var(--app-button-bg);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1.2em;
    width: 100%;
    box-sizing: border-box;
}

select:focus, input:focus {
    outline: 2px solid var(--app-button-bg);
}

/* Button styling */
button, .nav-button {
    background: var(--app-button-bg);
    color: var(--app-button-text);
    border: none;
    border-radius: 7px;
    padding: 10px 18px;
    font-size: 1em;
    cursor: pointer;
    transition: filter 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}

button:hover, .nav-button:hover {
    filter: brightness(1.1);
}

button:active, .nav-button:active {
    filter: brightness(0.92);
}

#item-list {
    width: 100%;
    background: var(--app-list-bg);
    color: var(--app-list-text);
    border: 1px solid var(--app-button-bg);
    border-radius: 7px;
    min-height: 300px;
    max-height: 40vh;
    overflow-y: auto;
    margin-bottom: 10px;
    font-family: inherit;
}

#item-list option {
    padding: 5px 8px;
    background: var(--app-list-bg);
    color: var(--app-list-text);
}

#item-list option:disabled {
    font-weight: bold;
    color: var(--app-button-text);
}

#entry-count {
    font-size: 1em;
    opacity: 0.8;
    margin-left: auto;
}

#command-preview-container {
    margin-top: 10px;
    width: 100%;
}

#command-preview {
    width: 100%;
    text-align: center;
    background-color: var(--app-list-bg);
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
}

#copy-btn {
    flex-grow: 1;
}

.footer-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 15px;
}

#quantity-group {
    display: none;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header-row h1 {
    margin: 0;
    border: none;
    padding: 0;
}

.header-row .nav-button {
    padding: 8px 12px;
    font-size: 1em;
    background-color: var(--app-field-bg);
}


/* Styles for Food Guide Page */
.food-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.food-controls button {
    padding: 8px 12px;
    font-size: 1.2em;
    background: var(--app-field-bg);
    color: var(--app-field-text);
    border: 1px solid var(--app-button-bg);
    border-radius: 6px;
    cursor: pointer;
}

.search-wrapper {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 250px;
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.5em;
    line-height: 1;
    color: var(--app-text);
    opacity: 0.6;
    display: none;
}

.clear-btn:hover {
    opacity: 1;
}

.clear-btn.visible {
    display: block;
}

#food-search {
    padding-right: 30px;
}

#nutrient-filter {
    flex: 1;
    min-width: 200px;
}

#food-list-container {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.food-card {
    background: var(--app-field-bg);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--app-button-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.food-card h3 {
    margin: 0;
    font-size: 1.5em;
    color: var(--app-blue);
    border-bottom: 1px solid var(--app-button-bg);
    padding-bottom: 8px;
}

.food-card h4 {
    margin: 0;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text);
    opacity: 0.6;
    padding-bottom: 4px;
    border-bottom: 3px dotted var(--app-button-bg);
}

.food-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 1.2em;
}

.food-card ul li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 2px solid var(--app-button-bg);
}

.food-card ul li:last-child {
    border-bottom: none;
}

.food-card .nutrient-name {
    opacity: 0.8;
    padding-right: 10px;
    color: #FFFFFF;
}

.food-card .nutrient-value {
    font-weight: bold;
    text-align: right;
    color: #FFFFFF;
}

.food-card .description,
.food-card .notes,
.food-card .warning,
.food-card .special-warning {
    font-size: 1em;
    padding: 8px;
    border-radius: 4px;
    margin: 0;
    line-height: 1.4;
}

.food-card .description {
    opacity: 0.8;
    font-style: italic;
    font-size: 1.1em;
    background-color: rgba(216, 222, 233, 0.03);
}

.food-card .notes {
    background-color: rgba(216, 222, 233, 0.05);
    border-left: 3px solid var(--app-blue);
}

.food-card .warning {
    background-color: rgba(235, 203, 139, 0.1);
    border-left: 3px solid var(--app-yellow);
    color: var(--app-yellow);
}

.food-card .special-warning {
    background-color: rgba(191, 97, 106, 0.1);
    border-left: 3px solid var(--app-red);
    color: var(--app-red);
    font-weight: bold;
}

.toxins-list, .medicinal-list, .farming-info-list {
    border: 1px solid;
    border-radius: 4px;
    padding: 5px 10px !important;
    margin-top: -8px !important;
}

.toxins-list {
    border-color: var(--app-red);
}

.toxins-list li, .toxins-list li span {
    color: var(--app-red) !important;
    opacity: 1;
}

.medicinal-list {
    border-color: var(--app-green);
}

.medicinal-list li, .medicinal-list li span {
    color: var(--app-green) !important;
    opacity: 1;
}

.farming-info-list {
    border-color: var(--app-yellow);
}

.farming-info-list li {
    flex-direction: column;
    align-items: flex-start;
    border-bottom: 1px dotted var(--app-button-bg) !important;
}

.farming-info-list .info-label {
    font-weight: bold;
    opacity: 0.8;
    font-size: 0.8em;
}

.farming-info-list .info-value {
    font-size: 0.9em;
    padding-left: 10px;
}

.toxins-list li, .medicinal-list li, .farming-info-list li {
    border-bottom: none; /* Keep this to override the default for inner list items */
}

/* Highlight for sorted nutrient */
.food-card ul li.highlight {
    background-color: rgba(235, 203, 139, 0.08);
}

.food-card ul li.highlight .nutrient-name,
.food-card ul li.highlight .nutrient-value {
    color: var(--app-yellow);
    font-weight: bold;
    opacity: 1;
}