/* ==========================================================================
   Consulta Pública - Detalhe
   ========================================================================== */

/* --- Tokens (mesmo sistema do public_index.css) --- */
:root {
  --cp-blue-900: #0a1628;
  --cp-blue-800: #0f2342;
  --cp-blue-700: #163a6e;
  --cp-blue-600: #1a4f94;
  --cp-blue-500: #2563eb;
  --cp-blue-400: #4f86e8;
  --cp-blue-100: #dbeafe;
  --cp-blue-50: #eff6ff;

  --cp-green-600: #16a34a;
  --cp-green-500: #22c55e;
  --cp-green-100: #dcfce7;

  --cp-gray-900: #111827;
  --cp-gray-700: #374151;
  --cp-gray-600: #4b5563;
  --cp-gray-500: #6b7280;
  --cp-gray-400: #9ca3af;
  --cp-gray-300: #d1d5db;
  --cp-gray-200: #e5e7eb;
  --cp-gray-100: #f3f4f6;
  --cp-gray-50: #f9fafb;

  --cp-white: #ffffff;
  --cp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --cp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --cp-shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --cp-shadow-xl: 0 20px 40px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --cp-radius-sm: 6px;
  --cp-radius-md: 10px;
  --cp-radius-lg: 16px;
  --cp-radius-xl: 24px;
  --cp-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--cp-gray-900);
  background-color: var(--cp-white);
  line-height: 1.65;
  margin: 0;
}

::selection {
  background: var(--cp-blue-100);
  color: var(--cp-blue-800);
}

/* --- Navbar --- */
.navbar-public {
  margin: 0 1rem;
  padding: 0.75rem 0;
  box-sizing: border-box;
}

.navbar-public .container {
  max-width: calc(100% - 2rem);
  padding-left: 1rem;
  padding-right: 1rem;
}

.navbar-public .navbar-brand {
  color: var(--cp-blue-700);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.navbar-public .navbar-brand i {
  font-size: 1.2rem;
  color: var(--cp-blue-500);
}

.navbar-public .navbar-brand:hover {
  color: var(--cp-blue-600);
}

.navbar-public .navbar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

/* --- Breadcrumb --- */
.breadcrumb-bar {
  background: var(--cp-gray-50);
  border-bottom: 1px solid var(--cp-gray-200);
  padding: 0.75rem 0;
}

.breadcrumb-bar .breadcrumb {
  margin: 0;
  font-size: 0.85rem;
  padding: 0;
  background: none;
}

.breadcrumb-bar .breadcrumb-item a {
  color: var(--cp-blue-500);
  text-decoration: none;
  transition: color var(--cp-transition);
}

.breadcrumb-bar .breadcrumb-item a:hover {
  color: var(--cp-blue-600);
  text-decoration: underline;
}

.breadcrumb-bar .breadcrumb-item.active {
  color: var(--cp-gray-500);
}

.breadcrumb-bar .breadcrumb-item + .breadcrumb-item::before {
  color: var(--cp-gray-400);
}

/* --- Page Header --- */
.page-header {
  background: linear-gradient(135deg, var(--cp-blue-800) 0%, var(--cp-blue-600) 50%, var(--cp-blue-500) 100%);
  color: var(--cp-white);
  padding: 5rem 2rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.page-header .container {
  position: relative;
  z-index: 1;
}

.page-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.page-header .page-number {
  font-size: 0.95rem;
  opacity: 0.75;
}

.badge-status {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35em 0.8em;
  border-radius: var(--cp-radius-sm);
  white-space: nowrap;
}

.badge-status--aberta {
  background: var(--cp-green-100);
  color: var(--cp-green-600);
}

.badge-status--encerrada {
  background: rgba(255, 255, 255, 0.15);
  color: var(--cp-white);
}

/* --- Content Layout --- */
.content-section {
  margin: 0 1rem;
  padding: 2.5rem 0 3rem;
  box-sizing: border-box;
}

@media (min-width: 992px) {
  .content-section {
    margin: 0 2rem;
  }
}

.content-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 768px;
  margin: 0 auto;
  min-width: 0;
  width: 100%;
}

.content-main,
.content-aside {
  min-width: 0;
  max-width: 100%;
}

/* --- Info Card --- */
.info-card {
  background: var(--cp-white);
  border: 1px solid var(--cp-gray-200);
  border-radius: var(--cp-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  min-width: 0;
  overflow-wrap: break-word;
  transition: box-shadow var(--cp-transition);
}

.info-card:hover {
  box-shadow: var(--cp-shadow-md);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--cp-gray-100);
}

.info-card-header .card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--cp-radius-md);
  background: var(--cp-blue-50);
  color: var(--cp-blue-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.info-card-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cp-gray-900);
  letter-spacing: -0.01em;
  margin: 0;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--cp-gray-700);
  line-height: 1.5;
  min-width: 0;
}

