/* Demo interface styles */

.demo-page {
  max-width: 680px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: system-ui, sans-serif;
  color: #1a1a1a;
}

.demo-header {
  margin-bottom: 1.5rem;
}

.demo-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
}

.demo-subtitle {
  color: #555;
  margin: 0;
}

.demo-back {
  display: inline-block;
  color: #0070f3;
  text-decoration: none;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.demo-back:hover { text-decoration: underline; }

/* Cards */
.demo-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.demo-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.demo-card--signing {
  background: #f9fafb;
}

/* Alerts */
.demo-alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.demo-alert--error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.demo-alert--warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.demo-alert--success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }

/* Forms */
.demo-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.demo-form--inline {
  gap: 0.75rem;
}

.demo-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.demo-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
}

.demo-field input[type="text"],
.demo-field input[type="email"],
.demo-field input[type="tel"],
.demo-field input[type="password"],
.demo-field input[type="file"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.demo-field--fieldset {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.demo-field--fieldset legend {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  padding: 0 0.25rem;
}

.demo-radio-label {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  cursor: pointer;
}

.demo-conditional {
  margin-top: 0.5rem;
  padding-left: 0.5rem;
  border-left: 3px solid #e0e0e0;
}

/* Buttons */
.demo-btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  text-align: center;
}

.demo-btn--primary {
  background: #0070f3;
  color: #fff;
}

.demo-btn--primary:hover { background: #0060d3; }
.demo-btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }

.demo-btn--secondary {
  background: #f3f4f6;
  color: #1a1a1a;
  border: 1px solid #d1d5db;
}

.demo-btn--secondary:hover { background: #e5e7eb; }

/* Definition list */
.demo-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.demo-dl dt {
  font-weight: 600;
  color: #555;
  align-self: start;
  padding-top: 0.1rem;
}

.demo-dl dd {
  margin: 0;
  word-break: break-word;
}

/* Mono text */
.demo-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.demo-mono--wrap {
  word-break: break-all;
}

/* Status badges */
.demo-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.demo-badge--active  { background: #dcfce7; color: #166534; }
.demo-badge--pending { background: #fef9c3; color: #854d0e; }
.demo-badge--revoked { background: #fee2e2; color: #991b1b; }
.demo-badge--expired { background: #f3f4f6; color: #6b7280; }

/* Signature textarea */
.demo-signature {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.5rem;
  box-sizing: border-box;
  resize: vertical;
  background: #f9fafb;
  color: #374151;
}

/* OTP hint */
.demo-otp-hint {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: #1e40af;
}

.demo-otp-hint p { margin: 0; }

.demo-hint {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 0.75rem;
}

/* Sections */
.demo-section {
  margin-bottom: 2rem;
}

.demo-section__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e5e7eb;
}

/* Certificate list */
.demo-cert-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.demo-cert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  flex-wrap: wrap;
}

.demo-cert-card__info {
  flex: 1;
  min-width: 0;
}

.demo-cert-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.demo-cert-card__meta {
  font-size: 0.85rem;
  color: #555;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.demo-cert-card__method {
  color: #6b7280;
}

.demo-cert-card__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Small button variant */
.demo-btn--sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Danger button */
.demo-btn--danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.demo-btn--danger:hover { background: #fecaca; }

/* Sign result actions row */
.demo-sign-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

/* Locale selector */
.demo-locale-selector {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.demo-locale-btn {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  color: #555;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
}

.demo-locale-btn:hover { background: #e5e7eb; }

.demo-locale-btn--active {
  background: #0070f3;
  color: #fff;
  border-color: #0070f3;
}

/* Select field */
.demo-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
}

/* Field hint */
.demo-field__hint {
  font-size: 0.8rem;
  color: #6b7280;
}

/* Navigation */
.demo-nav {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.demo-nav__container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.demo-nav__brand {
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a1a;
  text-decoration: none;
  white-space: nowrap;
}

.demo-nav__brand:hover { color: #0070f3; }

.demo-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.demo-nav__email {
  font-size: 0.85rem;
  color: #6b7280;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-link {
  color: #0070f3;
  text-decoration: underline;
}

.demo-link:hover { color: #0060d3; }

.demo-nav__link {
  font-size: 0.9rem;
  color: #374151;
  text-decoration: none;
  font-weight: 500;
}

.demo-nav__link:hover { color: #0070f3; }

.demo-nav__btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  text-align: center;
}

.demo-nav__btn--primary {
  background: #0070f3;
  color: #fff;
}

.demo-nav__btn--primary:hover { background: #0060d3; }

.demo-nav__btn--secondary {
  background: #f3f4f6;
  color: #1a1a1a;
  border: 1px solid #d1d5db;
}

.demo-nav__btn--secondary:hover { background: #e5e7eb; }

.demo-nav__locale {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.demo-nav__locale-sep {
  color: #9ca3af;
  font-size: 12px;
  user-select: none;
}

.demo-nav__locale-btn {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #9ca3af;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
}

.demo-nav__locale-btn:hover { color: #0070f3; }

.demo-nav__locale-btn--active { color: #0070f3; }

/* Main container */
.demo-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

/* Flash messages */
.demo-flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.demo-flash--notice {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.demo-flash--notice::before { content: "ℹ️"; }

.demo-flash--alert {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.demo-flash--alert::before { content: "⚠️"; }
