:root {
    --main-color: rgba(107, 176, 36);
    --secondary-color: rgba(22, 82, 40);
    --tertiary-color: gold;
    --dark-green: #17332d;
    --light-bg: #f3f7f3;
}

* {
    margin: 0;
    padding: 0;
    border: none;
    box-sizing: border-box;
    outline: none;
    text-decoration: none;
    text-transform: capitalize;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    transition: all .2s ease-in-out;
    list-style: none;
}

html {
    font-size: 62.5%;
}

body {
    min-height: 100vh;
    background-color: var(--light-bg);
    color: var(--dark-green);
}

/* ------------------ Branding Header Context ------------------ */
.header-container {
    background-color: var(--main-color);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 15rem;
}

.header-container #logo {
    height: 10rem;
    width: 10rem;
    background-image: url(images/FATE_logo-title.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    border-radius: 35%;
}

#name-container {
    height: 7rem;
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

#name-container #costumer-name {
    font-size: 3.5rem;
    letter-spacing: .1rem;
    color: whitesmoke;
}

.section_divider {
    display: flex;
    justify-content: center;
}

.section_divider hr {
    border-top: .5rem double var(--tertiary-color);
    width: 100%;
}

/* ------------------ Base Structural Framework ------------------ */
#app-container {
    max-width: 50rem;
    margin: 2rem auto;
    padding: 0 1.5rem;
    margin-bottom: 14rem; /* Keeps content clear of bottom footer */
}

.manual-entry-card {
    background: #ffffff;
    border: 1px solid #dce8e1;
    border-radius: 14px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 12px rgba(23, 63, 53, 0.05);
}

.section-title {
    font-size: 2.2rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

/* ------------------ Input Form Styling Controls ------------------ */
.manual-controls {
    display: flex;
    gap: 0.8rem;
}

input {
    min-width: 0;
    min-height: 4.8rem;
    flex: 1;
    border: 1px solid #afc2bb;
    border-radius: 12px;
    padding: 0.7rem 1.2rem;
    font-size: 1.6rem;
}

input:focus {
    border-color: var(--secondary-color);
}

.manual-controls button {
    min-height: 4.8rem;
    border-radius: 12px;
    padding: 0 1.8rem;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    color: #173f35;
    background: #d9eee5;
}

.field-error {
    color: #a12b2b;
    font-size: 1.3rem;
    margin-top: 0.5rem;
    min-height: 1.5rem;
}

.barcode-result {
    font-size: 1.4rem;
    margin-top: 1rem;
    font-weight: 700;
}

/* ------------------ Pantry Dashboard View Engine ------------------ */
.pantry-placeholder {
    font-size: 1.6rem;
    color: #777;
    text-align: center;
    padding: 3rem 0;
}

.food-card {
    display: flex;
    flex-direction: column;
    position: relative;
    background: #ffffff;
    border-left: 0.6rem solid var(--main-color);
    padding: 1.2rem 3.2rem 1.2rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    cursor: pointer;
}

.food-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.delete-item-button {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: #edf2ef;
    color: #6b7f77;
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
}

.delete-item-button:hover {
    background: #f6dede;
    color: #a12b2b;
}

.food-card-summary {
    display: flex;
    align-items: center;
    width: 100%;
}

.food-card img {
    width: 5rem;
    height: 5rem;
    object-fit: contain;
    margin-right: 1.5rem;
    flex-shrink: 0;
    transition: width .2s ease-in-out, height .2s ease-in-out;
}

.food-card.expanded img {
    width: 9rem;
    height: 9rem;
}

.food-details {
    display: none;
    width: 100%;
    margin-top: 1.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid #e4ede8;
    font-size: 1.3rem;
    line-height: 1.6;
    color: #555;
}

.food-details p {
    margin-bottom: 0.6rem;
}

.food-details p:last-child {
    margin-bottom: 0;
}

.food-details strong {
    color: var(--secondary-color);
}

.food-card.expanded .food-details {
    display: block;
}

.food-info {
    flex-grow: 1;
}

.food-title {
    font-size: 1.6rem;
    font-weight: bold;
    color: #333;
}

.food-expiry {
    font-size: 1.3rem;
    color: #666;
    margin-top: 0.2rem;
}

.eco-badge {
    background-color: var(--secondary-color);
    color: white;
    font-size: 1.1rem;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: bold;
}

/* ------------------ Nav Bar Sticky Footer Layout ------------------ */
.footer-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8rem;
    background-color: var(--main-color); 
    border-top: 0.6rem solid var(--secondary-color);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav {
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: center; 
    align-items: center;
    position: relative;
}

.scan-button-wrapper {
    position: absolute;
    bottom: -1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.scan-action-button {
    background-color: whitesmoke;
    border: 0.3rem solid var(--tertiary-color);
    border-radius: 50%;
    height: 8.5rem;
    width: 8.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.scan-action-button i {
    font-size: 4rem;
    color: var(--secondary-color);
}

.scan-action-button:active {
    transform: scale(0.95);
    background-color: #e2e8f0;
}

/* ------------------ Video Scanner Overlay Modal ------------------ */
.hidden { display: none !important; }
body.scanner-open { overflow: hidden; }

.scanner-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(5, 18, 14, 0.85);
    padding: 1rem;
}

.scanner-container {
    width: min(100%, 42rem);
    border-radius: 18px;
    padding: 1.5rem;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(0,0,0,0.4);
}

.scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.scanner-header h2 {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.close-button {
    background: #edf2ef;
    color: var(--dark-green);
    padding: 0.6rem 1.2rem;
    font-size: 1.3rem;
    border-radius: 8px;
}

.video-frame {
    position: relative;
    overflow: hidden;
    width: 100%;
    border-radius: 14px;
    aspect-ratio: 16 / 10;
    background: #0a0f0d;
}

#scanner-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 92%;
    height: 55%;
    border: 3px solid #b9ff78;
    border-radius: 12px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%);
}

.scan-guide::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 2px;
    background: #b9ff78;
    box-shadow: 0 0 8px #b9ff78;
}

