/* Audit Status Page - Matches CreateAudit design system */

.audit-status-container {
  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);
  position: relative;
  overflow: hidden;
}

.audit-status-container::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(242, 27, 35, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.audit-status-container > * {
  position: relative;
  z-index: 1;
}

/* Header */
.audit-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(242, 27, 35, 0.3);
}

.audit-status-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-status-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2em;
  background: linear-gradient(180deg, #f21b23, #d91820);
  border-radius: 2px;
  margin-right: 0.75rem;
  vertical-align: middle;
}

.audit-status-actions {
  display: flex;
  gap: 0.75rem;
}

.critical-findings-intro {
  margin: 0 0 1.5rem 0;
  font-size: 0.9375rem;
  color: #525252;
  line-height: 1.5;
}

/* Error */
.audit-status-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;
}

/* Filters */
.audit-status-filters {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.audit-status-filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.625rem 1.25rem;
  border: 2px solid #e5e5e5;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4d4d4f;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-tab:hover {
  border-color: #f21b23;
  color: #d91820;
  background: #fef2f2;
}

.filter-tab.active {
  border-color: #f21b23;
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
  color: #fff;
}

.filter-count {
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.filter-tab:not(.active) .filter-count {
  background: #e5e5e5;
  color: #4d4d4f;
}

.filter-tab.active .filter-count {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.audit-status-search {
  flex: 1;
  min-width: 200px;
}

.audit-status-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e5e5;
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.audit-status-search-input:focus {
  outline: none;
  border-color: #f21b23;
  box-shadow: 0 0 0 4px rgba(242, 27, 35, 0.12);
}

.audit-status-search-input::placeholder {
  color: #a3a3a3;
}

/* View toggle (List / Card) */
.audit-status-view-toggle {
  display: flex;
  gap: 0;
  border: 2px solid #e5e5e5;
  border-radius: 0.75rem;
  overflow: hidden;
  flex-shrink: 0;
}

.audit-status-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4d4d4f;
  background: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-right: 1px solid #e5e5e5;
}

.audit-status-view-btn:last-child {
  border-right: none;
}

.audit-status-view-btn:hover {
  background: #fef2f2;
  color: #d91820;
}

.audit-status-view-btn.active {
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
  color: #fff;
}

.audit-status-view-btn svg {
  flex-shrink: 0;
}

/* List view - table */
.audit-status-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e5e5e5;
  border-radius: 0.875rem;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
}

.audit-status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.audit-status-table th,
.audit-status-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.audit-status-table thead th {
  font-weight: 700;
  color: #4d4d4f;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  background: #fafafa;
  white-space: nowrap;
}

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

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

.audit-status-table-name {
  font-weight: 600;
  color: #4d4d4f;
  max-width: 200px;
  word-break: break-word;
}

.audit-status-table-actions {
  white-space: nowrap;
  text-align: center;
}

.audit-status-row-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

/* Loading & Empty */
.audit-status-loading,
.audit-status-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: #4d4d4f;
  font-weight: 500;
}

.audit-status-empty .btn {
  margin-top: 1rem;
}

/* List wrapper - no horizontal scroll */
.audit-status-list-wrap {
  width: 100%;
  border-radius: 0.875rem;
}

/* Card grid - responsive, no horizontal scroll */
.audit-status-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 1.25rem;
  width: 100%;
}

.audit-status-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 0.875rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.audit-status-card:hover {
  border-color: rgba(242, 27, 35, 0.4);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.08);
}

.audit-status-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.audit-status-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #4d4d4f;
  margin: 0;
  flex: 1 1 100%;
  min-width: 0;
  word-break: break-word;
}

.audit-status-card-id {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #4d4d4f;
}

.audit-status-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}

.audit-status-card-row {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.audit-status-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4d4d4f;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.audit-status-card-value {
  color: #4d4d4f;
  word-break: break-word;
}

.audit-status-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.25rem;
  border-top: 1px solid #f0f0f0;
  margin-top: auto;
}

.audit-status-card-actions .btn {
  margin-right: 0;
}

/* Status badges */
.audit-status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.audit-status-open {
  background: #fef2f2;
  color: #f21b23;
}

.audit-status-in-progress {
  background: #fef2f2;
  color: #d91820;
}

.audit-status-closed {
  background: #e5e5e5;
  color: #4d4d4f;
}

.audit-status-unknown {
  background: #e5e5e5;
  color: #4d4d4f;
}


