/* ============================================================
   Nova Tutor Academy — forms.css
   Form shell, inputs, selects, textareas, admin dashboard
   ============================================================ */

/* ── Form shell (white card wrapping a form) ── */
.form-shell {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}
.form-shell h2 { margin-bottom: 6px; color: var(--navy); }
.form-intro { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 28px; }

/* ── Form grid ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

/* ── Labels ── */
label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.required { color: red; margin-left: 1px; }

/* ── Inputs, selects, textareas ── */
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  appearance: none;
  -webkit-appearance: none;
}
.form-control::placeholder { color: var(--text-light); }
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43,94,167,0.12);
}
.form-control.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}
.form-control.success {
  border-color: var(--success);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

textarea.form-control {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

/* ── Field error message ── */
.field-error {
  font-size: 0.78rem;
  color: var(--error);
  display: none;
}
.form-group.has-error .field-error { display: block; }

/* ── Form actions ── */
.form-actions {
  margin-top: 28px;
}
.submit-button { min-width: 200px; }
.submit-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ── Form status messages ── */
.form-status {
  margin-top: 16px;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  min-height: 0;
  transition: all 0.2s;
}
.form-status.status-success {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 15px 16px;
  font-weight: 600;
  line-height: 1.6;
  box-shadow: 0 8px 22px rgba(22, 101, 52, 0.08);
}
.form-status.status-success::before {
  display: inline-grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #16a34a;
  content: "\2713";
  font-size: 0.85rem;
  font-weight: 900;
  line-height: 1;
}
.form-status.submission-confirmation {
  position: fixed;
  z-index: 1000;
  top: 88px;
  left: 50%;
  width: min(620px, calc(100% - 32px));
  margin: 0;
  padding: 18px 20px;
  transform: translateX(-50%);
  box-shadow: 0 18px 45px rgba(15, 31, 61, 0.22);
  animation: submission-confirmation-in 220ms ease-out;
}
@keyframes submission-confirmation-in {
  from {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
.form-status.status-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 16px;
}
.form-status.status-loading,
.form-status.status-info {
  color: var(--text-muted);
  padding: 4px 0;
}

/* ── Contact list ── */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: box-shadow 0.18s, border-color 0.18s;
  color: var(--text);
}
.contact-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--blue-light);
  text-decoration: none;
}
.contact-item > span:first-child {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.contact-item strong { color: var(--navy); font-size: 0.9rem; display: block; }
.contact-item span span { font-size: 0.88rem; color: var(--text-muted); }
.contact-item > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ── Login card (admin) ── */
.admin-page {
  background: var(--slate);
  min-height: 100vh;
}
.admin-signin-page {
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-dashboard-page { display: block; }
.admin-login {
  width: 100%;
  padding: 40px 24px;
  display: flex;
  justify-content: center;
}
#adminLoginForm a {
  font-size: 14px;
  color: gray;
}
#adminLoginForm a:hover {
  color: darkgray;
  text-decoration: underline;
}
.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 44px 40px;
}
.login-card h2 { font-size: 1.5rem; margin-bottom: 6px; }
.login-card .form-intro { margin-bottom: 28px; }
.login-card .form-group { text-align: left; }

/* ── Admin dashboard ── */
.admin-dashboard { padding-block: 48px; min-height: 100vh; background: var(--slate); }
.admin-shell { display: flex; flex-direction: column; gap: 28px; }
.admin-shell,
.tab-panel,
.table-card {
  min-width: 0;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
}
.admin-header h1 { font-size: 1.6rem; margin-bottom: 4px; }
.admin-header p  { font-size: 0.88rem; color: var(--text-muted); }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.admin-stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 3px solid var(--gold);
}
.admin-stat span { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.admin-stat strong { font-size: 2rem; font-family: var(--font-display); color: var(--navy); line-height: 1; }

/* ── Admin tabs ── */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  width: 100%;
  flex-wrap: wrap;
}
.tab-button {
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
}
.tab-button.active {
  background: var(--navy);
  color: var(--white);
}
.tab-button:hover:not(.active) { background: var(--slate); color: var(--navy); }

/* ── Table ── */
.table-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead {
  background: var(--slate);
  border-bottom: 2px solid var(--border);
}
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
/* .data-table tbody tr:hover { background: var(--slate); } */
.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 40px !important;
  font-size: 0.9rem;
}

/* ── Tab panels ── */
.tab-panel[hidden] { display: none; }

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.table-btn,
.table-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s, color 0.18s;
}
.table-btn:hover,
.table-icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.table-btn.approve {
  background: #ecfdf3;
  color: #166534;
  border-color: #bbf7d0;
}
.table-btn.reject {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
.table-btn.edit {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.table-btn.cv-download {
  min-height: 38px;
  padding: 8px 14px;
  gap: 8px;
  border-color: #1d4ed8;
  border-radius: 10px;
  color: #ffffff;
  background: #1d4ed8;
  box-shadow: 0 5px 14px rgba(29, 78, 216, 0.2);
  white-space: nowrap;
}
.table-btn.cv-download:hover {
  border-color: #1e40af;
  color: #ffffff;
  background: #1e40af;
  box-shadow: 0 7px 18px rgba(29, 78, 216, 0.28);
}
.table-btn.cv-download i {
  font-size: 0.95rem;
}
.table-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
}
.table-icon-btn.danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.admin-confirm {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 61, 0.42);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 2100;
}
.admin-confirm[hidden] { display: none; }
.admin-confirm-card {
  width: min(100%, 460px);
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}
.admin-confirm-card h2 {
  margin-bottom: 10px;
}
.admin-confirm-card p {
  margin-bottom: 22px;
}

.admin-toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 560px);
  z-index: 2000;
  pointer-events: none;
}
.admin-toast {
  pointer-events: auto;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  animation: adminToastIn 180ms ease-out;
}
.admin-toast-success {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}
.admin-toast-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.admin-toast-loading {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

@keyframes adminToastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive forms ── */
@media (max-width: 1100px) {
  .admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-shell { padding: 24px 20px; }
  .form-control { font-size: 1rem; }
  .form-actions.button-row {
    align-items: stretch;
    flex-direction: column;
  }
  .form-actions .btn,
  .submit-button {
    width: 100%;
    min-width: 0;
  }
  .login-card { padding: 32px 24px; }
  .admin-dashboard { padding-block: 24px; }
  .admin-shell { gap: 20px; }
  .admin-stats { gap: 10px; }
  .admin-stat { padding: 18px; }
  .admin-header { flex-direction: column; }
  .admin-header { padding: 22px 20px; }
  .admin-header .button-row {
    width: 100%;
    align-items: stretch;
  }
  .admin-header .btn { flex: 1; }
  .admin-tabs { flex-direction: column; }
  .tab-button { width: 100%; text-align: center; }
  .data-table th,
  .data-table td { padding-inline: 12px; }
  .admin-confirm-card { padding: 22px 20px; }
}

@media (max-width: 420px) {
  .admin-stats { grid-template-columns: 1fr; }
  .admin-header .button-row { flex-direction: column; }
  .admin-header .btn { width: 100%; }
}
