/**
 * Elimu ERP: Admissions & Inquiries Stylesheet
 * Responsive, accessible UI for public forms, parent portal & staff dashboard.
 */

/* Colours, radii and fonts come from Elimu ERP Core's design tokens (--eerp-*), so the school's chosen
   colours apply automatically. This file no longer redeclares Core's tokens on the page. */

/* Forms & Public Widgets */
.eerp-inquiry-container,
.eerp-application-container,
.eerp-my-applications-wrap,
.eerp-dashboard-wrap {
  background: var(--eerp-surface);
  border: 1px solid var(--eerp-border);
  border-radius: var(--eerp-radius);
  padding: 24px;
  margin: 20px 0;
  color: var(--eerp-text);
  font-family: var(--eerp-font-body);
  box-sizing: border-box;
}

.eerp-form-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--eerp-border);
  padding-bottom: 16px;
}

.eerp-form-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--eerp-text);
}

.eerp-form-desc {
  margin: 0;
  font-size: 14px;
  color: var(--eerp-text-muted);
}

.eerp-badge-auth-notice {
  background: var(--eerp-status-present-soft);
  border: 1px solid var(--eerp-border);
  color: var(--eerp-status-present-text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 12px;
}

/* Form Layout */
.eerp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.eerp-form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .eerp-form-row,
  .eerp-form-row-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.eerp-form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.eerp-form-group label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--eerp-text);
}

.eerp-req {
  color: var(--eerp-status-absent);
}

.eerp-field-hint {
  font-size: 12px;
  color: var(--eerp-text-muted);
  margin-top: 4px;
}

