:root {
    --bg-color: #f0f0f0;
    --container-bg: #ffffff;
    --text-color: #333333;
    --button-bg: #FF9800; /* Orange for food appetite */
    --button-hover: #F57C00;
    --button-text: #ffffff;
    --accent-color: #4CAF50;
}

body.dark-mode {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --button-bg: #FFB74D;
    --button-hover: #FF9800;
    --button-text: #000000;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
    padding: 20px 0; /* Add padding for mobile scrolling */
}

.container {
    position: relative;
    text-align: center;
    background-color: var(--container-bg);
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
    max-width: 400px;
    width: 90%;
    margin: auto; /* Ensure centering with body padding */
}

h1 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.result-area {
    min-height: 200px; /* Increased height for image */
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
}

.placeholder-text {
    color: #888;
    font-style: italic;
}

.food-card {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 10px;
    width: 100%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.food-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: #ccc; /* Placeholder color while loading */
}

.food-card h2 {
    margin: 0;
    color: var(--button-hover);
    font-size: 1.3rem; /* Slightly smaller to fit */
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loader {
    font-size: 1.2rem;
    color: var(--text-color);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#generate-button {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#generate-button:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
}

#generate-button:active {
    transform: translateY(0);
}

#theme-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    opacity: 0.7;
}

#theme-toggle:hover {
    background-color: var(--text-color);
    color: var(--container-bg);
    opacity: 1;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.nav-logo {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--text-color);
    text-decoration: none;
}

.nav-links a {
    margin-left: 15px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.subtitle {
    color: #666;
    margin-top: -1rem;
    margin-bottom: 2rem;
}

body.dark-mode .subtitle {
    color: #aaa;
}

/* Content Sections */
.content-section {
    margin-bottom: 3rem;
}

.text-content {
    text-align: left;
    line-height: 1.6;
}

.text-content h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--button-bg);
}

.partnership-section {
    margin-top: 1rem;
    text-align: left;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
    color: #888;
}

footer a {
    color: var(--button-bg);
    text-decoration: none;
}

.partnership-section hr, .animal-test-section hr {
    border: 0;
    border-top: 1px solid #eee;
    margin-bottom: 1.5rem;
}

.partnership-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.form-group {
    margin-bottom: 0.8rem;
}

.partnership-section input, 
.partnership-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box; /* Ensures padding doesn't affect width */
    font-size: 0.9rem;
}

.partnership-section textarea {
    height: 80px;
    resize: vertical;
}

#submit-button, .action-btn {
    width: 100%;
    background-color: #333;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.action-btn {
    background-color: #4CAF50; /* Green for start action */
}

.action-btn:hover {
    background-color: #388E3C;
}

body.dark-mode #submit-button {
    background-color: #555;
}

#submit-button:hover {
    background-color: #000;
}

body.dark-mode #submit-button:hover {
    background-color: #777;
}

/* Animal Test Section */
.animal-test-section {
    margin-top: 2.5rem;
    text-align: center;
}

.animal-test-section hr {
    border: 0;
    border-top: 1px solid #eee;
    margin-bottom: 1.5rem;
}

#webcam-container {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

#label-container {
    margin-top: 1rem;
    text-align: left;
}

.label-wrapper {
    margin-bottom: 8px;
}

.label-name {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.label-bar-bg {
    width: 100%;
    background-color: #eee;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

body.dark-mode .label-bar-bg {
    background-color: #444;
}

.label-bar-fill {
    height: 100%;
    background-color: #ccc;
    width: 0%;
    transition: width 0.1s linear, background-color 0.3s;
}