/* --- Global Styles & Variables --- */
:root {
    --primary-color: #36454F;
    --primary-dark: #708090;
    --secondary-color: #607D8B;
    --background-color: #ECEFF1;
    --text-color: #263238;
    --light-text-color: #ffffff;
    --card-bg: #ffffff;
    --shadow: 0 6px 12px rgba(0,0,0,0.1);
    --border-radius: 10px;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- Navigation Bar --- */
nav {
    background: var(--primary-color);
    color: var(--light-text-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav a {
    color: var(--light-text-color);
    text-decoration: none;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

nav a.logo {
    font-size: 1.5rem;
}

nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* --- Main Content Area --- */
main {
    padding: 2rem;
    max-width: 900px;
    margin: 2rem auto;
    animation: fadeIn 0.7s ease-in-out;
}

/* --- Hero Section (Upload Page) --- */
.hero {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

h1, h2, h3 {
    color: var(--primary-color);
}

.hero p {
    color: #666;
    max-width: 600px;
    margin: 0 auto 1.5rem auto;
}
.note {
    font-size: 0.8rem;
    font-style: italic;
    color: #888;
}

/* --- Sample Image Gallery --- */
.sample-images { margin-bottom: 1.5rem; }
.sample-images p { margin-bottom: 1rem; color: var(--text-color); }
.sample-thumbnail {
    border: none; padding: 0; margin: 5px; cursor: pointer;
    border-radius: 10px; overflow: hidden; display: inline-block;
    transition: transform 0.2s, box-shadow 0.2s;
}
.sample-thumbnail:hover { transform: scale(1.05); box-shadow: var(--shadow); }
.sample-thumbnail img { height: 100px; width: 100px; object-fit: cover; display: block; }
.separator { font-weight: 700; color: var(--secondary-color); margin: 2rem 0 !important; }

/* --- Stacked Form --- */
.stacked-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}
.form-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.form-group label {
    font-weight: bold;
    color: var(--text-color);
}
.coin-select {
    padding: 12px; border: 1px solid #ccc; border-radius: 5px; font-size: 1rem;
    background-color: #fff; min-width: 250px;
}

.button {
    background-color: var(--primary-color); color: var(--light-text-color);
    padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer;
    font-size: 1rem; font-weight: 700; text-decoration: none; display: inline-block;
    transition: background-color 0.3s, transform 0.2s; margin-top: 1rem;
}
.button:hover { background-color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }

input[type="file"] { display: none; }
.file-label {
    background-color: var(--secondary-color); color: var(--light-text-color);
    padding: 12px 25px; border-radius: 5px; cursor: pointer; font-weight: 700;
    transition: background-color 0.3s;
}
.file-label:hover { background-color: #546E7A; }
#file-name { margin-top: 0.5rem; font-style: italic; color: #666; height: 20px; }

/* --- Link to Food List --- */
.food-list-link { margin-top: 2rem; }
.food-list-link a { color: var(--primary-color); text-decoration: none; font-weight: bold; }
.food-list-link a:hover { text-decoration: underline; }

/* --- Spinner Animation & Results Page (Styling is the same) --- */
.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}
.results-container { animation: fadeIn 0.5s ease-in-out; }
.summary-card {
    background: var(--card-bg); padding: 1.5rem; text-align: center;
    border-radius: var(--border-radius); box-shadow: var(--shadow);
    margin-bottom: 2rem;
}
.total-volume-display {
    font-size: 3rem; font-weight: 700; color: var(--primary-color); margin: 0.5rem 0;
}
.estimation-mode { font-style: italic; color: #555; margin-bottom: 1rem; }
.annotated-image img {
    width: 100%; border-radius: var(--border-radius); box-shadow: var(--shadow);
    margin-bottom: 2rem;
}
.results-table, .log-container {
    width: 100%; box-sizing: border-box; background: var(--card-bg);
    border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--shadow);
    margin-bottom: 2rem; padding: 1.5rem;
}
.results-table table { width: 100%; border-collapse: collapse; }
.results-table th, .results-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #ddd; }
.results-table thead tr { background-color: var(--primary-color); color: var(--light-text-color); }
.results-table tbody tr:hover { background-color: #e3f2fd; }
.interactive-cell { cursor: pointer; }
.interactive-cell .main-label { font-weight: bold; }
.alternative-select { width: 100%; margin-top: 5px; font-size: 0.9rem; }
.log-window {
    background-color: #263238; color: #f1f1f1; font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem; padding: 1rem; border-radius: 5px; height: 300px;
    overflow-y: scroll; border: 1px solid #455A64;
}
.log-window pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; }

/* --- Food List Page Column Layout --- */
.food-list-columns {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    
    /* This creates the multi-column layout */
    column-count: 4; /* Adjust the number of columns as needed */
    column-gap: 2rem;
}
.food-item {
    padding: 4px 0;
    font-size: 0.95rem;
    break-inside: avoid-column; /* Prevents items from breaking across columns */
}


@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }