/* ==========================
   GENERALE
========================== */
body {
  font-family: 'Montserrat', sans-serif;
  margin: 0;
  padding: 0;
  background: #ffffff;
}

body, input, select, textarea, button, table, th, td {
  font-family: 'Montserrat', sans-serif;
}


.container {
  max-width: 900px;
  margin: auto;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-bottom: 40px;
  text-rendering: optimizeLegibility;
}

.section {
  margin-top: 50px;
}

label {
  font-weight: bold;
  margin-right: 10px;
}

input[type="number"], input[type="date"], select {
  padding: 12px;
  margin: 5px 0;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 10px;
  width: 100%;
  max-width: 150px;
}

.macro-inputs {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.buttons-row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.btn {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
}

.btn-green { background-color: #28a745; color: #fff; }
.btn-blue { background-color: #007bff; color: #fff; padding: 10px 25px; }
.btn-red { background-color: #dc3545; color: #fff; font-size: 14px;}
.btn-orange { background-color: #ff8c00; color: #fff; }


.btn-outline-black {
  background-color: transparent;
  color: black;
  border: 2px solid black;
  padding: 12px 18px;
  margin-top: 25px;
  border-radius: 10px;
  margin-left: 5px;
}
.btn-gpt {
  background-color: black;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 10px;
}

.btn-gem {
  background-color: #49a9fc;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 10px;
}

#showCalculatorBtn {
  background-color: transparent;
  color: orange;
  border: 2px solid orange;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 10px;
}

/* ==========================
   PROGRESS BAR
========================== */
.progress-label-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-weight: bold;
}

.progress-container {
  background: #ddd;
  border-radius: 20px;
  height: 22px;
  margin-bottom: 15px;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 20px;
}

/* ==========================
   TABELLE
========================== */
.table-wrapper {
  margin-top: 50px;
  margin-bottom: 50px;
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  border-radius: 10px;
  overflow: hidden;
  background-color: #d4f4dd;
}

th, td {
  padding: 10px;
  border: 1px solid #ccc;
  text-align: center;
}

.hidden { display: none; }

#percentCalorie, #percentCarbo, #percentProteine, #percentGrassi {
  font-weight: 500;
}

/* ==========================
   CALCOLATRICE
========================== */

/* Overlay popup */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Nasconde il popup */
.hidden-calc { display: none; }

/* Popup calcolatrice */
.calculator-popup {
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  width: 320px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center; 
}

/* Input + backspace container */
.calculator-display {
  gap: 10px;
  width: 100%;
  margin-bottom: 15px;
}

.calculator-display input {
  width: 100%;
  font-size: 24px;
  text-align: right;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  height: 60px;
}

.calc-backspace {
  font-size: 18px;
  height: 60px; /* stessa altezza dell'input */
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: #ff9800;
  color: red;
  cursor: pointer;
  text-rendering: optimizeLegibility;
}

/* Griglia pulsanti numeri/operazioni */
.calculator-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
}


.calc-btn {
  padding: 15px;
  font-size: 18px;
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  height: 60px; /* uniforma altezza */
}

.calc-btn:hover { background-color: #e0e0e0; }
.calc-op { background-color: #ffb74d; }
.calc-clear { background-color: #f44336; color: white; }

.calc-equal {
  grid-column: span 3;
  background-color: #4caf50;
  color: white;
  font-weight: bold;
}

/* Extra buttons sotto la calcolatrice */
.calculator-extra-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

.calculator-extra-buttons .calc-btn {
  flex: 1;
  font-size: 16px;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  margin-bottom: 20px;
}

.calculator-extra-buttons .calc-btn:hover {
  background-color: #e0e0e0;
}

.add-carb {
  color: #007bff;
  font-size: 18px;
  font-weight: 500;
  
}

.add-prot {
  color: #28a745;
  font-size: 18px;
  font-weight: 500;
}

.add-grassi {
  color: #ff8c00;
  font-size: 18px;
  font-weight: 500;
}

.aggiungi {
	margin-top: 20px;
	margin-bottom: 10px;
	text-align: left;
	font-size: 18px;
	font-weight: 600;
	}
	
.calc-btn-extra {
	height: 40px !important;
	padding: 8px 15px !important;
	}
	
.chiedi{
    text-align: left;
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 500;
}	


/* ==========================
   MODAL GRAFICI
========================== */
.modal {
  display: none; 
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  overflow-y: auto;
}

.modal-content {
  background: #fff;
  margin: 30% auto;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  padding-top: 50px;
  height: auto;
}

#macroChart {
  margin-top: 20px;
  margin-bottom: 20px;
}

.btn-purple {
  color: #007bff;
  background: transparent;
  border: 2px solid #007bff;
  padding: 8px 25px;
  margin-left: 5px;
}

h3 {
  margin-bottom: 40px;
  padding-top: 10px;
  text-align: center;
}

.date-range {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.date-field {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.date-field label {
  font-weight: bold;
  margin-bottom: 5px;
}

#updateChartsBtn {
  margin-bottom: 50px;
  background: #28a745;
  color: white;
  padding: 8px 18px;
}

#startDate, #endDate {
  padding-top: 8px;
  padding-bottom: 8px; 
}

button {
	border-radius: 30px !important;
	}
	
.calculator-popup button {
	border-radius: 10px !important;
	}
	
