body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.screen {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

h1, h2, h3 {
    margin-top: 0;
}

/* Auth Screen */
#auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 50px;
}

input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

button {
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-buttons button {
    flex: 1;
}

.error {
    color: red;
    margin-top: 10px;
    text-align: center;
}

/* Main Screen */
header {
    margin-bottom: 20px;
}

#daily-summary {
    display: flex;
    justify-content: space-between;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-top: 10px;
}

.macro {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.macro .label {
    font-size: 12px;
    color: #666;
}

.macro .value {
    font-weight: bold;
    font-size: 18px;
}

.scrollable-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 60px; /* Space for FAB */
}

.meal-group-date {
    font-weight: bold;
    margin: 15px 0 5px 0;
    color: #555;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.meal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.meal-info {
    display: flex;
    flex-direction: column;
}

.meal-name {
    font-weight: 500;
}

.meal-details {
    font-size: 12px;
    color: #777;
}

.meal-calories {
    font-weight: bold;
    color: #007bff;
}

.fab {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #28a745;
    color: white;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 10;
}

/* Add Meal Screen */
.back-btn {
    background: none;
    color: #333;
    padding: 0;
    width: auto;
    font-size: 24px;
    margin-right: 10px;
}

.back-btn:hover {
    background: none;
    color: #007bff;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#search-input {
    flex: 1;
}

#btn-scan-barcode {
    width: 46px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#search-results .item-result {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

#search-results .item-result:hover {
    background-color: #f9f9f9;
}

#create-item-prompt {
    text-align: center;
    margin-top: 20px;
}

/* Create Item Screen */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    box-sizing: border-box;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    width: 80%;
    max-width: 350px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

#btn-cancel-record {
    background-color: #6c757d;
}

/* Scanner */
#scanner-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#reader {
    width: 100%;
    max-width: 600px;
}

#btn-close-scanner {
    margin-top: 20px;
    background-color: white;
    color: black;
    width: auto;
    padding: 10px 30px;
}
