@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  --primary-hue: 220;
  --primary: hsl(var(--primary-hue), 85%, 20%);
  --primary-light: hsl(var(--primary-hue), 70%, 45%);
  --primary-dark: hsl(var(--primary-hue), 90%, 12%);
  --secondary: hsl(42, 75%, 55%); /* Dourado Acadêmico */
  --secondary-light: hsl(42, 85%, 65%);
  --secondary-dark: hsl(42, 80%, 40%);
  
  --bg-app: #f4f6f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --border-card: rgba(226, 232, 240, 0.8);
  --text-main: hsl(220, 30%, 15%);
  --text-muted: hsl(220, 15%, 45%);
  
  --success: hsl(142, 70%, 45%);
  --error: hsl(0, 85%, 60%);
  --warning: hsl(35, 90%, 55%);
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.08);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-app: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.85);
  --border-card: rgba(31, 41, 55, 0.7);
  --text-main: hsl(220, 20%, 92%);
  --text-muted: hsl(220, 10%, 70%);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* ==========================================
   RESET & CONFIGURAÇÕES GERAIS
   ========================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: inherit;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--secondary-dark);
}

/* ==========================================
   COMPONENTES PREMIUM REUSÁVEIS
   ========================================== */

/* Efeito de Vidro (Glassmorphism) */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-glass);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

/* Botões Modernos */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4);
  filter: brightness(1.1);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary-light), var(--secondary));
  color: var(--primary-dark);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(245, 158, 11, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-card);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--border-card);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Inputs Premium */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.input-field:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  outline: none;
}

/* Cabeçalho Institucional */
header.inst-header {
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-card);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  box-shadow: var(--shadow-sm);
}

.logo-text h1 {
  font-size: 1.25rem;
  line-height: 1.1;
  background: linear-gradient(to right, var(--text-main), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-link.active, .nav-link:hover {
  color: var(--primary-light);
}

/* Rodapé */
footer.inst-footer {
  padding: 30px;
  text-align: center;
  border-top: 1px solid var(--border-card);
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================
   PÁGINAS DE ACESSO PÚBLICO
   ========================================== */

.main-container {
  max-width: 1000px;
  width: 90%;
  margin: 60px auto;
  text-align: center;
  animation: fadeIn 0.6s ease-out;
}

/* 1. Portal de Login */
.login-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px;
  border-radius: var(--radius-lg);
  margin-top: 30px;
}

.login-card h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.login-card p.subtitle {
  color: var(--text-muted);
  margin-bottom: 25px;
  font-size: 0.9rem;
}

/* 2. Página Pública de Validação */
.validate-container {
  max-width: 800px;
  margin: 40px auto;
}

.validate-search-box {
  padding: 30px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
}

.search-input-wrapper {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

/* Seção do Scanner de QR Code */
.qr-scanner-section {
  margin-top: 20px;
  border-top: 1px dashed var(--border-card);
  padding-top: 20px;
}

#reader {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-card) !important;
  display: none;
}

/* Tela de Resultados de Validação */
.validation-result {
  padding: 40px;
  border-radius: var(--radius-lg);
  text-align: left;
  display: none;
  animation: slideUp 0.5s ease-out;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-card);
}

.badge-status {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: pulse 2s infinite;
}

.badge-valid {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-invalid {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.result-title h3 {
  font-size: 1.5rem;
  line-height: 1.2;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.result-item .val {
  font-size: 1.05rem;
  font-weight: 500;
}

/* Visualizador de PDF integrado */
.pdf-viewer-container {
  margin-top: 30px;
}

.pdf-viewer-container h4 {
  margin-bottom: 12px;
}

.pdf-frame {
  width: 100%;
  height: 480px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  background: #525659;
}

/* 3. Portal do Aluno */
.student-search-box {
  padding: 40px;
  border-radius: var(--radius-lg);
  max-width: 550px;
  margin: 0 auto 40px auto;
}

.certs-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
  text-align: left;
  display: none;
}

.cert-item-card {
  padding: 24px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  animation: slideUp 0.4s ease-out;
}

.cert-item-info h4 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.cert-item-meta {
  display: flex;
  gap: 15px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cert-item-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================
   ANIMAÇÕES
   ========================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Responsividade Básica */
@media(max-width: 768px) {
  header.inst-header {
    flex-direction: column;
    gap: 15px;
    padding: 20px;
  }
  
  .search-input-wrapper {
    flex-direction: column;
  }
  
  .cert-item-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
