/* Form History components; all account-page selectors remain scoped to Rahul Plugin. */
.rahul-plugin-ui .rahul-history-shell {
  width: min(100% - 24px, var(--rahul-dashboard-width));
  margin: 30px auto;
  padding: 28px;
  color: #243247;
  border: 1px solid #dce7f2;
  border-radius: var(--rahul-radius-xl);
  background: linear-gradient(145deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: 0 18px 48px rgba(38, 74, 116, 0.11);
}

.rahul-plugin-ui .rahul-history-head,
.rahul-plugin-ui .rahul-history-dashboard > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.rahul-plugin-ui .rahul-history-head h1,
.rahul-plugin-ui .rahul-history-dashboard h2 {
  margin: 10px 0 5px;
  color: #14243a;
}

.rahul-plugin-ui .rahul-history-head h1 {
  font-size: clamp(28px, 4vw, 38px);
}

.rahul-plugin-ui .rahul-history-head .rahul-ui-status {
  color: #166534 !important;
  border: 1px solid #86efac !important;
  background: #dcfce7 !important;
}

.rahul-plugin-ui .rahul-history-head p,
.rahul-plugin-ui .rahul-history-dashboard header p {
  margin: 0;
  color: #64748b;
  line-height: 1.55;
}

.rahul-plugin-ui .rahul-history-shell .rahul-ui-secondary,
.rahul-plugin-ui .rahul-history-dashboard .rahul-ui-secondary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  color: #334155 !important;
  border: 1px solid #cedbea;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(47, 79, 116, 0.07);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none !important;
  transition: border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.rahul-plugin-ui .rahul-history-shell .rahul-ui-secondary:hover,
.rahul-plugin-ui .rahul-history-dashboard .rahul-ui-secondary:hover {
  color: #087ff5 !important;
  border-color: #8bc7ff;
  transform: translateY(-1px);
}

.rahul-plugin-ui .rahul-history-shell .rahul-ui-primary,
.rahul-plugin-ui .rahul-history-dashboard .rahul-ui-primary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #fff !important;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #087ff5, #6266f1);
  box-shadow: 0 8px 20px rgba(31, 111, 238, 0.2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none !important;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.rahul-plugin-ui .rahul-history-shell .rahul-ui-primary:hover,
.rahul-plugin-ui .rahul-history-dashboard .rahul-ui-primary:hover {
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 11px 25px rgba(71, 76, 255, 0.25);
}

.rahul-plugin-ui .rahul-history-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(140px, 0.45fr)) auto auto;
  gap: 10px;
  align-items: end;
  margin: 24px 0;
  padding: 14px;
  border: 1px solid #dce7f2;
  border-radius: 16px;
  background: #f7faff;
}

.rahul-plugin-ui .rahul-history-filters label {
  display: grid;
  gap: 5px;
  color: #52657d;
  font-size: 11px;
  font-weight: 700;
}

.rahul-plugin-ui .rahul-history-filters input {
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  color: #17243a;
  border: 1px solid #cbd8e7;
  border-radius: 12px;
  outline: none;
  background: #fff;
  color-scheme: light;
  box-shadow: inset 0 1px 2px rgba(29, 58, 91, 0.03);
}

.rahul-plugin-ui .rahul-history-filters input:focus {
  border-color: #59aefc;
  box-shadow: 0 0 0 3px rgba(8, 127, 245, 0.1);
}

.rahul-plugin-ui .rahul-history-list,
.rahul-plugin-ui .rahul-history-recent {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 11px;
}

.rahul-plugin-ui .rahul-history-card {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 18px;
  border: 1px solid #dce7f2;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(37, 70, 108, 0.06);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.rahul-plugin-ui .rahul-history-card:hover {
  transform: translateY(-2px);
  border-color: #a9d6ff;
  box-shadow: 0 12px 28px rgba(37, 86, 140, 0.11);
}

.rahul-plugin-ui .rahul-history-card-main {
  flex: 1 1 auto;
  min-width: 0;
}

.rahul-plugin-ui .rahul-history-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rahul-plugin-ui .rahul-history-card-top small {
  overflow: hidden;
  color: #8292a7;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rahul-plugin-ui .rahul-history-expiry {
  display: inline-flex;
  padding: 5px 8px;
  color: #6d45c7;
  border: 1px solid #ded2fa;
  border-radius: 999px;
  background: #f5f1ff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.rahul-plugin-ui .rahul-history-card h3 {
  margin: 10px 0 7px;
  overflow-wrap: anywhere;
  color: #16253a;
  font-size: 16px;
  line-height: 1.45;
}

.rahul-plugin-ui .rahul-history-applicant {
  color: #132238;
  font-weight: 800;
}

.rahul-plugin-ui .rahul-history-form-name {
  color: #0873da;
  font-weight: 700;
}

.rahul-plugin-ui .rahul-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
  color: #6b7d92;
  font-size: 11.5px;
  line-height: 1.5;
}

.rahul-plugin-ui .rahul-history-meta span + span {
  position: relative;
}