.info-item > div:last-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.info-item i {
  color: var(--cp-blue-400);
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  font-size: 0.8rem;
}

.info-item strong {
  color: var(--cp-gray-900);
  font-weight: 600;
}

.info-item .info-label {
  color: var(--cp-gray-500);
  font-size: 1.2rem;
  margin-top: 0.15rem;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.info-label a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.info-label img,
.info-label video,
.info-label iframe {
  max-width: 100%;
  height: auto;
}

.info-label pre {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
}

.info-label table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.info-label p,
.info-label div,
.info-label li {
  max-width: 100%;
  overflow-wrap: break-word;
}

.info-item .info-label em,
.info-item .info-label i {
  color: inherit;
  font-style: italic;
  font-size: 1.2rem;
}

/* --- Documentos --- */
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--cp-gray-200);
  border-radius: var(--cp-radius-md);
  margin-bottom: 0.5rem;
  min-width: 0;
  overflow: hidden;
  transition: all var(--cp-transition);
}

.doc-item:hover {
  border-color: var(--cp-blue-300);
  box-shadow: var(--cp-shadow-sm);
}

.doc-item:last-child {
  margin-bottom: 0;
}

.doc-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.doc-info > div:last-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.doc-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--cp-radius-sm);
  background: #fef2f2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.doc-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--cp-gray-900);
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.doc-type {
  font-size: 0.75rem;
  color: var(--cp-gray-400);
  margin-top: 0.1rem;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--cp-blue-500);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--cp-radius-sm);
  transition: all var(--cp-transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-download:hover {
  background: var(--cp-blue-50);
  color: var(--cp-blue-600);
}

.doc-empty {
  color: var(--cp-gray-400);
  font-size: 0.88rem;
  padding: 1rem 0;
  text-align: center;
}

/* --- Formulário --- */
.form-card {
  background: var(--cp-white);
  border: 1px solid var(--cp-gray-200);
  border-radius: var(--cp-radius-lg);
  padding: 1.75rem;
}

.form-card-header {
  margin-bottom: 0.35rem;
}

.form-card-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cp-gray-900);
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
}

.form-card-header p {
  font-size: 0.82rem;
  color: var(--cp-gray-500);
  margin: 0 0 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group:last-of-type {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--cp-gray-700);
  margin-bottom: 0.35rem;
}

.form-label .required {
  color: #dc2626;
  margin-left: 0.15rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--cp-gray-300);
  border-radius: var(--cp-radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--cp-gray-900);
  background: var(--cp-white);
  transition: border-color var(--cp-transition), box-shadow var(--cp-transition);
}

.form-control::placeholder {
  color: var(--cp-gray-400);
}

.form-control:focus {
  outline: none;
  border-color: var(--cp-blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.form-control {
  resize: vertical;
  min-height: 110px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--cp-gray-400);
  margin-top: 0.3rem;
}

.form-error {
  font-size: 0.78rem;
  color: #dc2626;
  margin-top: 0.3rem;
}

.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--cp-blue-500);
  color: var(--cp-white);
  border: none;
  border-radius: var(--cp-radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--cp-transition);
}

.btn-submit:hover {
  background: var(--cp-blue-600);
  transform: translateY(-1px);
  box-shadow: var(--cp-shadow-md);
}

.btn-submit:active {
  transform: translateY(0);
}

