/* styles.css — Diário de Obra — Design Industrial */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800;900&family=Barlow:wght@400;500;600&display=swap');

/* ===================== VARIÁVEIS ===================== */
:root {
  --yellow:   #F5C800;
  --yellow-dark: #C9A200;
  --black:    #1A1A1A;
  --dark:     #2D2D2D;
  --grey-bg:  #F0EDE4;
  --grey-card:#E8E4D9;
  --grey-mid: #AAAAAA;
  --grey-line:#D0CCC0;
  --white:    #FAFAF6;
  --red:      #D63535;
  --red-bg:   #FFF0F0;
  --green:    #2E7D32;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body:    'Barlow', sans-serif;
  --radius: 4px;
  --shadow: 0 2px 12px rgba(0,0,0,0.12);
}

/* ===================== RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-body);
  background: var(--grey-bg);
  color: var(--black);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

/* ===================== TOPO ===================== */
.top-bar {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background: var(--white);
  border-bottom: 3px solid var(--yellow);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.top-bar .logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex: 1;
}
.top-bar .logo span { color: var(--yellow-dark); }
.btn-back {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  color: var(--black);
  line-height: 1;
}
.badge-online {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 2px;
  text-transform: uppercase;
}
.badge-online.online  { background: var(--yellow); color: var(--black); }
.badge-online.offline { background: var(--grey-card); color: var(--grey-mid); }

/* ===================== TELA HOME ===================== */
#screen-home { display: block; }
#screen-steps { display: none; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--white);
  border-bottom: 1px solid var(--grey-line);
}
.stat-box {
  padding: 18px 20px;
  border-right: 1px solid var(--grey-line);
}
.stat-box:last-child { border-right: none; }
.stat-box.highlight { background: var(--yellow); grid-column: 1 / -1; border-right: none; }
.stat-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin-bottom: 4px;
}
.stat-box.highlight .stat-label { color: var(--yellow-dark); }
.stat-value {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: var(--black);
}

/* ===================== BUSCA ===================== */
.search-area {
  padding: 14px 16px 10px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-line);
}
.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--grey-line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--grey-bg);
  color: var(--black);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--yellow); }

/* ===================== LISTA DE OBRAS ===================== */
.obras-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }

.obra-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
  active-scale: 0.98;
}
.obra-card:active { transform: scale(0.98); border-color: var(--yellow); }

.obra-card-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: var(--grey-card);
  position: relative;
}
.obra-card-img-placeholder {
  width: 100%;
  height: 130px;
  background: linear-gradient(135deg, var(--grey-card) 25%, var(--grey-line) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.obra-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
}
.badge-em-andamento { background: #1A7F3C; color: #fff; }
.badge-pendente     { background: var(--red); color: #fff; }
.badge-registrada   { background: var(--black); color: var(--yellow); }

.obra-card-body { padding: 14px 16px 16px; }
.obra-card-id {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--grey-mid);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.obra-card-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 6px;
}
.obra-card-manager {
  font-size: 0.8rem;
  color: var(--grey-mid);
  display: flex;
  align-items: center;
  gap: 6px;
}
.obra-card-action {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow-dark);
  margin-top: 8px;
}

/* Hint de instrução no topo de cada etapa */
.step-hint {
  font-size: 0.9rem;
  color: var(--grey-mid);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ===================== BTN REGISTRAR ===================== */
.btn-registrar-fixed {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: var(--yellow);
  border: none;
  border-bottom: 4px solid var(--yellow-dark);
  border-radius: var(--radius);
  padding: 18px 24px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: transform 0.1s, box-shadow 0.1s;
  z-index: 90;
}
.btn-registrar-fixed:active {
  transform: translateX(-50%) translateY(2px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  border-bottom-width: 2px;
}
.pb-btn { padding-bottom: 100px; }

/* ===================== STEPS HEADER ===================== */
.steps-header {
  background: var(--white);
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--grey-line);
}
.step-counter {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.step-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
}
.step-pct {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--yellow-dark);
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--grey-card);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--yellow);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.step-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
  margin-top: 16px;
}
.step-title span {
  display: block;
  width: 40px;
  height: 4px;
  background: var(--yellow);
  margin-top: 10px;
}

/* ===================== CONTEÚDO DOS PASSOS ===================== */
.step-content { padding: 20px 16px; }

/* --- Passo 1: Foto --- */
.photo-zone {
  width: 100%;
  aspect-ratio: 4/3;
  background: repeating-linear-gradient(
    45deg,
    var(--grey-card) 0px,
    var(--grey-card) 8px,
    var(--grey-bg) 8px,
    var(--grey-bg) 16px
  );
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}
.photo-zone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.photo-zone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.photo-zone-placeholder .icon { font-size: 2.5rem; opacity: 0.4; }
.photo-zone-placeholder .text {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
  text-align: center;
}
.photo-zone.has-photo .photo-zone-placeholder { display: none; }

/* --- Alertas / Dicas --- */
.field-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius);
  border-left: 4px solid var(--red);
  margin-bottom: 16px;
}
.field-tip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius);
  border-left: 4px solid var(--yellow);
  margin-bottom: 16px;
}
.field-tip img, .tip-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.alert-text { font-size: 0.85rem; line-height: 1.5; }
.tip-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow-dark);
  margin-bottom: 4px;
}

