/* Portal do Docente — tema claro, legível, atual (2025) */

@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --pd-bg: #eef2f7;
  --pd-bg-accent: linear-gradient(145deg, #e8f0ff 0%, #f4f7fb 45%, #eef2f7 100%);
  --pd-surface: #ffffff;
  --pd-text: #0f172a;
  --pd-text-secondary: #475569;
  --pd-muted: #64748b;
  --pd-border: #e2e8f0;
  --pd-primary: #2563eb;
  --pd-primary-soft: rgba(37, 99, 235, 0.1);
  --pd-primary-dark: #1d4ed8;
  --pd-success: #059669;
  --pd-warning: #d97706;
  --pd-danger: #dc2626;
  --pd-radius: 14px;
  --pd-radius-sm: 10px;
  --pd-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 28px rgba(15, 23, 42, 0.08);
  --pd-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --pd-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}


*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.pd-app {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--pd-font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--pd-text);
  background: var(--pd-bg-accent);
  -webkit-font-smoothing: antialiased;
  /* Alinhar Bootstrap ao tema */
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: #2563eb;
  --bs-link-hover-color: #1d4ed8;
}

/* Tipografia */
.pd-app h1,
.pd-app .h1,
.pd-app h2,
.pd-app .h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--pd-text);
}

.pd-app .page-header h1 {
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  margin-bottom: 0.35rem;
}

.pd-app .subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--pd-text-secondary);
  max-width: 52ch;
}

/* Navegação */
.pd-navbar {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  background: var(--pd-surface) !important;
  border-color: var(--pd-border) !important;
}

.pd-navbar .navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--pd-text) !important;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pd-navbar .navbar-brand .pd-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--pd-primary) 0%, #3b82f6 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.pd-navbar .nav-link {
  color: var(--pd-text-secondary) !important;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.pd-navbar .nav-link:hover {
  background: var(--pd-primary-soft);
  color: var(--pd-primary) !important;
}

.pd-navbar .nav-link.active {
  background: var(--pd-primary-soft);
  color: var(--pd-primary) !important;
}

.pd-user-pill {
  font-size: 0.85rem;
  color: var(--pd-text-secondary);
  background: #f1f5f9;
  border: 1px solid var(--pd-border);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-navbar .btn-outline-secondary {
  border-color: var(--pd-border);
  color: var(--pd-text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
}

.pd-navbar .btn-outline-secondary:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: var(--pd-text);
}

/* Listagem de provas — acções em grelha 2×N */
.pd-exames-col-acoes {
  min-width: 200px;
  width: 22%;
}

.pd-exames-td-acoes {
  white-space: normal;
  vertical-align: middle;
}

.pd-exame-acoes-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.4rem;
  width: 100%;
  max-width: 300px;
  margin-left: auto;
  justify-items: stretch;
}

.pd-exame-acoes-grid > .btn,
.pd-exame-acoes-grid > .btn-group {
  min-width: 0;
}

.pd-exame-acoes-grid > .btn-group {
  width: 100%;
}

.pd-exame-acao-full {
  grid-column: 1 / -1;
}

/* Welcome page */
.pd-welcome-page {
  background: radial-gradient(1200px 520px at 50% -10%, #dbeafe 0%, #eef2f7 55%, #f8fafc 100%);
}

.pd-checkmate-welcome-logo {
  width: min(460px, 92vw);
  max-height: 140px;
  height: auto;
  display: inline-block;
  margin: 0 auto;
  border-radius: 18px;
  background: #000000;
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  object-fit: contain;
}


.pd-welcome-shell {
  max-width: 1180px;
}

.pd-welcome-info {
  background: #ffffffd9;
  border: 1px solid var(--pd-border);
  border-radius: 14px;
  box-shadow: var(--pd-shadow-sm);
  padding: 0.95rem 1rem;
}

.pd-portal-tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 380px;
  margin: 0 auto;
  background: #64748b;
  border-radius: 16px;
  box-shadow: none;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.2s ease;
}