/* --- Alert Messages --- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: var(--cp-radius-md);
  border: 1px solid transparent;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.5rem;
}

.alert-success {
  color: #166534;
  background-color: var(--cp-green-100);
  border-color: #86efac;
}

.alert-danger,
.alert-error {
  color: #991b1b;
  background-color: #fee2e2;
  border-color: #fca5a5;
}

.alert-warning {
  color: #854d0e;
  background-color: #fef9c3;
  border-color: #fde047;
}

.alert-info {
  color: #1e40af;
  background-color: var(--cp-blue-100);
  border-color: #93c5fd;
}

.alert .btn-close {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0.35rem;
  border: 0;
  background: transparent;
  color: currentColor;
  opacity: 0.65;
  cursor: pointer;
  font-size: 0;
  line-height: 1;
}

.alert .btn-close::before {
  content: '\00d7';
  display: block;
  font-size: 1.35rem;
  font-weight: 500;
}

.alert .btn-close:hover,
.alert .btn-close:focus-visible {
  opacity: 1;
}

/* --- Accessibility Bar --- */
.a11y-bar {
  background: var(--cp-blue-900);
  padding: 0.5rem 0;
}

.a11y-bar .a11y-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.a11y-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  padding: 0.35rem 0.75rem;
  border-radius: var(--cp-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--cp-transition);
}

.a11y-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--cp-white);
}

.a11y-btn:focus-visible {
  outline: 2px solid var(--cp-blue-400);
  outline-offset: 2px;
}

/* --- Footer --- */
.footer {
  background: var(--cp-gray-900);
  color: var(--cp-gray-400);
  padding: 2rem 1rem;
  box-sizing: border-box;
}

.footer .container {
  margin: 0 1rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  max-width: calc(100% - 2rem);
  box-sizing: border-box;
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 2rem;
  align-items: start;
}

.footer-columns .col-sm-4 {
  width: 100%;
  min-width: 0;
}

.footer-title,
.footer-columns li a {
  font-family: "Outfit", Arial, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.4;
}

.footer-columns ul {
  padding-left: 0;
  list-style: none;
  margin: 0;
}

.footer-columns li {
  margin-bottom: .5rem;
}

.footer-columns li a {
  color: inherit;
  text-decoration: none;
}

.footer-columns li a:hover,
.footer-columns li a:focus,
.footer-columns li a:active,
.footer-columns li a:visited {
  text-decoration: none;
}

.footer-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1.5rem 0;
}

.footer-bottom {
  text-align: center;
  font-size: 0.82rem;
}

/* --- Alto Contraste --- */
body.alto-contraste {
  background: #000 !important;
  color: #fff !important;
}

body.alto-contraste .navbar-public {
  background: #000;
  border-bottom-color: #fff;
}

body.alto-contraste .navbar-public .navbar-brand {
  color: #fff;
}

body.alto-contraste .page-header {
  background: #000;
}

body.alto-contraste .page-header h1 {
  color: #fff;
}

body.alto-contraste .breadcrumb-bar {
  background: #111;
  border-bottom-color: #fff;
}

body.alto-contraste .breadcrumb-bar .breadcrumb-item a {
  color: #6ea8fe;
}

body.alto-contraste .breadcrumb-bar .breadcrumb-item.active {
  color: #ccc;
}

body.alto-contraste .info-card,
body.alto-contraste .form-card {
  background: #111;
  border-color: #fff;
}

body.alto-contraste .info-card-header h2,
body.alto-contraste .form-card-header h2,
body.alto-contraste .doc-name {
  color: #fff;
}

body.alto-contraste .info-item {
  color: #ddd;
}

body.alto-contraste .info-item strong {
  color: #fff;
}

body.alto-contraste .form-label {
  color: #fff;
}

body.alto-contraste .form-control {
  background: #111;
  border-color: #fff;
  color: #fff;
}

body.alto-contraste .footer {
  background: #000;
  border-top: 1px solid #fff;
}

/* --- Responsive --- */
@media (max-width: 767.98px) {
  .page-header {
    padding: 2rem 0 1.75rem;
  }

  .page-header h1 {
    font-size: 1.45rem;
  }

  .page-header-inner {
    flex-direction: column;
    gap: 0.75rem;
  }

  .content-section {
    padding: 1.5rem 0 2rem;
  }

  .form-card {
    padding: 1.25rem;
  }

  .doc-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .doc-info {
    width: 100%;
  }

  .doc-name {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .doc-item .btn-download {
    align-self: flex-end;
  }

  .info-item .info-label {
    font-size: 1rem;
  }
}

@media (max-width: 575.98px) {
  .page-header h1 {
    font-size: 1.25rem;
  }

  .info-card {
    padding: 1.15rem;
  }

  .form-card {
    padding: 1rem;
  }

  .footer-columns {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}
