/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar {
  background: #1e40af;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}
.navbar-links { display: flex; align-items: center; gap: .75rem; }
.nav-link { color: #bfdbfe; text-decoration: none; font-size: .9rem; }
.nav-link:hover { color: #fff; }

/* ===== MAIN CONTAINER ===== */
.main-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ===== FLASH MESSAGES ===== */
.flash {
  padding: .75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.flash-notice { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-alert  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h1 { font-size: 1.6rem; color: #1e293b; }
.header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  padding: .5rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-primary  { background: #1d4ed8; color: #fff; }
.btn-secondary{ background: #475569; color: #fff; }
.btn-outline  { background: transparent; border-color: #cbd5e1; color: #475569; }
.btn-danger   { background: #dc2626; color: #fff; }

/* button_to resets */
form.button_to { display: inline; }
form.button_to button {
  display: inline-flex; align-items: center;
  padding: .35rem .75rem; border-radius: 6px;
  font-size: .8rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: opacity .15s;
}
form.button_to button:hover { opacity: .85; }
form.button_to .btn-danger { background: #dc2626; color: #fff; }
form.button_to .btn-sm.btn-danger { background: #dc2626; color: #fff; }

/* ===== FILTERS BAR ===== */
.filters-bar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.filters-form {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: .25rem; }
.input-search {
  padding: .5rem .75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: .875rem;
  width: 320px;
  outline: none;
}
.input-search:focus { border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,.15); }
.input-select {
  padding: .5rem .75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: .875rem;
  background: #fff;
  outline: none;
  cursor: pointer;
}
.input-select:focus { border-color: #1d4ed8; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: #fff;
  border-radius: 10px;
  border: 2px dashed #e2e8f0;
  color: #64748b;
}
.empty-state p { margin-bottom: 1rem; font-size: 1rem; }

/* ===== CHAMADOS GRID ===== */
.chamados-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

/* ===== CHAMADO CARD ===== */
.chamado-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: box-shadow .2s;
}
.chamado-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.chamado-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.tag-dispositivo {
  font-family: monospace;
  font-size: .85rem;
  background: #eff6ff;
  color: #1d4ed8;
  padding: .2rem .5rem;
  border-radius: 4px;
  font-weight: 600;
}
.chamado-problema { font-size: 1rem; font-weight: 600; color: #1e293b; }
.chamado-descricao { font-size: .875rem; color: #64748b; flex: 1; }
.chamado-data { font-size: .78rem; color: #94a3b8; }
.chamado-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding-top: .5rem;
  border-top: 1px solid #f1f5f9;
}
.chamado-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status-nao_iniciado { background: #f1f5f9; color: #475569; }
.status-aberto       { background: #fef3c7; color: #92400e; }
.status-em_andamento { background: #dbeafe; color: #1e40af; }
.status-finalizado   { background: #dcfce7; color: #166534; }

/* ===== FOTOS PREVIEWS ===== */
.chamado-fotos-preview {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
}
.foto-thumb {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.fotos-mais {
  background: #f1f5f9;
  color: #475569;
  border-radius: 6px;
  padding: .2rem .5rem;
  font-size: .8rem;
  font-weight: 600;
}

/* ===== FORM ===== */
.chamado-form {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 2rem;
  max-width: 700px;
}
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.25rem; }
.form-label { font-size: .875rem; font-weight: 600; color: #374151; }
.form-input, .form-textarea {
  padding: .6rem .8rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.form-input:focus, .form-textarea:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29,78,216,.15);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-file-input {
  padding: .5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  font-size: .875rem;
  background: #f8fafc;
  cursor: pointer;
}
/* Inputs de arquivo ocultos */
.fotos-upload-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.btn-upload { cursor: pointer; }
.form-hint { font-size: .78rem; color: #94a3b8; margin-top: .25rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
.form-errors {
  background: #fee2e2; border: 1px solid #fecaca;
  border-radius: 6px; padding: 1rem; margin-bottom: 1.25rem;
  color: #991b1b; font-size: .875rem;
}
.form-errors h4 { margin-bottom: .5rem; }
.form-errors ul { margin-left: 1.25rem; }

/* ===== FOTOS GRID ===== */
.fotos-grid {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}
.foto-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}
.foto-preview {
  width: 100px; height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.foto-remove-label {
  font-size: .75rem;
  color: #dc2626;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.foto-remove-new-btn {
  font-size: .72rem;
  color: #dc2626;
  background: none;
  border: none;
  cursor: pointer;
  padding: .1rem 0;
  font-family: inherit;
}
.foto-remove-new-btn:hover { text-decoration: underline; }
.fotos-atuais { margin-top: .75rem; }

/* ===== DETAIL VIEW ===== */
.chamado-detail {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.detail-section {
  padding: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}
.detail-section:last-child { border-bottom: none; }
.detail-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.detail-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.detail-label {
  font-size: .78rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.detail-value { font-size: .95rem; color: #1e293b; }
.section-title { font-size: 1rem; font-weight: 600; color: #475569; margin-bottom: .75rem; }
.detail-text { font-size: .95rem; color: #1e293b; line-height: 1.6; white-space: pre-wrap; }

.fotos-grid-large { gap: 1rem; margin-top: 1rem; }
.foto-item-large { display: inline-flex; flex-direction: column; align-items: center; gap: .4rem; }
.foto-large {
  width: 180px; height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: block;
  transition: transform .2s;
}
.foto-large:hover { transform: scale(1.03); }
.foto-download-btn { width: 100%; justify-content: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .chamados-grid { grid-template-columns: 1fr; }
  .input-search { width: 100%; }
  .filters-form { flex-direction: column; }
  .chamado-form { padding: 1.25rem; }
  .detail-row { flex-direction: column; gap: 1rem; }
}