.pd-portal-tile:hover {
  transform: translateY(-2px);
}

.pd-portal-image-wrap {
  min-height: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #ffffff;
  border: 0;
  border-radius: 14px;
  margin: 6px;
  overflow: hidden;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.22);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}


.pd-portal-tile:hover .pd-portal-image-wrap {
  transform: translateY(-4px);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.30);
}

.pd-portal-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  padding: 12px;
}

.pd-portal-fallback {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--pd-primary);
}

/* Portal do Estudante */
.pd-student-portal {
  margin-top: 0.5rem;
}

.pd-student-action {
  display: block;
  height: 100%;
  background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--pd-border);
  border-radius: 16px;
  padding: 1.2rem 1.25rem;
  box-shadow: var(--pd-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  color: var(--pd-text);
}

.pd-student-action:hover {
  transform: translateY(-4px);
  box-shadow: var(--pd-shadow);
  border-color: #bfdbfe;
  color: var(--pd-text);
}

.pd-student-action h2 {
  margin: 0.6rem 0 0.4rem;
  font-size: 1.1rem;
}

.pd-student-action p {
  margin: 0;
  color: var(--pd-text-secondary);
  font-size: 0.92rem;
}

.pd-student-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  color: #1d4ed8;
  background: #dbeafe;
}

.pd-student-action-icon-success {
  color: #047857;
  background: #d1fae5;
}

.pd-student-action-cta {
  display: inline-flex;
  align-items: center;
  margin-top: 0.9rem;
  color: var(--pd-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-checkmate-home {
  background-color: #000000;
  border-color: #000000;
  color: #ffffff;
}

.btn-checkmate-home:hover,
.btn-checkmate-home:focus {
  background-color: #111827;
  border-color: #111827;
  color: #ffffff;
}

@media (max-width: 767.98px) {
  .pd-portal-image-wrap {
    min-height: 220px;
    height: 220px;
  }
}

/* Conteúdo */
.pd-main {
  flex: 1 0 auto;
  max-width: 1140px;
}

/* Cartões — compatível com Bootstrap .card */
.pd-app .card {
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius);
  box-shadow: var(--pd-shadow-sm);
  overflow: hidden;
}

.pd-app .card-header {
  background: #fafbfc;
  border-bottom: 1px solid var(--pd-border);
  padding: 1.1rem 1.25rem;
}

.pd-app .card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--pd-text);
}

.pd-app .card-subtitle {
  font-size: 0.875rem;
  color: var(--pd-muted);
  margin-top: 0.25rem;
}

.pd-app .card-body {
  color: var(--pd-text-secondary);
}

/* Tabelas */
.pd-app .table {
  color: var(--pd-text);
  font-size: 0.925rem;
  margin-bottom: 0;
}

.pd-app .table thead th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pd-muted);
  border-bottom-width: 1px;
  background: #f8fafc;
}

.pd-app .table tbody tr:hover {
  background: #f8fafc;
}

.pd-app .table td,
.pd-app .table th {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

/* Badges / pills */
.pd-app .pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--pd-text-secondary);
  border: 1px solid var(--pd-border);
}

.pd-app .badge-orange {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

/* Formulários em grelha (views de exames/disciplinas) */
.pd-app .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
  padding: 1.25rem;
}

.pd-app .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pd-app .form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pd-text-secondary);
}

.pd-app .form-grid .form-control,
.pd-app .form-grid .form-select,
.pd-app .form-grid textarea {
  border-radius: var(--pd-radius-sm);
  border-color: var(--pd-border);
  font-size: 0.95rem;
}

.pd-app .form-grid .form-control:focus,
.pd-app .form-grid .form-select:focus,
.pd-app .form-grid textarea:focus {
  border-color: var(--pd-primary);
  box-shadow: 0 0 0 3px var(--pd-primary-soft);
}