/* --- Passo 2: Atividades --- */
.atividade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.atividade-btn {
  background: var(--white);
  border: 2px solid var(--grey-line);
  border-radius: var(--radius);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.atividade-btn:active { transform: scale(0.96); }
.atividade-btn.selected {
  background: var(--yellow);
  border-color: var(--yellow-dark);
}
.atividade-btn .check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--yellow-dark);
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
}
.atividade-btn.selected .check { display: flex; }
.atividade-btn .icon { font-size: 1.8rem; }
.atividade-btn .label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}
.atividade-outro {
  background: var(--white);
  border: 2px solid var(--grey-line);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 16px;
}
.atividade-outro.selected-outro {
  background: var(--grey-card);
  border-color: var(--yellow-dark);
}
.atividade-outro .label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Passo 3: Problema --- */
.sim-nao-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.sn-btn {
  border: 2px solid var(--grey-line);
  border-radius: var(--radius);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: var(--white);
  transition: all 0.15s;
}
.sn-btn:active { transform: scale(0.96); }
.sn-btn.selected-nao { background: var(--yellow); border-color: var(--yellow-dark); }
.sn-btn.selected-sim { background: var(--grey-card); border-color: var(--grey-mid); }
.sn-label {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
}
.sn-icon { font-size: 1.2rem; }

.categoria-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin-bottom: 10px;
}
.categoria-list { display: flex; flex-direction: column; gap: 2px; }
.categoria-item {
  background: var(--white);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: all 0.12s;
}
.categoria-item:active { background: var(--grey-card); }
.categoria-item.selected { border-color: var(--yellow-dark); background: var(--grey-card); }
.cat-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}
.cat-sub {
  font-size: 0.72rem;
  color: var(--grey-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cat-icon { font-size: 1.1rem; color: var(--grey-mid); }

.textarea-problema {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--grey-line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: none;
  background: var(--white);
  color: var(--black);
  outline: none;
  margin-top: 12px;
  transition: border-color 0.15s;
}
.textarea-problema:focus { border-color: var(--yellow); }

/* --- Passo 4: Medição --- */
.medicao-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.chip-btn {
  background: var(--white);
  border: 2px solid var(--grey-line);
  border-radius: var(--radius);
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.12s;
}
.chip-btn:active { transform: scale(0.94); }
.chip-btn.selected { background: var(--yellow); border-color: var(--yellow-dark); }
.chip-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}
.chip-unit {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
}
.chip-btn.selected .chip-unit { color: var(--yellow-dark); }

.medicao-manual-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin-bottom: 8px;
}
.medicao-input-wrap {
  display: flex;
  align-items: center;
  border-left: 4px solid var(--yellow);
  background: var(--white);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 2px 12px;
  margin-bottom: 20px;
}
.medicao-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--grey-mid);
  background: transparent;
  padding: 12px 0;
  width: 100%;
}
.medicao-input:focus { color: var(--black); }

/* --- Passo 5: Resumo --- */
.resumo-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  border-left: 4px solid var(--yellow-dark);
}
.resumo-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--grey-line);
}
.resumo-row:last-child { border-bottom: none; }
.resumo-sublabel {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin-bottom: 4px;
}
.resumo-value {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--black);
}
.resumo-value.big {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
}
.resumo-problema-card {
  background: var(--red-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 4px solid var(--red);
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.resumo-problema-card .rp-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.rp-title {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 4px;
}
.rp-text { font-size: 0.88rem; line-height: 1.5; font-weight: 600; color: var(--red); }

.media-section-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin-bottom: 10px;
}
.media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.media-thumb {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--grey-card);
}

/* ===================== BOTÕES DE AÇÃO ===================== */
.btn-primary {
  width: 100%;
  background: var(--yellow);
  border: none;
  border-bottom: 4px solid var(--yellow-dark);
  border-radius: var(--radius);
  padding: 18px 24px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.1s, box-shadow 0.1s;
  margin-bottom: 8px;
}
.btn-primary:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}
.btn-primary:disabled {
  background: var(--grey-card);
  border-color: var(--grey-line);
  color: var(--grey-mid);
  cursor: not-allowed;
}
.btn-primary.dark {
  background: var(--black);
  border-color: #000;
  color: var(--yellow);
}
.btn-secondary {
  width: 100%;
  background: transparent;
  border: none;
  padding: 14px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--grey-mid);
  text-align: center;
}

/* ===================== TOAST / FEEDBACK ===================== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--black);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 24px;
  border-radius: var(--radius);
  border-left: 4px solid var(--yellow);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: #2E7D32; }
.toast.error   { border-color: var(--red); }
.toast.warning { border-color: var(--yellow); }

/* ===================== LOADING OVERLAY ===================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.loading-overlay.show { opacity: 1; pointer-events: all; }
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(245,200,0,0.3);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
}

/* ===================== EMPTY STATE ===================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  text-align: center;
}
.empty-state .icon { font-size: 3rem; opacity: 0.4; }
.empty-state .msg {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
}

/* ===================== BOTTOM NAV ===================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--white);
  border-top: 3px solid var(--yellow);
  display: flex;
  z-index: 95;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 8px;
  gap: 4px;
  cursor: pointer;
  transition: background 0.12s;
}
.nav-item.active { background: var(--yellow); }
.nav-item .nav-icon { font-size: 1.2rem; }
.nav-item .nav-label {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
}
.nav-item.active .nav-label { color: var(--black); }

/* ===================== OBRA DETAIL BANNER ===================== */
.obra-banner {
  background: var(--black);
  color: var(--white);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 3px solid var(--yellow);
}
.obra-banner-icon { font-size: 1.8rem; }
.obra-banner-info {}
.obra-banner-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.obra-banner-id {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--yellow);
  letter-spacing: 0.1em;
}

/* ===================== RESPONSIVE ===================== */
@media (min-width: 480px) {
  body { box-shadow: 0 0 40px rgba(0,0,0,0.15); }
}