.btn-forms {
  background: #fef2f2;
  color: #f21b23;
  border: 2px solid #fecaca;
}

.btn-forms:hover {
  background: #fee2e2;
  border-color: #f21b23;
  color: #d91820;
}

.btn-in-progress {
  background: #fef2f2;
  color: #d91820;
  border: 2px solid #fecaca;
}

.btn-in-progress:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f21b23;
  color: #c2151d;
}

.btn-in-progress:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Small buttons (card actions) - consistent size */
.audit-status-container .btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  min-height: 36px;
  min-width: 4.5rem;
}

/* Main buttons (header, empty state) */
.audit-status-container .btn {
  padding: 0.75rem 1.5rem;
  min-height: 44px;
  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;
  gap: 0.5rem;
}

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

.audit-status-container .btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(242, 27, 35, 0.4);
}

.audit-status-container .btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

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

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

@media (max-width: 768px) {
  .audit-status-container {
    padding: 1.5rem;
    border-radius: 1rem;
  }

  .audit-status-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

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

  .audit-status-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .audit-status-actions .btn {
    flex: 1;
    min-width: 120px;
  }

  .audit-status-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .audit-status-filter-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }

  .audit-status-search {
    min-width: 0;
  }

  .audit-status-view-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .audit-status-view-btn {
    flex: 1;
    justify-content: center;
  }

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

  .audit-status-table-name {
    max-width: 140px;
  }

  .audit-status-row-actions {
    flex-direction: column;
  }

  .audit-status-row-actions .btn {
    width: 100%;
  }

  .audit-status-list-wrap {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
  }

  .audit-status-cards {
    gap: 1rem;
  }

  .audit-status-card {
    padding: 1rem;
  }

  .audit-status-card-meta {
    grid-template-columns: 1fr;
  }
}

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

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

  .audit-status-actions {
    flex-direction: column;
  }

  .audit-status-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .filter-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    flex-shrink: 0;
  }

  .audit-status-view-btn {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
  }

  .audit-status-table thead th {
    font-size: 0.6875rem;
  }

  .audit-status-table th,
  .audit-status-table td {
    padding: 0.5rem 0.5rem;
  }

  .audit-status-card-title {
    font-size: 0.9375rem;
  }

  .audit-status-card-actions {
    flex-direction: column;
  }

  .audit-status-card-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

/* ================================ DARK THEME (night mode) ================================ */
body.night-mode .audit-status-container {
  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-status-header {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .audit-status-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-status-title::before {
  background: linear-gradient(180deg, #f87171, #ef4444);
}
body.night-mode .critical-findings-intro {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .audit-status-error {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.4);
}
body.night-mode .audit-status-container .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-status-container .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .filter-tab {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}
body.night-mode .filter-tab:hover {
  color: #f87171;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .filter-tab.active {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff;
  border-color: #ef4444;
}
body.night-mode .filter-tab:not(.active) .filter-count {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .audit-status-search-input {
  background: rgba(58, 56, 56, 1);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .audit-status-search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}
body.night-mode .audit-status-search-input:focus {
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}
body.night-mode .audit-status-view-toggle {
  border-color: rgba(255, 255, 255, 0.2);
}
body.night-mode .audit-status-view-btn {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border-right-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .audit-status-view-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f87171;
}
body.night-mode .audit-status-view-btn.active {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff;
}
body.night-mode .audit-status-table-wrap {
  background: rgba(58, 56, 56, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .audit-status-table thead th {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .audit-status-table td {
  color: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
body.night-mode .audit-status-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}
body.night-mode .audit-status-table-name {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .audit-status-loading,
body.night-mode .audit-status-empty {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .audit-status-card {
  background: rgba(58, 56, 56, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .audit-status-card:hover {
  border-color: rgba(248, 113, 113, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
body.night-mode .audit-status-card-title,
body.night-mode .audit-status-card-id {
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .audit-status-card-label,
body.night-mode .audit-status-card-value {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .audit-status-card-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .audit-status-open,
body.night-mode .audit-status-in-progress {
  background: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}
body.night-mode .audit-status-closed,
body.night-mode .audit-status-unknown {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .btn-forms,
body.night-mode .btn-in-progress {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .btn-forms:hover,
body.night-mode .btn-in-progress:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.35);
  border-color: #f87171;
  color: #fca5a5;
}
