/* ==========================================================================
   Nursing Conference Certificate Portal — stylesheet
   Brand: primary #008D9B · secondary #00A6B5 · bg #F5F8FA · text #1F2937
   ========================================================================== */

:root {
  --color-primary: #008D9B;
  --color-secondary: #00A6B5;
  --color-bg: #F5F8FA;
  --color-text: #1F2937;
  --color-card: #FFFFFF;
  --radius: 16px;
  --shadow-soft: 0 10px 30px rgba(0, 78, 86, 0.10), 0 2px 8px rgba(0, 78, 86, 0.06);
  --shadow-soft-hover: 0 16px 40px rgba(0, 78, 86, 0.16), 0 4px 12px rgba(0, 78, 86, 0.08);
  --font-body: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 24px;
}

/* ---------------------------------------------------------------------- */
/* Card                                                                    */
/* ---------------------------------------------------------------------- */

.cert-card {
  width: 100%;
  max-width: 480px;
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 40px 36px 36px;
  text-align: center;
}

.cert-card--wide {
  max-width: 620px;
}

.cert-card__logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.cert-card__logo img {
  height: 84px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

.cert-card__title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.cert-card__subtitle {
  font-size: 0.98rem;
  color: #5B6472;
  line-height: 1.55;
  margin: 0 0 28px;
}

/* ---------------------------------------------------------------------- */
/* Form                                                                    */
/* ---------------------------------------------------------------------- */

.cert-form {
  text-align: left;
}

.cert-input {
  border-radius: 12px;
  border: 1.5px solid #E1E7ED;
  padding: 0.95rem 1rem;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cert-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(0, 141, 155, 0.14);
}

.cert-input.is-invalid {
  border-color: #E4572E;
}

.form-floating > label {
  color: #8A93A0;
}

.cert-form__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #8A93A0;
  margin: 6px 2px 4px;
}

.cert-form__counter {
  font-variant-numeric: tabular-nums;
}

.cert-form__error {
  min-height: 1.1rem;
  color: #E4572E;
  font-size: 0.85rem;
  margin: 4px 2px 18px;
  text-align: left;
}

.cert-notice {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  text-align: center;
  color: var(--color-primary);
  font-size: 0.8rem;
  line-height: 1.5;
  font-weight: 500;
  background: rgba(0, 141, 155, 0.07);
  border: 1px solid rgba(0, 141, 155, 0.16);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 20px;
}

.cert-notice__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.cert-btn {
  border-radius: 14px;
  padding: 1rem 1.75rem;
  min-height: 52px;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease,
              background 0.2s ease,
              border-color 0.2s ease;
}

.cert-btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.cert-btn--primary {
  background: linear-gradient(180deg, var(--color-secondary) 0%, var(--color-primary) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 141, 155, 0.30), 0 1px 2px rgba(0, 78, 86, 0.08);
}

.cert-btn--primary:hover,
.cert-btn--primary:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 141, 155, 0.36), 0 2px 6px rgba(0, 78, 86, 0.10);
}

.cert-btn--primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 3px 10px rgba(0, 141, 155, 0.30);
}

.cert-btn--secondary {
  background: #fff;
  color: var(--color-primary);
  border: 1.5px solid #CFE4E7;
  box-shadow: 0 1px 3px rgba(0, 78, 86, 0.06);
}

.cert-btn--secondary:hover,
.cert-btn--secondary:focus-visible {
  background: rgba(0, 141, 155, 0.07);
  color: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 78, 86, 0.10);
}

.cert-btn--secondary:active {
  transform: translateY(0) scale(0.97);
  background: rgba(0, 141, 155, 0.12);
}

.cert-btn:focus-visible {
  outline: 3px solid rgba(0, 141, 155, 0.45);
  outline-offset: 2px;
}

.cert-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.cert-btn__spinner {
  display: none;
}

.cert-btn.is-loading .cert-btn__spinner {
  display: inline-block;
}

.cert-btn.is-loading .cert-btn__label {
  opacity: 0.9;
}

.cert-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 26px;
}

.cert-actions .cert-btn {
  flex: 1 1 180px;
}

.cert-restart {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.92rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.cert-restart:hover {
  text-decoration: underline;
  color: var(--color-secondary);
}

/* ---------------------------------------------------------------------- */
/* Certificate preview                                                    */
/* ---------------------------------------------------------------------- */

.cert-preview {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 78, 86, 0.12);
  margin-bottom: 4px;
  background: #EEF3F6;
}

.cert-preview__image {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                  */
/* ---------------------------------------------------------------------- */

.cert-footer {
  text-align: center;
  font-size: 0.78rem;
  color: #8A93A0;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------- */
/* Loading overlay                                                        */
/* ---------------------------------------------------------------------- */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245, 248, 250, 0.94);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.loading-overlay.is-active {
  display: flex;
  opacity: 1;
}

.loading-overlay__content {
  text-align: center;
}

.loading-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 4px solid rgba(0, 141, 155, 0.18);
  border-top-color: var(--color-primary);
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay__title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  margin: 0 0 4px;
}

.loading-overlay__subtitle {
  font-size: 0.9rem;
  color: #8A93A0;
  margin: 0;
}

/* ---------------------------------------------------------------------- */
/* Fade-in animation                                                      */
/* ---------------------------------------------------------------------- */

.fade-in {
  animation: fadeIn 0.5s ease both;
}

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

@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .loading-spinner,
  .cert-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                             */
/* ---------------------------------------------------------------------- */

/* Tablet */
@media (max-width: 768px) {
  .cert-card {
    max-width: 560px;
  }

  .cert-card--wide {
    max-width: 560px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .page-shell {
    padding: 24px 14px;
  }

  .cert-card {
    padding: 32px 22px 28px;
  }

  .cert-card__logo img {
    height: 68px;
  }

  .cert-card__title {
    font-size: 1.4rem;
  }

  .cert-notice {
    font-size: 0.76rem;
    padding: 10px 12px;
  }

  .cert-actions {
    flex-direction: column;
  }

  .cert-actions .cert-btn {
    width: 100%;
  }

  .cert-btn {
    min-height: 50px;
  }
}
