/* ================== ESTILOS BASE ================== */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Roboto", sans-serif;
  background-color: #f4f6f9;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ================== HEADER ================== */
.header {
  background-color: #a80000;
  color: #ffffff;
  padding: 22px;
  text-align: center;
  position: relative;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.back-link {
  position: absolute;
  top: 20px;
  left: 25px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 0.8;
}

.back-link i {
  margin-right: 8px;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.header p {
  margin: 5px 0 0;
  font-size: 1rem;
  color: #f8f8f8;
}

/* ================== FORM CONTAINER & LAYOUT ================== */
.container {
  max-width: 650px;
  width: 90%;
  margin: 30px auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 35px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  flex-grow: 1;
}

.container-wide {
  max-width: 1180px;
  width: min(94%, 1180px);
  padding: 34px;
}

/* ================== TABS DO FORMULÁRIO ================== */
.form-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px;
  margin-bottom: 28px;
  background: #f8fafc;
  border: 1px solid #e3e7ed;
  border-radius: 12px;
}

.form-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #4b5563;
  padding: 11px 16px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s ease;
}

.form-tab-btn i {
  color: #a80000;
  transition: 0.2s ease;
}

.form-tab-btn:hover {
  background: #ffffff;
  border-color: #e1e5eb;
  color: #a80000;
}

.form-tab-btn.active {
  background: #a80000;
  color: #ffffff;
  border-color: #a80000;
  box-shadow: 0 6px 14px rgba(168, 0, 0, 0.18);
}

.form-tab-btn.active i {
  color: #ffffff;
}

.form-tab-content {
  display: none;
  animation: fadeTab 0.22s ease;
}

.form-tab-content.active {
  display: block;
}

@keyframes fadeTab {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================== CABEÇALHO DE CADA ABA ================== */
.tab-section-header {
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.tab-section-header h2 {
  margin-bottom: 6px;
  border-bottom: none;
  padding-bottom: 0;
}

.tab-section-header p {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.45;
}

/* ================== GRID DOS CAMPOS ================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
}

.form-group {
  margin-bottom: 0;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

/* Títulos de Seção */
h2 {
  font-size: 18px;
  color: #2c3e50;
  padding: 10px 0;
  margin: 0 0 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
}

h2 i {
  margin-right: 10px;
  color: #a80000;
}

/* ================== CAMPOS ================== */
label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 5px;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="file"],
textarea {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  background-color: #fafafa;
  transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
}

input:focus,
textarea:focus {
  border-color: #a80000;
  box-shadow: 0 0 0 1px #a80000;
  background-color: #ffffff;
  outline: none;
}

input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

/* ================== ERROS ================== */
.error-msg {
  color: #a80000;
  font-size: 12px;
  margin-top: 5px;
  display: none;
  font-weight: 700;
}

.error-input {
  border-color: #a80000 !important;
  box-shadow: 0 0 0 1px #a80000 !important;
}

/* ================== BOTÕES ================== */
.btn-submit,
.btn-next-tab,
.btn-prev-tab {
  min-height: 44px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.25s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-submit {
  background: #a80000;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(168, 0, 0, 0.18);
}

.btn-submit:hover {
  background: #880000;
  transform: translateY(-1px);
}

.btn-next-tab {
  background: #a80000;
  color: #ffffff;
}

.btn-next-tab:hover {
  background: #880000;
  transform: translateY(-1px);
}

.btn-prev-tab {
  background: #eef2f6;
  color: #334155;
}

.btn-prev-tab:hover {
  background: #dde5ee;
  transform: translateY(-1px);
}

.tab-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #edf0f4;
}

.tab-actions .btn-next-tab:only-child {
  margin-left: auto;
}

.final-actions {
  justify-content: space-between;
}

/* ================== UPLOAD ================== */
.file-upload-section {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid #e2e6ec;
  border-radius: 12px;
  background: #fcfdff;
}

.file-upload-section h3 {
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 18px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-upload-section h3 i {
  color: #a80000;
}

.input-file-container label {
  line-height: 1.35;
}

.input-file-container input[type="file"] {
  background-color: #ffffff;
}

/* ================== FLASH ================== */
.flash-messages {
  margin-bottom: 20px;
}

.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: bold;
}

.alert.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert.danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ================== FOOTER ================== */
.footer {
  margin-top: auto;
  width: 100%;
  background-color: #a80000;
  color: #ffffff;
  text-align: center;
  padding: 15px 10px;
  font-size: 13px;
}

.footer span {
  font-weight: 700;
  text-transform: uppercase;
}

.footer em {
  font-style: italic;
  color: #f0f0f0;
}


.origin-card,
.existing-files-card {
  background: #fff8e1;
  border: 1px solid #f0d98a;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 22px;
}

.origin-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #374151;
}

.origin-row-text {
  flex-direction: column;
}

.existing-files-card {
  background: #f8fafc;
  border-color: #dbe4ee;
}

.existing-files-title {
  font-weight: 700;
  display: block;
  margin-bottom: 12px;
  color: #1f2937;
}

.existing-files-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.existing-file-item {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  padding: 12px;
  font-size: 13px;
}

.existing-file-item strong {
  display: block;
  margin-bottom: 5px;
  color: #111827;
}

.existing-file-ok {
  color: #166534;
  font-weight: 600;
}

.existing-file-empty {
  color: #6b7280;
}

.file-help-text {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.35;
}

/* ================== RESPONSIVO ================== */
@media (max-width: 900px) {
  .container,
  .container-wide {
    width: 95%;
    margin: 20px auto;
    padding: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: auto;
  }

  .form-tabs {
    flex-direction: column;
  }

  .form-tab-btn {
    width: 100%;
    justify-content: center;
  }

  .tab-actions {
    flex-direction: column;
  }

  .btn-submit,
  .btn-next-tab,
  .btn-prev-tab {
    width: 100%;
  }

  .file-upload-section {
    padding: 16px;
  }

  .existing-files-grid {
    grid-template-columns: 1fr;
  }

  .origin-row {
    flex-direction: column;
    gap: 2px;
  }



}

@media (max-width: 768px) {
  .header {
    padding: 20px 14px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .header p {
    font-size: 0.9rem;
  }

  .back-link {
    font-size: 14px;
    top: 15px;
    left: 15px;
  }
}

@media (max-width: 480px) {
  .container,
  .container-wide {
    width: 96%;
    padding: 18px;
    border-radius: 10px;
  }

  .header h1 {
    font-size: 1.35rem;
  }

  .tab-section-header h2 {
    font-size: 16px;
  }

  .tab-section-header p {
    font-size: 13px;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="file"],
  textarea {
    font-size: 14px;
    padding: 11px;
  }
}