/* Alertas legados → aspeto Bootstrap */
.pd-app .alert-error {
  border-radius: var(--pd-radius-sm);
  padding: 0.85rem 1rem;
  margin: 0 1.25rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.9rem;
}

/* Dashboard — cartões de estatística */
.pd-app .grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.pd-stat-card {
  border-radius: var(--pd-radius);
  border: 1px solid var(--pd-border);
  background: var(--pd-surface);
  box-shadow: var(--pd-shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
}

.pd-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--pd-shadow);
}

.pd-stat-card .pd-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.pd-stat-card--role .pd-stat-icon {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.pd-stat-card--disc .pd-stat-icon {
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  color: #fff;
}

.pd-stat-card--exam .pd-stat-icon {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #fff;
}

.pd-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--pd-text);
  line-height: 1.2;
}

.pd-stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pd-muted);
}

/* Login */
.pd-login-wrap {
  min-height: calc(100vh - 140px);
  align-items: stretch;
}

.pd-login-aside {
  background: linear-gradient(145deg, #1e3a8a 0%, #2563eb 48%, #0ea5e9 100%);
  color: #fff;
  padding: 3rem 2.5rem;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.pd-login-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.9;
}

.pd-login-aside-inner {
  position: relative;
  z-index: 1;
  max-width: 420px;
}

.pd-login-aside h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.pd-login-aside p {
  opacity: 0.92;
  font-size: 1rem;
  line-height: 1.65;
}

.pd-login-card {
  max-width: 420px;
  margin: 0 auto;
}

.pd-login-card .card {
  border-radius: var(--pd-radius);
  box-shadow: var(--pd-shadow);
}

/* Exame em execução — cronómetro na navbar sticky (Portal do Estudante) */
.pd-navbar.sticky-top {
  z-index: 1030;
}

.pd-app.pd-exam-active .pd-navbar.sticky-top {
  z-index: 1035;
}

.pd-navbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.pd-navbar-top {
  flex: 1 1 auto;
  min-width: 0;
}

.pd-app .exam-timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--pd-primary);
  background: var(--pd-primary-soft);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.pd-app .exam-timer--navbar {
  box-shadow: none;
}

.pd-app .exam-timer__label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

@media (max-width: 575.98px) {
  .pd-navbar-top {
    width: 100%;
  }

  .pd-app .exam-timer--navbar {
    margin-left: auto !important;
  }
}

.timer-blink {
  animation: timerBlink 1s linear infinite;
}

@keyframes timerBlink {
  0%, 100% {
    opacity: 1;
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.35);
    color: #b91c1c;
  }
  50% {
    opacity: 0.45;
    background: rgba(220, 38, 38, 0.18);
    border-color: rgba(220, 38, 38, 0.55);
    color: #7f1d1d;
  }
}

.pd-question {
  background: #fafbfc;
  border: 1px solid var(--pd-border) !important;
  border-radius: var(--pd-radius-sm);
  margin-top: 1rem;
}

.pd-question p {
  color: var(--pd-text);
  line-height: 1.65;
}

.pd-question .form-check {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.pd-question .form-check:hover {
  background: #f1f5f9;
}

.pd-question textarea.form-control {
  border-radius: var(--pd-radius-sm);
}

.pd-app .anti-fraud-warning {
  font-size: 0.85rem;
  color: var(--pd-muted);
  max-width: 420px;
}

/* Rodapé */
.pd-footer {
  background: var(--pd-surface);
  border-color: var(--pd-border) !important;
  color: var(--pd-muted);
  font-size: 0.85rem;
}

/* Acessibilidade: foco visível */
.pd-app a:focus-visible,
.pd-app button:focus-visible,
.pd-app .form-control:focus-visible {
  outline: 2px solid var(--pd-primary);
  outline-offset: 2px;
}

@media (max-width: 991.98px) {
  .pd-user-pill {
    max-width: 100%;
    margin: 0.5rem 0;
  }
}