.eerp-input,
.eerp-select,
.eerp-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--eerp-neutral-300);
  border-radius: 6px;
  font-size: 14px;
  color: var(--eerp-text);
  background-color: var(--eerp-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.eerp-input:focus,
.eerp-select:focus,
.eerp-textarea:focus {
  border-color: var(--eerp-brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.eerp-textarea {
  resize: vertical;
}

/* Sections */
.eerp-form-section {
  border: 1px solid var(--eerp-border);
  border-radius: 6px;
  padding: 18px;
  margin-bottom: 20px;
  background: var(--eerp-neutral-50);
}

.eerp-section-legend {
  font-weight: 700;
  font-size: 14px;
  padding: 0 8px;
  color: var(--eerp-neutral-700);
}

/* Honeypot Bot Trap */
.eerp-hp-field-wrap {
  display: none !important;
  visibility: hidden !important;
}

/* Buttons */
.eerp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

/* Every state is set explicitly so the theme's own button hover and focus colours cannot override it. */
.eerp-btn.eerp-btn-primary,
.eerp-btn.eerp-btn-primary:hover,
.eerp-btn.eerp-btn-primary:focus,
.eerp-btn.eerp-btn-primary:active {
  color: var(--eerp-on-brand) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.eerp-btn.eerp-btn-primary {
  background-color: var(--eerp-brand) !important;
}
.eerp-btn.eerp-btn-primary:hover:not(:disabled),
.eerp-btn.eerp-btn-primary:focus:not(:disabled),
.eerp-btn.eerp-btn-primary:active:not(:disabled) {
  background-color: var(--eerp-brand-hover) !important;
}

.eerp-btn.eerp-btn-secondary,
.eerp-btn.eerp-btn-secondary:hover,
.eerp-btn.eerp-btn-secondary:focus,
.eerp-btn.eerp-btn-secondary:active {
  color: var(--eerp-brand) !important;
  border-color: var(--eerp-brand) !important;
  box-shadow: none !important;
}
.eerp-btn.eerp-btn-secondary {
  background-color: var(--eerp-surface) !important;
}
.eerp-btn.eerp-btn-secondary:hover:not(:disabled),
.eerp-btn.eerp-btn-secondary:focus:not(:disabled),
.eerp-btn.eerp-btn-secondary:active:not(:disabled) {
  background-color: var(--eerp-brand-soft) !important;
}

.eerp-btn:focus-visible {
  outline: 2px solid var(--eerp-brand);
  outline-offset: 2px;
}

.eerp-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Alert Boxes */
.eerp-alert-box {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.eerp-alert-success {
  background-color: var(--eerp-status-present-soft);
  border: 1px solid var(--eerp-border);
  color: var(--eerp-status-present-text);
}

.eerp-alert-error {
  background-color: var(--eerp-status-absent-soft);
  border: 1px solid var(--eerp-border);
  color: var(--eerp-status-absent-text);
}

/* Badges & Status Pills */
.eerp-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.eerp-badge-new,
.eerp-badge-submitted { background: var(--eerp-brand-soft); color: var(--eerp-brand); }
.eerp-badge-contacted,
.eerp-badge-under_review { background: var(--eerp-status-late-soft); color: var(--eerp-status-late-text); }
.eerp-badge-touring,
.eerp-badge-interview_scheduled { background: var(--eerp-brand-accent-soft); color: var(--eerp-brand); }
.eerp-badge-converted,
.eerp-badge-accepted { background: var(--eerp-status-present-soft); color: var(--eerp-status-present-text); }
.eerp-badge-enrolled { background: var(--eerp-status-present-soft); color: var(--eerp-status-present-text); }
.eerp-badge-closed,
.eerp-badge-rejected { background: var(--eerp-status-absent-soft); color: var(--eerp-status-absent-text); }
.eerp-badge-waitlisted { background: var(--eerp-status-late-soft); color: var(--eerp-status-late-text); }

/* Dashboard Metric Cards */
.eerp-dash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eerp-dash-title {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
}

.eerp-dash-desc {
  margin: 0;
  color: var(--eerp-text-muted);
  font-size: 14px;
}

.eerp-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.eerp-metric-card {
  padding: 16px;
  border-radius: 8px;
  background: var(--eerp-surface);
  border: 1px solid var(--eerp-border);
  display: flex;
  flex-direction: column;
}

.eerp-border-blue { border-left: 4px solid var(--eerp-brand); }
.eerp-border-amber { border-left: 4px solid var(--eerp-status-late); }
.eerp-border-purple { border-left: 4px solid var(--eerp-brand-accent); }
.eerp-border-emerald { border-left: 4px solid var(--eerp-status-present); }

.eerp-metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--eerp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.eerp-metric-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--eerp-neutral-900);
  margin: 4px 0;
}

.eerp-metric-sub {
  font-size: 12px;
  color: var(--eerp-text-muted);
}

/* Tabs */
.eerp-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--eerp-border);
  margin-bottom: 20px;
}

/* !important below is deliberate and scoped only to this class: the
   active theme's default <button> styling (a solid blue background) was
   overriding the plain-background reset, leaving blue active-tab text on
   a blue background and making it unreadable. */
.eerp-tab-btn {
  background-color: transparent !important;
  border: none !important;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--eerp-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent !important;
}

.eerp-tab-btn.active {
  background-color: transparent !important;
  color: var(--eerp-brand);
  border-bottom-color: var(--eerp-brand) !important;
}

/* FIX: the theme's default button hover state turns text white on
   hover, which combined with our transparent background above left
   white-on-white text when hovering a tab. Force a legible color on
   hover too. */
.eerp-tab-btn:hover {
  background-color: transparent !important;
  color: var(--eerp-brand) !important;
}

/* Filters */
.eerp-filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.eerp-filter-item {
  flex: 1;
  min-width: 180px;
}

/* Tables */
.eerp-table-responsive {
  overflow-x: auto;
}

.eerp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.eerp-table th {
  background: var(--eerp-neutral-50);
  padding: 10px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--eerp-border);
  color: var(--eerp-neutral-600);
}

.eerp-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--eerp-neutral-100);
  vertical-align: middle;
}

.eerp-table tr:hover {
  background: var(--eerp-neutral-50);
}

/* Modals */
.eerp-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
}

.eerp-modal-content {
  background: var(--eerp-surface);
  border-radius: 10px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.eerp-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--eerp-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eerp-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--eerp-text-muted);
}

.eerp-modal-body {
  padding: 20px;
  overflow-y: auto;
}

.eerp-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--eerp-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.eerp-modal-details-grid {
  background: var(--eerp-neutral-50);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Serif heading font in the school's brand colour for form and dashboard titles. */
.eerp-form-title {
  font-family: var(--eerp-font-display);
  font-weight: 500;
  color: var(--eerp-brand);
}
