Files
calories-tracker/style.css
T

1074 lines
18 KiB
CSS

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #121212;
min-height: 100vh;
padding: 12px;
color: #e0e0e0;
line-height: 1.6;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: rgba(30, 30, 30, 0.95);
border-radius: 6px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
padding: 40px;
backdrop-filter: blur(10px);
}
h1 {
text-align: center;
margin-bottom: 40px;
font-size: 2.5rem;
color: #b0b0b0;
font-weight: 300;
}
.calories-banner {
text-align: center;
background: linear-gradient(135deg, #8B5A3C, #3A8B8B);
color: white;
padding: 30px 20px;
border-radius: 6px;
margin-bottom: 30px;
box-shadow: 0 10px 30px rgba(139, 90, 60, 0.3);
transition: transform 0.3s ease;
}
.calories-banner:hover {
transform: translateY(-5px);
}
.calories-number {
font-size: 4rem;
font-weight: bold;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}
.calories-text {
font-size: 1.3rem;
opacity: 0.9;
}
.calories-text-goal {
font-size: 0.9rem;
color: #fff;
}
.calories-text-alkaline {
font-size: 0.9rem;
color: #cecece;
font-weight: 700;
}
.date-display {
text-align: center;
font-size: 1.1rem;
margin-bottom: 30px;
color: #b0b0b0;
font-weight: 500;
}
.food-search-container {
position: relative;
z-index: 1001; /* Higher than other elements */
}
.food-search-input {
width: 100%;
padding: 15px 20px;
border: 2px solid #404040;
border-radius: 6px;
font-size: 16px;
transition: all 0.3s ease;
background: #2a2a2a;
color: #e0e0e0;
outline: none;
}
.food-search-input:focus {
border-color: #6B8DD6;
box-shadow: 0 0 0 3px rgba(107, 141, 214, 0.2);
}
.food-search-input::placeholder {
color: #666;
}
/* Loading indicator */
.search-loading {
position: absolute;
right: 15px;
top: 30%;
transform: translateY(-50%);
width: 20px;
height: 20px;
border: 2px solid #404040;
border-top: 2px solid #6B8DD6;
border-radius: 50%;
animation: spin 1s linear infinite;
display: none;
}
.search-loading.show {
display: block;
}
@keyframes spin {
0% { transform: translateY(-50%) rotate(0deg); }
100% { transform: translateY(-50%) rotate(360deg); }
}
/* Search Results Overlay */
.search-results {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: #2a2a2a;
border: 1px solid #404040;
border-radius: 6px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
z-index: 1002;
max-height: 300px;
overflow-y: auto;
display: none;
margin-top: 5px;
}
.search-results.show {
display: block;
}
.search-result-item {
padding: 15px 20px;
border-bottom: 1px solid #404040;
cursor: pointer;
transition: background-color 0.2s ease;
display: flex;
justify-content: space-between;
align-items: center;
background: #2a2a2a;
color: #e0e0e0;
}
.search-result-item:last-child {
border-bottom: none;
}
.search-result-item:hover,
.search-result-item.highlighted {
background-color: #3a3a3a;
}
.food-log-section {
max-width: 800px;
margin: 0 auto;
}
.section-title {
font-size: 24px;
font-weight: 600;
color: #e0e0e0;
margin-bottom: 20px;
text-align: center;
}
.food-cards-container {
display: flex;
flex-direction: column;
gap: 12px;
}
.food-card {
background: #2a2a2a;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
overflow: hidden;
transition: all 0.3s ease;
}
.food-card:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.card-header {
padding: 16px;
cursor: pointer;
display: flex;
justify-content: between;
align-items: center;
background: linear-gradient(135deg, #4A5D8A 0%, #5A3E7A 100%);
color: white;
position: relative;
}
.card-header:hover {
background: linear-gradient(135deg, #3E4F78 0%, #4E3268 100%);
}
.card-main-info {
flex: 1;
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
}
.food-name-time {
flex: 1;
}
.food-name {
font-size: 16px;
font-weight: 600;
color: #e0e0e0;
margin-bottom: 4px;
}
.card-header .food-name {
color: #fff;
}
.food-time {
font-size: 13px;
opacity: 0.9;
}
.calories-display {
font-size: 18px;
font-weight: 700;
color: #fff;
text-align: right;
}
.expand-icon {
margin-left: 12px;
font-size: 14px;
transition: transform 0.3s ease;
opacity: 0.8;
}
.card-details {
display: none;
}
.card-details.expanded {
display: block;
}
.card-header-toggle .expand-icon {
transition: transform 0.3s ease;
}
.card-header-toggle.expanded .expand-icon {
transform: rotate(180deg);
}
.details-content {
padding: 20px;
}
.nutrition-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 16px;
margin-bottom: 20px;
}
.nutrition-item {
text-align: center;
padding: 12px;
background: #2a2a2a;
border-radius: 6px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.nutrition-label {
font-size: 12px;
color: #999;
letter-spacing: 0.5px;
margin-bottom: 4px;
}
.nutrition-value {
font-size: 16px;
font-weight: 600;
color: #e0e0e0;
}
.card-actions {
display: flex;
justify-content: space-between;
gap: 8px;
padding-top: 16px;
border-top: 1px solid #404040;
}
.btn {
padding: 8px 16px;
border: none;
border-radius: 6px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-delete {
background: #ff4757;
color: white;
}
.btn-delete:hover {
background: #ff3838;
}
.btn-edit {
background: #5352ed;
color: white;
}
.btn-edit:hover {
background: #4834d4;
}
.btn-copy {
background: #2ed573;
color: white;
}
.btn-copy:hover {
background: #1dd1a1;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: #999;
}
.empty-state-icon {
font-size: 48px;
margin-bottom: 16px;
opacity: 0.5;
}
.add-food-btn {
background: linear-gradient(135deg, #4A5D8A 0%, #5A3E7A 100%);
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
font-size: 16px;
cursor: pointer;
margin-bottom: 20px;
transition: all 0.2s ease;
}
.add-food-btn:hover {
background: linear-gradient(135deg, #3E4F78 0%, #4E3268 100%);
transform: translateY(-1px);
}
.food-details {
font-size: 13px;
color: #999;
}
.food-calories {
font-weight: 600;
color: #6B8DD6;
font-size: 14px;
}
.no-results {
padding: 20px;
text-align: center;
color: #999;
font-style: italic;
}
.add-food-section {
background: #2a2a2a;
padding: 30px;
border-radius: 6px;
margin-bottom: 30px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}
.add-food-title {
font-size: 1.5rem;
margin-bottom: 20px;
color: #b0b0b0;
text-align: center;
}
.add-food-form {
display: grid;
grid-template-columns: 2fr 1fr 1fr auto;
gap: 15px;
align-items: end;
}
.display-none {
display: none;
}
.display-block {
display: block;
}
.form-group {
display: flex;
flex-direction: column;
min-width: 0;
}
label {
margin-bottom: 5px;
font-weight: 600;
color: #b0b0b0;
}
#gramAmount {
width: 100%;
padding: 15px 20px;
border: 2px solid #404040;
border-radius: 6px;
font-size: 1rem;
transition: all 0.3s ease;
background: #2a2a2a;
color: #e0e0e0;
min-width: 0;
box-sizing: border-box;
outline: none;
}
#gramAmount:focus {
border-color: #6B8DD6;
box-shadow: 0 0 0 3px rgba(107, 141, 214, 0.2);
}
#gramAmount::placeholder {
color: #666;
}
.checkbox-group {
margin: 10px 0;
}
.checkbox-label {
display: flex;
align-items: center;
cursor: pointer;
color: #e0e0e0;
font-weight: 400;
user-select: none;
}
.ai-checkbox {
width: 18px;
height: 18px;
margin-right: 10px;
cursor: pointer;
accent-color: #6B8DD6;
}
.checkbox-label span {
font-size: 0.95rem;
color: #b0b0b0;
}
.checkbox-label:hover span {
color: #e0e0e0;
}
.add-btn {
padding: 17px 25px;
background: linear-gradient(135deg, #4CAF50, #45a049);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 1rem;
font-weight: 600;
transition: all 0.3s ease;
height: fit-content;
}
.add-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}
.cancel-btn {
padding: 17px 25px;
background: linear-gradient(135deg, #757575, #616161);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 1rem;
font-weight: 600;
transition: all 0.3s ease;
height: fit-content;
display: none; /* Hidden by default, shown when editing */
}
.cancel-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}
.food-table-section {
background: #2a2a2a;
border-radius: 6px;
margin-bottom: 30px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
overflow: hidden;
}
.table-title {
background: linear-gradient(135deg, #4A5D8A, #5A3E7A);
color: white;
padding: 20px;
font-size: 1.2rem;
font-weight: 600;
text-align: center;
}
.table-wrapper {
overflow-x: auto;
overflow-y: visible;
}
.food-table {
width: 100%;
border-collapse: collapse;
min-width: 600px;
}
.food-table th,
.food-table td {
padding: 15px 10px;
text-align: left;
border-bottom: 1px solid #404040;
white-space: nowrap;
color: #e0e0e0;
}
.food-table th {
background: #1a1a1a;
font-weight: 600;
color: #b0b0b0;
font-size: 0.9rem;
}
.food-table tr:hover {
background: #3a3a3a;
}
.delete-btn {
background: #ff6b6b;
color: white;
border: none;
padding: 5px 10px;
border-radius: 6px;
cursor: pointer;
font-size: 0.8rem;
transition: background 0.3s ease;
}
.delete-btn:hover {
background: #e55656;
}
.calendar-section {
background: #2a2a2a;
border-radius: 6px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
overflow: hidden;
margin-top: 30px;
}
.calendar-header {
background: linear-gradient(135deg, #4A5D8A, #5A3E7A);
color: white;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.calendar-nav {
background: rgba(255, 255, 255, 0.2);
border: none;
color: white;
padding: 10px 15px;
border-radius: 6px;
cursor: pointer;
font-size: 1.1rem;
transition: background 0.3s ease;
}
.calendar-nav:hover {
background: rgba(255, 255, 255, 0.3);
}
.calendar-title {
font-size: 1.2rem;
font-weight: 600;
}
.calendar-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 1px;
background: #404040;
}
.calendar-day-header {
background: #1a1a1a;
padding: 15px 5px;
text-align: center;
font-weight: 600;
color: #b0b0b0;
font-size: 0.9rem;
}
.calendar-day {
background: #2a2a2a;
color: #e0e0e0;
padding: 15px 5px;
text-align: center;
cursor: pointer;
transition: all 0.2s ease;
min-height: 60px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.calendar-day:hover {
background: #3a3a3a;
}
.calendar-day.other-month {
color: #666;
background: #1a1a1a;
}
.calendar-day.today {
background: #6B8DD6;
color: white;
font-weight: bold;
}
.calendar-day.selected {
background: #4CAF50;
color: white;
font-weight: bold;
}
.calendar-day.has-data {
background: #e6fffa;
border: 2px solid #4ECDC4;
}
.calendar-day.has-data.selected {
background: #4CAF50;
border-color: #45a049;
}
.day-calories {
font-size: 0.7rem;
margin-top: 2px;
opacity: 0.8;
}
.nutrition-summary {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 15px;
margin-top: 20px;
padding: 20px;
background: #1a1a1a;
border-radius: 6px;
}
.nutrition-item {
text-align: center;
padding: 10px;
background: #2a2a2a;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.nutrition-value {
font-size: 1.2rem;
font-weight: bold;
color: #e0e0e0;
}
.nutrition-label {
font-size: 0.8rem;
color: #999;
margin-top: 2px;
}
.hidden-column {
display: none;
}
.muted {
color: #666;
}
@media (max-width: 768px) {
.container {
margin: 0px;
padding: 15px;
}
.calories-number {
font-size: 3rem;
}
.add-food-form {
grid-template-columns: 1fr;
gap: 15px;
}
.food-table {
font-size: 0.8rem;
min-width: 650px;
}
.food-table th,
.food-table td {
padding: 8px 5px;
white-space: nowrap;
}
.table-wrapper {
-webkit-overflow-scrolling: touch;
scrollbar-width: thin;
}
/* Optional: Add a subtle shadow to indicate scrollability */
.table-wrapper::-webkit-scrollbar {
height: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 3px;
}
.table-wrapper::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 3px;
}
h1 {
font-size: 2rem;
}
.card-header {
padding: 14px;
}
.food-name {
font-size: 15px;
}
.calories-display {
font-size: 16px;
}
.nutrition-grid {
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.details-content {
padding: 16px;
}
}
/* Share Modal Styles */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 2000;
backdrop-filter: blur(5px);
}
.modal-overlay.hidden {
display: none;
}
.modal-content {
background: #2a2a2a;
border-radius: 12px;
padding: 30px;
max-width: 500px;
width: 90%;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
color: #e0e0e0;
}
.modal-content h2 {
margin-bottom: 15px;
color: #b0b0b0;
font-size: 1.5rem;
}
.modal-content p {
margin-bottom: 20px;
color: #999;
}
.share-link-container {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
.share-link-input {
flex: 1;
padding: 12px 15px;
background: #1a1a1a;
border: 2px solid #404040;
border-radius: 6px;
color: #e0e0e0;
font-family: monospace;
font-size: 14px;
outline: none;
}
.copy-btn {
padding: 12px 24px;
background: linear-gradient(135deg, #4CAF50, #45a049);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s ease;
}
.copy-btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}
.copy-btn:active {
transform: translateY(0);
}
.modal-buttons {
display: flex;
justify-content: flex-end;
gap: 10px;
}
.modal-btn {
padding: 10px 20px;
background: #404040;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s ease;
}
.modal-btn:hover {
background: #505050;
}
/* Shared View Banner */
.shared-view-banner {
background: linear-gradient(135deg, #FF6B6B, #FF8E53);
color: white;
padding: 15px 20px;
text-align: center;
font-size: 16px;
font-weight: 500;
box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
position: sticky;
top: 0;
z-index: 1000;
}
.shared-view-banner.hidden {
display: none;
}
.shared-view-banner strong {
font-weight: 700;
}
/* Disabled state for read-only mode */
.read-only-disabled {
opacity: 0.5;
pointer-events: none;
cursor: not-allowed !important;
}
/* AI Nutrition Info Card */
#ai-nutrition-card {
margin-top: 20px;
animation: fadeIn 0.3s ease-in;
}
.ai-nutrition-container {
background: rgba(40, 40, 40, 0.6);
backdrop-filter: blur(10px);
border: 1px solid rgba(107, 141, 214, 0.3);
border-radius: 12px;
padding: 25px;
}
.ai-nutrition-title {
font-size: 1.2rem;
font-weight: 600;
color: white;
margin: 0 0 20px 0;
display: flex;
align-items: center;
gap: 10px;
}
.ai-badge {
background: linear-gradient(135deg, #6B8DD6 0%, #9B7BC6 100%);
color: white;
padding: 4px 10px;
border-radius: 6px;
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.5px;
}
/* Loading State */
.ai-loading {
text-align: center;
padding: 30px 20px;
}
.ai-spinner {
width: 40px;
height: 40px;
margin: 0 auto 15px;
border: 3px solid rgba(107, 141, 214, 0.3);
border-top: 3px solid #6B8DD6;
border-radius: 50%;
animation: spin 1s linear infinite;
}
.ai-loading p {
color: rgba(255, 255, 255, 0.7);
font-size: 0.95rem;
}
/* Error State */
.ai-error {
text-align: center;
padding: 20px;
color: rgba(255, 107, 107, 0.9);
font-size: 0.95rem;
}
/* Content */
.ai-nutrition-content {
display: flex;
flex-direction: column;
gap: 20px;
}
.ai-nutrition-section {
background: rgba(30, 30, 30, 0.4);
border-radius: 8px;
padding: 15px;
}
.ai-section-title {
font-size: 1rem;
font-weight: 600;
color: #6B8DD6;
margin: 0 0 12px 0;
padding-bottom: 8px;
border-bottom: 1px solid rgba(107, 141, 214, 0.2);
}
.ai-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.ai-list li {
color: rgba(255, 255, 255, 0.85);
font-size: 0.9rem;
line-height: 1.5;
padding-left: 20px;
position: relative;
}
.ai-list li:before {
content: "•";
position: absolute;
left: 8px;
color: #6B8DD6;
font-weight: bold;
}
.ai-notes {
color: rgba(255, 255, 255, 0.85);
font-size: 0.9rem;
line-height: 1.6;
margin: 0;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.ai-nutrition-container {
padding: 20px;
}
.ai-nutrition-title {
font-size: 1.1rem;
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
.ai-list li {
font-size: 0.85rem;
}
.ai-notes {
font-size: 0.85rem;
}
}