/*
 * ID-Webdev Identity - shared design system for all non-admin pages.
 * Layered on top of Bootstrap 5 (loaded before this file).
 */

:root {
  --id-bg-1: #0f172a;   /* deep slate */
  --id-bg-2: #1e293b;
  --id-bg-3: #334155;
  --id-surface: #ffffff;
  --id-surface-muted: #f8fafc;
  --id-border: #e5e9f0;
  --id-text: #1f2733;
  --id-muted: #64748b;
  --id-accent: #e02d1b;         /* Garena red (brand, badges, destructive) */
  --id-accent-hover: #b8210f;
  --id-accent-soft: #fde8e6;
  --id-primary: #2563eb;        /* primary CTA blue - red reads as cancel/stop */
  --id-primary-hover: #1d4ed8;
  --id-success: #16a34a;
  --id-radius: 18px;
  --id-radius-sm: 12px;
  --id-shadow: 0 24px 60px -20px rgba(2, 6, 23, 0.55);
  --id-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

html, body {
  min-height: 100%;
}

body.id-body {
  margin: 0;
  font-family: var(--id-font);
  color: var(--id-text);
  background: radial-gradient(1200px 600px at 15% -10%, var(--id-bg-3) 0%, transparent 55%),
    linear-gradient(135deg, var(--id-bg-1) 0%, var(--id-bg-2) 100%);
  /* no background-attachment: fixed - it is buggy on iOS Safari; instead the
     body always spans the viewport so the gradient covers it */
  min-height: 100vh;
  min-height: 100svh;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 767.98px) {
  body.id-body {
    padding: 16px 10px;
  }
}

/* ---- Card shell ---- */
.id-card {
  width: 100%;
  /* 85% of the viewport, capped so text lines stay readable on very wide monitors */
  max-width: min(85vw, 1440px);
  /* enough height for presence without large empty areas
     (vh fallback first, svh where supported) */
  min-height: min(432px, calc(100vh - 64px));
  min-height: min(432px, calc(100svh - 64px));
  display: flex;
  flex-direction: column;
  background: var(--id-surface);
  border-radius: var(--id-radius);
  box-shadow: var(--id-shadow);
  overflow: hidden;
}

@media (max-width: 767.98px) {
  /* on phones the 85vw cap wastes space; use the full width (body padding
     already provides the outer margin) and near-full height for an app feel */
  .id-card {
    max-width: 100%;
    min-height: calc(100vh - 32px);
    min-height: calc(100svh - 32px);
  }
}

.id-card__body {
  padding: 32px 36px 36px;
  /* fill the card and center the content that follows the brand bar */
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* equal flexible space above the first content block and below the last one
   keeps the brand bar pinned to the top while the rest is centered */
.id-card__body > .id-brandbar + * {
  margin-top: auto;
}

.id-card__body::after {
  content: "";
  margin-top: auto;
}

@media (max-width: 575.98px) {
  .id-card__body {
    padding: 24px 20px 28px;
  }
}

/* ---- Brand bar ---- */
.id-brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--id-border);
}

.id-brandbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.id-brandbar__logo {
  height: 38px;
  width: auto;
  flex-shrink: 0;
}

.id-brandbar__title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  color: var(--id-text);
  white-space: nowrap;
}

.id-brandbar__title small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--id-muted);
  letter-spacing: 0.3px;
}

@media (max-width: 575.98px) {
  .id-brandbar {
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 18px;
  }
  .id-brandbar__logo {
    height: 28px;
  }
  /* let the title wrap instead of forcing horizontal overflow */
  .id-brandbar__title {
    white-space: normal;
    font-size: 0.98rem;
  }
}

@media (max-width: 479.98px) {
  /* not enough room for the subtitle next to the logo and (on the session
     page) the logout button */
  .id-brandbar__title small {
    display: none;
  }
}

/* ---- Two-column responsive split ---- */
.id-split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
}

.id-split__aside {
  border-right: 1px solid var(--id-border);
  padding-right: 32px;
}

@media (max-width: 767.98px) {
  .id-split {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .id-split__aside {
    border-right: none;
    border-bottom: 1px solid var(--id-border);
    padding-right: 0;
    padding-bottom: 24px;
    text-align: center;
  }
}

.id-hero__logo {
  width: 128px;
  max-width: 40%;
  margin-bottom: 18px;
}

.id-hero__title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.id-hero__lead {
  color: var(--id-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 0;
}

.id-hero__dest {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--id-text);
}

/* ---- Login option panels ---- */
.id-panel {
  border: 1px solid var(--id-border);
  border-radius: var(--id-radius-sm);
  padding: 18px;
  background: var(--id-surface-muted);
}

.id-panel + .id-panel {
  margin-top: 16px;
}

.id-panel__label {
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--id-muted);
  margin-bottom: 12px;
}

