body {
    font-family: monospace;
    padding: 20px;
    background-color: #f4f4f4;
}

form {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

label {
    display: block;
    /* margin-bottom: 10px; */
    font-weight: bold;
}

input[type="text"],
textarea,
select {
    width: 90%;
    padding: 10px;
    /* margin-bottom: 10px; */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    font-family: monospace;
}

input[type="submit"] {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    /* font-size: 16px; */
    font-family: monospace;
}

input[type="submit"]:hover {
    background-color: #1a2533;
}

.loader {
    position: fixed;
    /* Change from absolute to fixed */
    top: 50%;
    /* Centering adjustments */
    left: 50%;
    /* Centering adjustments */
    transform: translate(-50%, -50%);
    /* Centering adjustments based on its own width and height */
    width: 120px;
    /* Adjusted size */
    height: 120px;
    /* Adjusted size */
    border-radius: 50%;
    perspective: 800px;
    /* background-color: "transparent"; */
    display: none;
}


.inner {
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.inner.one {
    left: 0%;
    top: 0%;
    animation: rotate-one 1s linear infinite;
    border-bottom: 3px solid #ffb02e;
}

.inner.two {
    right: 0%;
    top: 0%;
    animation: rotate-two 1s linear infinite;
    border-right: 3px solid #ffb02e;
}

.inner.three {
    right: 0%;
    bottom: 0%;
    animation: rotate-three 1s linear infinite;
    border-top: 3px solid #ffb02e;
}

@keyframes rotate-one {
    0% {
        transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
    }
}

@keyframes rotate-two {
    0% {
        transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
    }
}

@keyframes rotate-three {
    0% {
        transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
    }
}

.viewButtons {
    background-color: #4b2828;
    color: #ffffff;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    /* font-size: 16px; */
    font-family: monospace;
}

.dlButtons {
    background-color: #284b38;
    color: #ffffff;
    /* padding: 10px 15px; */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    /* font-size: 16px; */
    font-family: monospace;
}

.viewButtons:hover {
    background-color: #4b2828;
}

.settingsButtons {
    background-color: brown;
    color: #ffffff;
    /* padding: 10px 15px; */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    /* font-size: 16px; */
    font-family: monospace;
}

ul {
    list-style-type: none;
    padding: 0;
}

ul li {
    background-color: #ffffff;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 90%;
}

.entry {
    position: relative;
    padding: 10px;
    margin: 10px 0;
    /* border: 1px solid #ddd; */
    list-style-type: none;
}

.delete-entry {
    position: absolute;
    top: 0;
    right: 0;
    border: none;
    /* background-color: white; */
    cursor: pointer;
    margin-right: 5px;
}

#entryItems {
    height: 100px;
}

/* Custom styles for input fields, select boxes, and buttons */
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* width: 90%; */
    /* padding: 10px; */
    border: 1px solid #2c3e50;
    border-radius: 4px;
    /* font-size: 16px; */
    font-family: monospace;
    background-color: #2c3e50;
    color: #ffffff;
    /* margin-top: 20px; */
    margin-bottom: 5px;
    height: 35px;
}

select {
    -webkit-appearance: none;
    /* Removes default styling on iOS */
    -moz-appearance: none;
    /* Removes default styling on Firefox */
    appearance: none;
    /* Removes default styling for other browsers */
    /* width: 90%; */
    padding: 10px;
    /* border: 1px solid #ccc; */
    border-radius: 4px;
    /* font-size: 16px; */
    font-family: monospace;
    background-color: white;
    color: black;
}

@media (max-width: 480px) {
    /* body {
        padding: 5px;
    } */

    form {
        padding: 10px;
    }

    input[type="text"],
    textarea,
    select {
        font-size: 14px;
        padding: 5px;
    }

    input[type="submit"] {
        padding: 5px 10px;
        font-size: 14px;
    }

    ul li {
        padding: 5px;
    }
}

#entriesForm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    /* This will vertically align the items in the form */
    gap: 10px;
    /* This creates a small gap between form items */
}

#newFoodItem,
#addFoodItem {
    flex-grow: 1;
    flex-basis: auto;
    /* This allows them to grow and shrink as needed */
    width: auto;
    /* Override the width so they can be next to each other */
    margin-right: 0;
    /* Override any margin that might push them apart */
}

#addFoodItem {
    padding: 10px;
    /* Consistent with other inputs */
    font-size: 16px;
    /* Match the font size of other elements */
    line-height: normal;
    /* This ensures the button is aligned with the input field */
    vertical-align: middle;
    /* Aligns the button with the middle of the input field */
    margin-left: -1px;
    /* This helps the button align flush with the input */
}

/* Responsive adjustments */
@media (max-width: 480px) {

    #newFoodItem,
    #addFoodItem {
        flex-grow: 0;
        margin-right: 4px;
        /* Adjust the spacing as necessary */
        width: auto;
        /* Ensure the width is automatically adjusted on small screens */
    }

    #addFoodItem {
        padding: 5px 10px;
        font-size: 14px;
        /* Match the font size for small screens */
    }
}