.scanner-status {
    font-size: 1.4rem;
    margin-top: 1.2rem;
    color: #4c615a;
    text-align: center;
}
/* ------------------ Recipe Suggestions Trigger + Panel ------------------ */
.recipe-panel-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background-color: var(--secondary-color);
    color: whitesmoke;
    border-radius: 12px 0 0 12px;
    padding: 1.4rem 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    box-shadow: -4px 0 14px rgba(0,0,0,0.18);
    z-index: 900;
}

.recipe-panel-toggle i {
    font-size: 2rem;
}

.recipe-panel-toggle span {
    font-size: 1.1rem;
    writing-mode: vertical-rl;
    letter-spacing: .05rem;
}

.recipe-panel-toggle:hover {
    background-color: var(--dark-green);
}

.recipe-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(100%, 40rem);
    background: #ffffff;
    box-shadow: -6px 0 28px rgba(0,0,0,0.22);
    z-index: 1000;
    padding: 2rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    overflow-y: auto;
}

.recipe-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.recipe-panel-header h2 {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.recipe-panel-description {
    font-size: 1.4rem;
    color: #555;
    margin-bottom: 1.6rem;
    line-height: 1.5;
    text-transform: none;
}

.generate-recipes-button {
    width: 100%;
    min-height: 4.8rem;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    background-color: var(--main-color);
    cursor: pointer;
    margin-bottom: 1rem;
}

.generate-recipes-button:hover {
    background-color: var(--secondary-color);
}

.generate-recipes-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.recipe-status {
    font-size: 1.3rem;
    color: #666;
    min-height: 1.8rem;
    margin-bottom: 1rem;
    text-transform: none;
}

.recipe-results {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.recipe-card {
    background: var(--light-bg);
    border-left: 0.5rem solid var(--main-color);
    border-radius: 8px;
    padding: 1.2rem;
}

.recipe-title {
    font-size: 1.6rem;
    color: var(--secondary-color);
    margin-bottom: 0.8rem;
}

.recipe-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.recipe-item-tag {
    background: #e2ece6;
    color: var(--dark-green);
    font-size: 1.1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
}

.recipe-item-tag.priority {
    background: gold;
    color: #3d3200;
    font-weight: 700;
}

.recipe-steps {
    padding-left: 1.8rem;
    font-size: 1.3rem;
    color: #444;
    line-height: 1.6;
    text-transform: none;
}

.recipe-steps li {
    margin-bottom: 0.5rem;
}

body.recipe-panel-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .recipe-panel {
        width: 100%;
    }
}