/* ---- Buttons ---- */
.id-btn {
  /* inline-block (not flex) so mixed text + <strong> content wraps as normal prose */
  display: inline-block;
  text-align: center;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.05s ease;
  line-height: 1.2;
}

.id-btn:active {
  transform: translateY(1px);
}

.id-btn--primary {
  background: var(--id-primary);
  color: #fff;
}

.id-btn--primary:hover {
  background: var(--id-primary-hover);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(29, 78, 216, 0.7);
}

.id-btn--ghost {
  background: transparent;
  color: var(--id-text);
  border-color: var(--id-border);
}

.id-btn--ghost:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: var(--id-text);
}

.id-btn--danger {
  background: transparent;
  color: var(--id-accent);
  border-color: var(--id-accent);
}

.id-btn--danger:hover {
  background: var(--id-accent);
  color: #fff;
}

.id-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 575.98px) {
  /* full-width tap targets for CTAs on phones */
  .id-btn {
    display: block;
    width: 100%;
  }
  /* ...except the small logout button in the brand bar */
  .id-brandbar .id-btn {
    display: inline-block;
    width: auto;
    padding: 8px 14px;
    font-size: 0.88rem;
  }
}

/* ---- Badges ---- */
.id-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--id-accent-soft);
  color: var(--id-accent);
}

/* ---- Session detail list ---- */
.id-details {
  width: 100%;
  border-collapse: collapse;
}

.id-details th,
.id-details td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--id-border);
  vertical-align: middle;
}

.id-details th {
  color: var(--id-muted);
  font-weight: 600;
  width: 190px;
  white-space: nowrap;
}

.id-details tr:last-child th,
.id-details tr:last-child td {
  border-bottom: none;
}

@media (max-width: 575.98px) {
  /* stack each detail row: label on top, value below */
  .id-details,
  .id-details tbody,
  .id-details tr,
  .id-details th,
  .id-details td {
    display: block;
    width: auto;
  }
  .id-details tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--id-border);
  }
  .id-details tr:last-child {
    border-bottom: none;
  }
  .id-details th,
  .id-details td {
    padding: 0;
    border-bottom: none;
  }
  .id-details th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
  }
  .id-details td {
    word-break: break-word;
  }
}

.id-note {
  color: var(--id-muted);
  font-size: 0.9rem;
  margin-top: 20px;
}

/* ---- Section heading ---- */
.id-heading {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 18px;
}

/* ---- Alerts (register success) ---- */
.id-alert {
  border-radius: var(--id-radius-sm);
  padding: 14px 16px;
  font-size: 0.92rem;
  margin-bottom: 14px;
}

.id-alert--success {
  background: #e7f7ee;
  color: #10633a;
}

.id-alert--warn {
  background: #fff5e6;
  color: #8a5300;
}

/* ---- Field (register success) ---- */
.id-field {
  margin-bottom: 14px;
}

.id-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--id-muted);
  margin-bottom: 4px;
}

.id-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--id-border);
  border-radius: 10px;
  background: var(--id-surface-muted);
  color: var(--id-text);
  font-size: 0.95rem;
}

/* ---- Countdown ring (inside the auto-continue button) ---- */
.id-countdown-ring {
  vertical-align: -0.22em;
  margin-right: 8px;
}

.id-countdown-ring__track {
  /* faint full-circle outline that stays visible even when the
     remaining-time arc is almost gone */
  stroke: rgba(255, 255, 255, 0.35);
}

.id-countdown-ring__bar {
  stroke: #fff;
  /* start the arc at 12 o'clock */
  transform: rotate(-90deg);
  transform-origin: center;
}

.id-autonote {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--id-muted);
}

/* link-styled cancel button inside the auto-continue note */
.id-cancel-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--id-muted);
  cursor: pointer;
}

.id-cancel-link__word {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.id-cancel-link:hover .id-cancel-link__word {
  /* underline color follows the text color */
  color: var(--id-accent);
}

/* ---- CSS spinner (replaces the old missing gif) ---- */
.id-spinner {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  border: 3px solid rgba(224, 45, 27, 0.25);
  border-top-color: var(--id-accent);
  border-radius: 50%;
  animation: id-spin 0.7s linear infinite;
  vertical-align: -0.2em;
}

.id-spinner--lg {
  width: 44px;
  height: 44px;
  border-width: 5px;
}

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

/* ---- Error page ---- */
.id-error {
  text-align: center;
}

.id-error__code {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--id-accent);
  margin-bottom: 8px;
}

.id-error__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.id-error__message {
  color: var(--id-muted);
  font-size: 0.98rem;
  margin-bottom: 24px;
}

.id-error__trace {
  text-align: left;
  margin-top: 24px;
  background: var(--id-surface-muted);
  border: 1px solid var(--id-border);
  border-radius: var(--id-radius-sm);
  padding: 14px;
  overflow: auto;
  max-height: 320px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.id-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.id-stack-gap > * + * {
  margin-top: 12px;
}
