/* ==========================================================================
   GLOBAL RESET & LAYOUT
   ========================================================================== */
html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevents horizontal scroll from 100vw header */
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: system-ui, -apple-system, sans-serif;
}

.wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px; /* Moves side padding from body to the container */
}

/* ==========================================================================
   BLUE GLOBAL HEADER
   ========================================================================== */
.main-header {
  background-color: var(--primary);
  color: white;
  padding: 3rem 0 8rem 0; /* Creates the blue "hero" area height */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-bottom: -5rem; /* Allows the cards to overlap the blue */
}

.main-header .wrap.header-flex {
  display: grid !important;
  /* Balanced columns: side areas are identical, middle takes what it needs */
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 1.5rem;
  max-width: 900px; /* Matches your card width */
  margin: 0 auto;
  padding: 1rem 20px;
}

.user-identity {
  justify-self: start; /* Pins Profile to left edge */
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-titles {
  grid-column: 2;
  text-align: center;
  min-width: 0;
}

.header-titles h1 {
  margin: 0;
  font-size: 2rem; 
  font-weight: 900;
  line-height: 1.1; /* Fixes weird spacing on wrapped titles */
  letter-spacing: -0.02em;
}

.header-titles p {
  margin: 0.25rem 0 0 0;
  font-size: 0.95rem;
  opacity: 0.85;
}

.header-nav {
  justify-self: end;
  display: flex;
  position: relative;
  align-items: center;
}
/* ==========================================================================
   POLISHED DROPDOWN NAV
   ========================================================================== */






.dropdown__btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 20px;
  border-radius: 50px; /* Pill Shape */
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.dropdown__btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: white;
  min-width: 240px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 1000;
  border: 1px solid var(--border);
  overflow: hidden;
}

.dropdown__item {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  text-decoration: none;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}

.dropdown__item:last-child { border-bottom: none; }

.dropdown__item strong {
  color: var(--primary);
  font-size: 0.9rem;
  display: block;
}

.dropdown__item small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.dropdown__item:hover {
  background: #f0f7ff;
}

/* ==========================================================================
   1. DESIGN TOKENS (Consistency Hub)
   ========================================================================== */