.dashboard-item {
    background-color: #f9f9f9;
    margin: 10px;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#dateGreeting {
    font-size: 1.5em;
    margin-bottom: 30px;
}

#todoSummary h2 {
    color: #333;
    margin-bottom: 15px;
}

#todoSummaryList li {
    line-height: 1.6;
    font-size: 1.2em;
}

.hidden {
    display: none;
}

.todo-entry.collapsed .entry-content {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.todo-entry .entry-content {
    white-space: pre-wrap;
    /* preserve whitespace and newlines */
}

.todo-entry {
    cursor: pointer;
    /* Optional: gives a visual cue that the item is clickable */
    transition: max-height 0.3s ease;
    /* Smooth transition for expanding/collapsing */
    /* Additional styling */
}

.dark-theme {
    background-color: #2c3e50;
    /* dark body background */
}

.dark-theme h2 {
    color: aliceblue;
    /* light blue for headings */
}

.dark-theme button {
    background-color: #ffb02e;
    /* orange for buttons */
    color: #2c3e50;
    /* dark text on buttons */
    border: 1px solid #ffb02e;
    /* dark border for buttons */
}

.dark-theme ul li,
.dark-theme .dashboard-item,
.dark-theme form,
/* .chat-input-area, */
.chatContent,
.dark-theme #todoSummary h2 {
    background-color: #657280;
    /* slightly lighter than body bg for contrast */
    color: aliceblue;
    /* light text color */
}

.dark-theme input[type="text"],
.dark-theme textarea,
.dark-theme select {
    border: 1px solid #2c2e31;
    background-color: #2c2e31;
    color: aliceblue;
    /* dark text on buttons */
}

#openAiSection {
    justify-content: flex-end;
    align-items: flex-end;
    position: fixed;
    bottom: -12px;
    right: 14px;
    /* opacity: 0.6; */
    font-size: xx-large;
}

/* Modal Backdrop */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgb(0, 0, 0);
    /* Fallback color */
    background-color: rgba(0, 0, 0, 0.4);
    /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
    background-color: #657280;
    margin: 15% auto;
    /* 15% from the top and centered */
    padding: 20px;
    /* border: 1px solid #888; */
    width: 50%;
    /* Could be more or less, depending on screen size */
    border-radius: 5px;
    color: aliceblue;
}

/* Dropdown and Textarea Styling */
#instructionOptions,
#aiContext,
#toneOptions {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    /* border: 1px solid #ccc; */
    border-radius: 4px;
    box-sizing: border-box;
    /* Makes sure padding doesn't affect overall width */
}

/* Button Styling */
#submitContext {
    width: 100%;
    /* background-color: #4CAF50; */
    /* color: white; */
    padding: 14px 20px;
    margin: 8px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .modal-content {
        width: 80%;
    }
}


/* The Close Button */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.chat-window {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* position: fixed;
    bottom: 10px;
    right: 10px;
    width: 340px; */
    /* Larghezza desktop */
    max-height: 70vh;
    /* Usa 70% dell’altezza disponibile */
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    z-index: 1000;
    background-color: #f9f9f9;
    /* o #657280 in dark theme */
}

/* Ridimensionamento su schermi stretti */
@media (max-width: 600px) {
    .chat-window {
        /* width: 90%; */
        left: 5%;
        right: 5%;
        bottom: 0;
        max-height: 60vh;
        /* border-radius: 6px 6px 0 0; */
        /* stile “drawer” dal basso */
    }
}

.close-chat {
    background: transparent;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #888;
    margin-left: auto;
    /* spinge il bottone a destra */
}

.close-chat:hover {
    color: #333;
}

.chat-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    /* background: #fff; */
    /* o #2c2e31 in dark theme */
}

.user-message,
.ai-message {
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 4px;
    /* max-width: 80%; */
    word-wrap: break-word;
    /* line-height: 1.4; */
    /* font-size: 14px; */
}

/* Mantieni colorazioni diverse */
.user-message {
    background-color: #2c3e50;
    color: #fff;
    align-self: flex-end;
}

.ai-message {
    background-color: #e9e9eb;
    color: #000;
    align-self: flex-start;
}

.chat-input-area {
    display: flex;
    /* align-items: center; */
    gap: 5px;
    padding: 10px;
    background-color: #ddd;
    /* o scuro se in dark mode */
    /* border-top: 1px solid #ddd; */
}

.chat-input-area input[type="text"] {
    flex-grow: 1;
    /* border: 1px solid #ccc; */
    border-radius: 4px;
    padding: 8px;
    font-size: 14px;
}

.chat-input-area button {
    /* background-color: #007bff; */
    border: none;
    border-radius: 4px;
    padding: 8px 10px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}

.chat-input-area button:hover {
    background-color: #0056b3;
}

.hidden {
    display: none;
}
