/* Shared application components.
   Feature styles may extend these components, but should not redefine their
   core palette, radii, or border treatment. */

:where(.case-card, .form-card, .table-wrap, .empty-state, .welcome, .module-card) {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

:where(.case-card, .form-card, .table-wrap, .empty-state, .welcome) {
  border-radius: var(--radius-xl);
}

.module-card {
  border-radius: var(--radius-lg);
}

:where(.alert, .success-alert, .setup-alert) {
  border-radius: var(--radius-md);
}

.alert {
  background: var(--color-danger-soft);
  color: var(--color-danger-hover);
}

.success-alert {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.status-pill,
.module-badge,
.audience-pill,
.evidence-type-pill {
  border-radius: var(--radius-pill);
}

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--color-surface-soft);
  color: var(--color-text-muted);
}

.data-table th,
.data-table td {
  border-bottom-color: var(--color-border);
}

/* Shared search treatment. Search inputs should look the same in directories,
   reports, dashboards, and future screens. */
input[type="search"],
.student-finder-form input {
  min-height: 48px;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: .95rem;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

input[type="search"]::placeholder,
.student-finder-form input::placeholder {
  color: #7b8798;
  opacity: 1;
  font-weight: 400;
}

input[type="search"]:focus,
.student-finder-form input:focus {
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: var(--focus-ring);
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

.app-search-card,
.directory-search-card {
  margin-bottom: var(--space-5);
  padding: 16px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.app-search-label,
.directory-search-card > label {
  display: block;
  margin: 0 0 8px;
  color: var(--color-text-strong);
  font-size: .74rem;
  font-weight: var(--font-weight-heavy);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.app-search-form {
  display: block !important;
  padding: 0 !important;
  margin: 0;
}

.app-search-row,
.directory-search-row {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  align-items: center;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}

.app-search-row > .app-search-icon,
.directory-search-row > span {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--color-text-muted);
  font-size: .9rem;
}

.app-search-row input[type="search"],
.directory-search-row input[type="search"] {
  min-width: 0;
  width: 100%;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding-left: 0;
}

.app-search-row:focus-within,
.directory-search-row:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

/* Dashboard search uses the same compact search card as the directories. */
.dashboard-student-search.student-finder-compact {
  margin: 14px 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.dashboard-student-search .student-search-results {
  margin-top: 14px;
}

.dashboard-student-search .student-search-clear {
  display: inline-flex;
  margin-top: 8px;
}

/* Demo banner uses one presentation for every demo role/account. */
.demo-environment-banner {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 22px;
  background: #b91c1c;
  color: #fff;
  border-bottom: 4px solid #b91c1c;
  font-size: .82rem;
  font-weight: var(--font-weight-heavy);
  letter-spacing: .025em;
  text-align: center;
  position: relative;
  z-index: 1000;
}

/* Standard collapsible section treatment for new accordion-style UI. */
.app-collapsible {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: clip;
}

.app-collapsible > summary {
  min-height: var(--control-height);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-weight: var(--font-weight-heavy);
  color: var(--color-text-strong);
}

.app-collapsible > summary::marker { content: ""; }
.app-collapsible > summary::-webkit-details-marker { display: none; }

.app-collapsible[open] > summary {
  border-bottom: 1px solid var(--color-border);
}

.app-collapsible-body { padding: var(--space-4); }

/* Shared action-row rhythm. */
.form-actions,
.case-header-actions,
.reports-filter-actions,
.ai-assistant-actions,
.student-contact-action {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

@media (max-width: 680px) {
  .app-search-card,
  .directory-search-card,
  .dashboard-student-search.student-finder-compact { padding: 14px; }

  .demo-environment-banner {
    padding: 6px 14px;
    font-size: .75rem;
  }
}