:root {
    --primary: #1e3a8a;
    --primary-hover: #172554;
    --text-main: #1f2937;
    --text-muted: #64748b;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --success: #16a34a;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}



/* ==========================================================================
   3. THE CARD COMPONENT
   ========================================================================== */
.card {
  position: relative;
  z-index: 10; /* Ensures the card is always on top */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: var(--shadow);
  margin-top: 1rem; /* This creates the gap between header text and button */
  margin-bottom: 2rem;
}

.card__header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card__header--split {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.card__footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* ==========================================================================
   4. FORM ELEMENTS & GRID
   ========================================================================== */
.report-form__group {
    border: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}

.form-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-field {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

label,
.report-form__label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
}

.form-input,
.form-select,
.form-textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    ring: 2px var(--primary);
}

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

/* Custom Select Arrow */
.form-select {
    appearance: auto;
    background-color: white;
}

/* Radio & Checkbox Styling */
.report-form__radio-group {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.radio-option,
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

/* ==========================================================================
   5. BUTTONS & ACTIONS (The Polish)
   ========================================================================== */
.button, .link-action, .link-delete {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid transparent;
}

/* Secondary Actions (Ver, Editar) */
.link-action {
  background-color: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}

.link-action:hover {
  background-color: var(--bg-app);
  border-color: var(--primary);
  color: var(--primary);
}

/* Delete Action (Excluir) */
.link-delete {
  background-color: #fff1f2;
  color: #e11d48;
  border: 1px solid #ffe4e6;
}

.link-delete:hover {
  background-color: #e11d48;
  color: white;
}

/* The Big 'Submit' Button */
.button--primary {
  background-color: var(--primary);
  color: white;
  padding: 12px 28px;
  font-size: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.button--primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

/* The 'Aviso de Privacidade' Link Button */
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  font-size: inherit;
  display: inline;
}

.link-btn:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   SPACING & ALIGNMENT FIXES
   ========================================================================== */
.report-form__body {
  display: flex;
  flex-direction: column;
  gap: 2.5rem; /* Forces consistent space between form sections */
}

.report-form__consent {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.report-form__footer {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ==========================================================================
   6. FEEDBACK & STATES
   ========================================================================== */
.report-form__feedback {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.error-list {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

[hidden] {
    display: none !important;
}

/* ==========================================================================
   7. TABLES (Consistent Alignment)
   ========================================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

/* Base style for both headers and cells */
.data-table th,
.data-table td {
    padding: 1.25rem 1rem;
    text-align: left;
    /* Default alignment for Protocol and Category */
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background-color: #fafafa;
    /* Subtle header background */
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

/* Center-align the Status and Actions columns specifically */
.data-table th:nth-child(3),
.data-table td:nth-child(3),
.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    text-align: right;
    padding-right: 2rem;
}

/* Ensure action group stays centered in its cell */
.action-group {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Row Hover Effect for better UX */
.data-table tbody tr:hover {
    background-color: #fcfcfc;
}

/* Badge consistency */
.badge {
    display: inline-block;
    text-align: center;
    min-width: 80px;
}

/* ==========================================================================
   8. MODAL (Dialog API)
   ========================================================================== */
.modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.modal__content {
    padding: 2rem;
}

/* ==========================================================================
   9. PRINT STYLES
   ========================================================================== */
.print-only-header { display: none; }

@media print {
  /* 1. Reset Page */
  @page { margin: 0.5cm; size: A4; }
  
  /* 2. Toggle UI Visibility */
  .no-print, header.card__header, footer.card__footer, .button { display: none !important; }
  .print-only-header { display: flex !important; justify-content: space-between; border-bottom: 2px solid #0047bb; padding-bottom: 5px; margin-bottom: 10px; }

  body { font-size: 8pt !important; line-height: 1.0; color: #000; background: white !important; }

  /* 3. Consistency Fix: Blue Section Headers */
  .report-details__section-title, .pdf-tables-container h3, .report-table-title {
    background: #0047bb !important;
    color: white !important;
    font-size: 8.5pt !important;
    padding: 3px 10px !important;
    margin: 8px 0 0 0 !important;
    text-transform: uppercase;
    -webkit-print-color-adjust: exact;
  }

  /* 4. Table Density */
  .pdf-table-fixed, .report-table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed;
    margin-bottom: 0 !important;
  }

  .pdf-table-fixed td, .report-table td, .report-table th {
    border: 1px solid #ddd !important;
    padding: 3px 6px !important;
    vertical-align: top;
  }

  .matrix-table th { background: #f8f8f8 !important; font-size: 7pt; text-align: left; }
  .text-center { text-align: center; }

  .pdf-label { font-size: 6.5pt !important; color: #555 !important; text-transform: uppercase; font-weight: bold; display: block; }
  .pdf-value { font-size: 8.5pt !important; font-weight: 500; }
}


form.inline {
  display: inline-block;
  margin: 0;
}

.btn-logout {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0; /* Align with other menu items */
}

.alert {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
  font-size: 0.9rem;
}

.alert--danger {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

/* Styling inputs specifically when inside a data-table */
.data-table .form-input {
    padding: 0.5rem;
    font-size: 0.875rem;
    margin: 4px 0;
}

/* Ensure the fieldset legends look like your other card headers */
.report-form__group legend {
    border-bottom: 1px solid var(--border);
    width: 100%;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.form-input--error {
  border-color: #e74c3c !important;
  background-color: #fdf2f2;
}

.error-msg {
  color: #e74c3c;
  font-size: 0.75rem;
  display: block;
  margin-top: 4px;
  font-weight: bold;
}

/* Avatar Styling - Professional Blue Palette */
.user-profile__avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 900; /* Increased to 900 to prevent 'thin' look on blue */
  font-size: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}


/* ==========================================================================
   USER IDENTITY & ROLES (Admin Hub)
   ========================================================================== */

/* 1. Base Avatar Styling (The Circle Shape) */
.user-profile__avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* 2. Avatar Colors */
.user-profile__avatar--admin { 
  background-color: var(--primary); 
  border: 2px solid rgba(255,255,255,0.3); 
}
.user-profile__avatar--diligence, 
.user-profile__avatar--rh { 
  background-color: #334155; 
  border: 2px solid rgba(255,255,255,0.3); 
}

/* 3. Status Badges & Dropdowns (Inside the Data Table) */
.badge--status-admin,
.badge--status-diligence,
.badge--status-rh {
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 50px;
    padding: 6px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    appearance: none; /* Removes default arrow to keep it clean */
}

.badge--status-admin { 
    background-color: #e0f2fe; 
    color: #0369a1; 
}

.badge--status-diligence,
.badge--status-rh { 
    background-color: #f1f5f9; 
    color: #334155; 
}



.password-eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.password-eye-btn:hover {
  color: #0047bb;
}

#password-field {
  padding-right: 45px; /* Ensures text doesn't go under the icon */
}

/* Hide the default eye icon in Edge/IE */
#password-field::-ms-reveal,
#password-field::-ms-clear {
  display: none;
}

.form-control#user_password {
  padding-right: 45px !important;
}