/* Protein Calculator */

/* ---- Form Layout ---- */
.prot-form {
  margin-bottom: 24px;
}

/* ---- Settings Row (unit toggle) ---- */
.prot-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
  align-items: flex-end;
}

.prot-settings .setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prot-settings .setting-group > label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.prot-unit-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.prot-unit-btn {
  padding: 10px 20px;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.prot-unit-btn:not(:last-child) {
  border-right: 1px solid var(--color-border);
}

.prot-unit-btn:hover {
  background: var(--color-surface-hover);
}

.prot-unit-btn.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* ---- Inputs ---- */
.prot-inputs {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.prot-inputs .input-group {
  flex: 1;
  min-width: 160px;
}

.prot-inputs input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -moz-appearance: textfield;
}

.prot-inputs input[type="number"]:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.prot-inputs input[type="number"]::-webkit-inner-spin-button,
.prot-inputs input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---- Button Groups (Activity Level, Goal) ---- */
.prot-btn-group-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.prot-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.prot-btn-group button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-align: center;
}

.prot-btn-group button:not(:last-child) {
  border-right: 1px solid var(--color-border);
}

.prot-btn-group button:hover {
  background: var(--color-surface-hover);
}

.prot-btn-group button.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* ---- Meals per day row ---- */
.prot-meals-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.prot-meals-row label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.prot-meals-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.prot-meals-btn {
  padding: 8px 18px;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prot-meals-btn:not(:last-child) {
  border-right: 1px solid var(--color-border);
}

.prot-meals-btn:hover {
  background: var(--color-surface-hover);
}

.prot-meals-btn.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* ---- Calculate Button ---- */
.prot-calc-btn {
  width: auto;
}

/* ---- Results ---- */
.prot-results {
  display: none;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border-light);
}

.prot-results.visible {
  display: block;
}

/* ---- Value Card (big protein number) ---- */
.prot-value-card {
  text-align: center;
  padding: 28px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.prot-number {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  color: #10b981;
}

.prot-number-unit {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-left: 4px;
}

.prot-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.prot-range-text {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
}

/* ---- Range Bar ---- */
.prot-range-bar-container {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
}

.prot-range-bar-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.prot-range-bar {
  position: relative;
  height: 12px;
  background: var(--color-border-light);
  border-radius: 6px;
  overflow: visible;
}

.prot-range-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #6ee7b7, #10b981);
  border-radius: 6px;
  transition: left 0.3s ease, width 0.3s ease;
}

.prot-range-marker {
  position: absolute;
  top: -4px;
  width: 6px;
  height: 20px;
  background: #047857;
  border-radius: 3px;
  transition: left 0.3s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.prot-range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ---- Info Grid ---- */
.prot-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.prot-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  border-top: 3px solid var(--color-border-light);
  transition: box-shadow var(--transition-fast);
}

.prot-info-card:hover {
  box-shadow: var(--shadow-sm);
}

.prot-info-card:nth-child(1) {
  border-top-color: #8b5cf6;
}

.prot-info-card:nth-child(2) {
  border-top-color: #f97316;
}

.prot-info-card:nth-child(3) {
  border-top-color: #3b5bdb;
}

.prot-info-icon {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.prot-info-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}

.prot-info-card:nth-child(1) .prot-info-value { color: #8b5cf6; }
.prot-info-card:nth-child(2) .prot-info-value { color: #f97316; }
.prot-info-card:nth-child(3) .prot-info-value { color: #3b5bdb; }

.prot-info-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.prot-info-note {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ---- Context Tip ---- */
.prot-context-tip {
  padding: 14px 18px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #166534;
  line-height: 1.6;
  margin-bottom: 20px;
}

@media (prefers-color-scheme: dark) {
  .prot-context-tip {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
  }
}

/* ---- Protein Sources Table ---- */
.prot-sources-section {
  margin-top: 4px;
}

.prot-sources-heading {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
}

.prot-sources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.prot-sources-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border-light);
}

.prot-sources-table th:last-child {
  text-align: right;
}

.prot-sources-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
}

.prot-sources-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #10b981;
}

.prot-sources-table tr:last-child td {
  border-bottom: none;
}

.prot-sources-table tbody tr:hover {
  background: var(--color-surface-hover);
}

/* ---- Disclaimer ---- */
.prot-disclaimer {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: 16px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .prot-settings {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .prot-unit-toggle {
    width: 100%;
  }

  .prot-unit-btn {
    flex: 1;
    text-align: center;
  }

  .prot-inputs {
    flex-direction: column;
  }

  .prot-inputs .input-group {
    min-width: 0;
  }

  .prot-btn-group {
    flex-wrap: wrap;
  }

  .prot-btn-group button {
    flex: 1 1 30%;
    min-width: 0;
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .prot-info-grid {
    grid-template-columns: 1fr;
  }

  .prot-number {
    font-size: 2.4rem;
  }

  .prot-meals-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .prot-meals-toggle {
    width: 100%;
  }

  .prot-meals-btn {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .prot-btn-group button {
    flex: 1 1 45%;
    font-size: 0.78rem;
    padding: 9px 6px;
  }

  .prot-info-value {
    font-size: 1.2rem;
  }
}