.rahul-plugin-ui .rahul-history-meta span + span::before {
  position: absolute;
  top: 50%;
  left: -9px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #b3c0cf;
  content: '';
  transform: translateY(-50%);
}

.rahul-plugin-ui .rahul-history-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rahul-plugin-ui .rahul-history-actions form {
  margin: 0;
}

.rahul-plugin-ui .rahul-history-delete {
  min-height: 42px;
  padding: 0 14px;
  color: #c9364b;
  border: 1px solid #f2bdc5;
  border-radius: 11px;
  background: #fff5f6;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: background 180ms ease, border-color 180ms ease;
}

.rahul-plugin-ui .rahul-history-delete:hover {
  border-color: #e98594;
  background: #ffecef;
}

.rahul-plugin-ui .rahul-history-empty,
.rahul-plugin-ui .rahul-history-mini-empty {
  padding: 30px 18px;
  color: #64748b;
  text-align: center;
  border: 1px dashed #cbd9e7;
  border-radius: 17px;
  background: #f9fbfd;
}

.rahul-plugin-ui .rahul-history-empty > span {
  font-size: 30px;
}

.rahul-plugin-ui .rahul-history-empty h2 {
  margin: 10px 0 6px;
  color: #17243a;
}

.rahul-plugin-ui .rahul-history-dashboard {
  margin-top: 22px;
  padding: 19px;
  color: #243247;
  border: 1px solid #dce7f2;
  border-radius: 19px;
  background: linear-gradient(145deg, #fff, #f7fbff);
  box-shadow: 0 10px 28px rgba(38, 74, 116, 0.08);
}

.rahul-plugin-ui .rahul-history-dashboard h2 {
  margin-top: 0;
  font-size: 20px;
}

.rahul-plugin-ui .rahul-history-recent {
  margin-top: 15px;
}

.rahul-plugin-ui .rahul-history-privacy {
  margin: 15px 0 0;
  color: #718398;
  font-size: 10.5px;
  line-height: 1.55;
}

.rahul-plugin-ui .rahul-history-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
}

.rahul-plugin-ui .rahul-history-pagination .page-numbers {
  display: inline-grid;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  color: #52657d;
  border: 1px solid #d3dfeb;
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
}

.rahul-plugin-ui .rahul-history-pagination .current {
  color: #fff;
  border-color: #168bf6;
  background: #168bf6;
}

.rahul-history-toast {
  position: fixed;
  z-index: 2147483000;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 13px 16px;
  opacity: 0;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  background: #0b1c32;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  transform: translateY(12px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  font: 700 13px/1.45 system-ui, sans-serif;
}

.rahul-history-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.rahul-history-toast-success {
  border-color: rgba(26, 213, 153, 0.45);
}

.rahul-history-toast-error {
  border-color: rgba(255, 90, 111, 0.45);
}

.rahul-history-toast-loading {
  border-color: rgba(24, 201, 237, 0.45);
}

.rahul-history-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px 8px;
  color: #51627a;
  font: 700 11px/1.35 system-ui, sans-serif;
}

.rahul-history-inline-status > span {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(0, 132, 255, 0.25);
  border-top-color: #087ff5;
  border-radius: 50%;
  animation: rahul-history-spin 700ms linear infinite;
}

.rahul-history-inline-status.is-success {
  color: #0d8d64;
}

.rahul-history-inline-status.is-error {
  color: #c63e52;
}

@keyframes rahul-history-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .rahul-plugin-ui .rahul-history-shell {
    width: min(100% - 16px, var(--rahul-dashboard-width));
    margin: 20px auto;
    padding: 21px 16px;
    border-radius: 21px;
  }

  .rahul-plugin-ui .rahul-history-head,
  .rahul-plugin-ui .rahul-history-dashboard > header {
    display: grid;
  }

  .rahul-plugin-ui .rahul-history-filters {
    grid-template-columns: 1fr;
  }

  .rahul-plugin-ui .rahul-history-filters .rahul-ui-primary,
  .rahul-plugin-ui .rahul-history-filters .rahul-ui-secondary,
  .rahul-plugin-ui .rahul-history-head > .rahul-ui-secondary,
  .rahul-plugin-ui .rahul-history-dashboard header > .rahul-ui-secondary {
    width: 100%;
  }

  .rahul-plugin-ui .rahul-history-card {
    display: grid;
    gap: 14px;
    padding: 16px;
  }

  .rahul-plugin-ui .rahul-history-actions {
    justify-content: flex-start;
  }

  .rahul-plugin-ui .rahul-history-card h3 {
    font-size: 15px;
  }

  .rahul-history-toast {
    right: 14px;
    bottom: 14px;
    left: 14px;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .rahul-plugin-ui .rahul-history-card-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .rahul-plugin-ui .rahul-history-actions,
  .rahul-plugin-ui .rahul-history-actions form,
  .rahul-plugin-ui .rahul-history-actions .rahul-ui-primary,
  .rahul-plugin-ui .rahul-history-delete {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rahul-plugin-ui .rahul-history-card,
  .rahul-history-toast {
    transition-duration: 0.001ms !important;
  }

  .rahul-history-inline-status > span {
    animation: none !important;
  }
}
