/* ==========================================
   MACROMATE STYLES
   ========================================== */

/* Outer Wrapper & Container */
.macromate-app {
	width: 100%;
    margin-bottom: 40px;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    text-align: left;
    overflow: hidden;
    padding: 35px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    font-family: inherit;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Tabs Navigation */
.mm-tabs {
    display: flex;
    margin-bottom: 25px;
}

.mm-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-weight: 600;
    cursor: pointer;
    color: #061d33;
    border-bottom: 3px solid #f1f1f1;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mm-tab.active {
    border-color: #061d33;
    color: #061d33;
}

.mm-tab:hover {
    background: #f9f9f9;
}

.mm-tab-content {
    display: none;
}

.mm-tab-content.active {
    display: block;
}

/* Day Tabs (Horizontal Scroll) */
.mm-day-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ddd;
    overflow-x: auto;
}

.mm-day-tabs::-webkit-scrollbar {
    height: 6px;
}

.mm-day-tabs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.mm-day-tab {
    position: relative;
    padding: 0.5rem 1rem;
    border: none;
    background: #f2f2f2;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.mm-day-tab.active {
    background: #061d33;
    color: white;
    font-weight: bold;
}

/* Notification Dot for Days with Food */
.mm-day-tab.has-food::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    background-color: #4CAF50;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #f2f2f2;
    transition: box-shadow 0.2s;
}

.mm-day-tab.active.has-food::after {
    box-shadow: 0 0 0 2px #061d33;
}

/* Macro Dashboard */
.mm-dashboard {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.mm-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mm-dashboard-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.mm-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.mm-btn-icon:hover {
    transform: rotate(45deg);
}

.mm-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    text-align: center;
}

.mm-stat-box {
    display: flex;
    flex-direction: column;
    background: white;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.mm-stat-label {
    font-size: 0.75rem;
    color: #777;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.mm-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
}

.mm-stat-target {
    font-size: 0.75rem;
    color: #999;
    font-weight: 400;
}

/* Meal Sections & Lists */
.mm-meal-section {
    margin-bottom: 25px;
}

.mm-meal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.mm-meal-header h4 {
    margin: 0;
    color: #061d33;
}

.mm-meal-subtotal {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.mm-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mm-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #f2f2f2;
}

.mm-item-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mm-item-name {
    font-size: 15px;
    font-weight: 600;
}

.mm-item-macros {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

/* Portion Controls inside List Item */
.mm-portion-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mm-qty-input {
    width: 50px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

.mm-unit-select {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

/* Buttons */
.mm-btn-add {
    width: 100%;
    padding: 8px;
    background: #f5f5f5;
    border: 1px dashed #ccc;
    border-radius: 6px;
    color: #555;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.mm-btn-add:hover {
    background: #061d33;
    color: white;
    border-style: solid;
    border-color: #061d33;
}

.mm-btn-delete {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0 5px;
}

.mm-btn-delete:hover {
    color: #d9534f;
}

.mm-global-actions {
    display: flex;
	flex-wrap: wrap;
	gap: 10px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.mm-btn-clear, .mm-btn-primary {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.mm-btn-clear {
    background: #f5f5f5;
    color: #d9534f;
}

.mm-btn-clear:hover {
    background: #fee;
}

.mm-btn-primary {
    background: #4CAF50;
    color: white;
}

.mm-btn-primary:hover {
    background: #43a047;
}

/* Modal Overlay Styles */
.mm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.mm-modal.hidden {
    display: none;
}

.mm-modal-content {
    background: white;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.mm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.mm-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #061d33;
}

.mm-modal-search {
    padding: 15px;
}

.mm-modal-search input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease;
}

.mm-modal-search input:focus {
    border-color: #061d33;
}

/* Goals modal: each field stacked with a label */
#mm-goals-modal .mm-modal-search label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
}

#mm-goals-modal .mm-modal-search input {
    margin-top: 4px;
}

/* Database Category Tabs */
.mm-db-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0 15px;
    border-bottom: 2px solid #ddd;
    overflow-x: auto;
}

.mm-db-tabs::-webkit-scrollbar {
    height: 4px;
}

.mm-db-tabs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.mm-db-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: #f2f2f2;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.mm-db-tab.active {
    background: #4CAF50;
    color: white;
    font-weight: bold;
}

.mm-db-categories {
    flex: 1;
    overflow-y: auto;
	max-height: 400px;
    padding: 10px 15px;
}

.mm-db-category {
    display: none;
}

.mm-db-category.active {
    display: block;
}

.mm-db-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mm-db-list li {
    margin-bottom: 5px;
}

.mm-db-empty {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    padding: 30px 10px;
    margin: 0;
}

.mm-btn-db-add {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 15px;
    background: none;
    border: 1px solid #eee;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.mm-btn-db-add:hover {
    background: #f9f9f9;
    border-color: #ccc;
}

.mm-db-name {
    font-weight: 600;
    font-size: 15px;
    color: #061d33;
}

.mm-db-macros {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Favorites Button Layout */
.mm-food-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.mm-food-item-row .mm-btn-db-add {
    flex: 1;
    margin-bottom: 0;
}

.mm-btn-fav {
    background: none;
    border: 1px solid #eee;
    border-radius: 6px;
    font-size: 18px;
    padding: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mm-btn-fav:hover {
    background: #f9f9f9;
    transform: scale(1.05);
}

.mm-goal-met {
    color: #4CAF50;
    margin-left: 4px;
    font-size: 0.85em;
}

/* New: neutral "over goal" indicator for calories, distinct from the
   celebratory macro checkmark — going over calories isn't automatically
   an achievement the way hitting a protein target is. */
.mm-goal-over {
    color: #d9534f;
    margin-left: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.mm-confirm-box {
    max-width: 320px;
    text-align: center;
}

.mm-confirm-actions {
    display: flex;
    gap: 10px;
    padding: 15px;
    justify-content: center;
    border-top: 1px solid #eee;
}

.mm-confirm-actions button {
    flex: 1;
}

/* Responsive Tweaks */
@media (max-width: 600px) {
    .mm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mm-portion-controls {
        flex-direction: column;
        align-items: flex-end;
    }

    .mm-qty-input {
        width: 100%;
        box-sizing: border-box;
    }

    .mm-unit-select {
        width: 100%;
    }
}