/* Audit Forms Page - Forms and submissions per audit */

.audit-forms-page {
  padding: 2.5rem 3rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 1.5rem;
  box-shadow:
    0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.audit-forms-page-loading,
.audit-forms-page-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: #4d4d4f;
  font-weight: 500;
}

.audit-forms-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(242, 27, 35, 0.3);
}

.audit-forms-page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.audit-forms-page-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #4d4d4f 0%, #4d4d4f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -0.03em;
}

.audit-forms-page-subtitle {
  margin: 0.5rem 0 0 0;
  font-size: 0.875rem;
  color: #4d4d4f;
}

.audit-forms-page-error {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #b91c1c;
  border-radius: 0.75rem;
  border: 1px solid #fecaca;
  font-size: 0.875rem;
  font-weight: 600;
}

.audit-forms-page-warning {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  background-color: #fef2f2;
  border: 1px solid #f21b23;
  border-radius: 8px;
  color: #4d4d4f;
}

.audit-forms-page-warning .btn-link,
.audit-forms-table .btn-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: #f21b23;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}

.audit-forms-table .btn-link:hover {
  color: #1d4ed8;
}

.audit-forms-page-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.audit-forms-section {
  border: 1px solid #e5e5e5;
  border-radius: 0.875rem;
  overflow: hidden;
  background: #e5e5e5;
}

.audit-forms-section-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #4d4d4f;
  background: linear-gradient(180deg, #e5e5e5 0%, #e5e5e5 100%);
  border-bottom: 1px solid #e5e5e5;
}

.audit-forms-section-name {
  flex: 1;
  min-width: 0;
}

.audit-forms-section-type {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  background: #e5e5e5;
  color: #4d4d4f;
  border-radius: 0.375rem;
}

.audit-forms-section-count {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #4d4d4f;
}

.audit-forms-section-table-wrap {
  padding: 1rem 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.audit-forms-section-empty {
  margin: 0;
  padding: 1rem 0;
  color: #4d4d4f;
  font-size: 0.9375rem;
}

.audit-forms-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: #fff;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.audit-forms-table thead {
  background: linear-gradient(180deg, #e5e5e5 0%, #e5e5e5 100%);
  border-bottom: 2px solid #e5e5e5;
}

.audit-forms-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  color: #4d4d4f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.audit-forms-table tbody tr {
  border-bottom: 1px solid #e5e5e5;
  transition: background 0.15s ease;
}

.audit-forms-table tbody tr:hover {
  background: #fef2f2;
}

.audit-forms-table tbody tr:last-child {
  border-bottom: none;
}

.audit-forms-table td {
  padding: 0.75rem 1rem;
  color: #4d4d4f;
}

.audit-forms-page .btn {
  padding: 0.875rem 2rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.audit-forms-page .btn-secondary {
  background: #fff;
  color: #4d4d4f;
  border: 2px solid #e5e5e5;
}

.audit-forms-page .btn-secondary:hover {
  border-color: #f21b23;
  color: #d91820;
  background: #fef2f2;
}

.audit-forms-page .btn-primary {
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(242, 27, 35, 0.35);
}

.audit-forms-page .btn-primary:hover {
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
  transform: translateY(-1px);
}

.audit-forms-page .btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.audit-forms-observation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.audit-forms-page .btn-close {
  background: linear-gradient(135deg, #d91820 0%, #c2151d 100%);
  color: #fff;
  border: none;
}

.audit-forms-page .btn-close:hover {
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
}

.audit-forms-page .btn-closed {
  background: #e5e5e5;
  color: #4d4d4f;
  border: 1px solid #d4d4d4;
  cursor: not-allowed;
}

.audit-forms-status-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.audit-forms-status-open {
  background: #fef2f2;
  color: #f21b23;
  border: 1px solid #fecaca;
}

.audit-forms-status-closed {
  background: #e5e5e5;
  color: #4d4d4f;
  border: 1px solid #e5e5e5;
}

@media (max-width: 768px) {
  .audit-forms-page {
    padding: 1.5rem;
  }

  .audit-forms-page-title {
    font-size: 1.5rem;
  }

  .audit-forms-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .audit-forms-page-header .btn {
    width: 100%;
  }

  .audit-forms-section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .audit-forms-section-table-wrap {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .audit-forms-table th,
  .audit-forms-table td {
    padding: 0.625rem 0.5rem;
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  .audit-forms-page {
    padding: 1rem;
  }

  .audit-forms-page-title {
    font-size: 1.25rem;
  }

  .audit-forms-section-title {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .audit-forms-table {
    min-width: 480px;
  }
}

/* ================================ DARK THEME (night mode) ================================ */
body.night-mode .audit-forms-page {
  background: rgba(58, 56, 56, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
body.night-mode .audit-forms-page-loading,
body.night-mode .audit-forms-page-empty {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .audit-forms-page-header {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .audit-forms-page-title {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.85) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.night-mode .audit-forms-page-subtitle {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .audit-forms-page-header .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.25);
}
body.night-mode .audit-forms-page-header .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .audit-forms-page-error {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.4);
}
body.night-mode .audit-forms-page-warning {
  background: rgba(251, 191, 36, 0.15) !important;
  border-color: rgba(251, 191, 36, 0.4) !important;
  color: #fcd34d !important;
}
body.night-mode .audit-forms-page-warning .btn-link {
  color: #fde047;
}
body.night-mode .audit-forms-section {
  background: rgba(58, 56, 56, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .audit-forms-section-title {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.98);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .audit-forms-section-name,
body.night-mode .audit-forms-section-count {
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .audit-forms-section-table-wrap {
  background: transparent;
}
body.night-mode .audit-forms-table {
  background: rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
}
body.night-mode .audit-forms-table thead {
  background: transparent !important;
}
body.night-mode .audit-forms-table thead th {
  background: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
body.night-mode .audit-forms-table tbody tr {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
body.night-mode .audit-forms-table tbody tr:last-child {
  border-bottom: none;
}
body.night-mode .audit-forms-table td {
  border-bottom-color: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92) !important;
}
body.night-mode .audit-forms-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.08);
}
body.night-mode .audit-forms-status-open,
body.night-mode .audit-forms-status-badge.audit-forms-status-open {
  background: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}
body.night-mode .audit-forms-status-closed,
body.night-mode .audit-forms-status-badge.audit-forms-status-closed {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .audit-forms-table .btn-link {
  color: #f87171;
}
body.night-mode .audit-forms-table .btn-link:hover {
  color: #93c5fd;
}
body.night-mode .audit-forms-page .btn-primary {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
}
body.night-mode .audit-forms-page .btn-close {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  color: #fff;
}
body.night-mode .audit-forms-page .btn-closed {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.65);
  border-color: rgba(255, 255, 255, 0.2);
}
