/* ============================================================
   LabPortal — CSS Principal
   Design: Medical/Laboratory — Refined & Professional
   ============================================================ */

/* ---- VARIÁVEIS ---- */
:root {
  --lab-navy:       #0a1628;
  --lab-blue:       #1a56db;
  --lab-blue-lt:    #3b82f6;
  --lab-teal:       #0d9488;
  --lab-teal-lt:    #14b8a6;
  --lab-indigo:     #4f46e5;
  --lab-green:      #059669;
  --lab-accent:     #38bdf8;

  --lab-bg:         #f0f4f8;
  --lab-surface:    #ffffff;
  --lab-border:     #e2e8f0;

  --lab-text:       #0f172a;
  --lab-text-muted: #64748b;

  --navbar-h:       64px;
  --radius-card:    14px;
  --shadow-card:    0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-hover:   0 4px 8px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.1);
  --transition:     all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--lab-text);
  background: var(--lab-bg);
  font-size: 0.925rem;
  -webkit-font-smoothing: antialiased;
}

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

/* ============================================================
   NAVBAR
   ============================================================ */
.lab-navbar {
  background: var(--lab-navy) !important;
  height: var(--navbar-h);
  border-bottom: 1px solid rgba(255,255,255,.07);
  backdrop-filter: blur(12px);
  z-index: 1040;
}

.lab-logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--lab-blue), var(--lab-teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
  flex-shrink: 0;
}
.lab-logo-icon--sm { width: 30px; height: 30px; font-size: .9rem; border-radius: 8px; }

.lab-brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  color: #fff;
  letter-spacing: -.02em;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-lab-primary {
  background: linear-gradient(135deg, var(--lab-blue), var(--lab-indigo));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(26, 86, 219, 0.3);
}
.btn-lab-primary:hover, .btn-lab-primary:focus {
  background: linear-gradient(135deg, #1745c0, #3f35b5);
  color: #fff;
  box-shadow: 0 4px 16px rgba(26, 86, 219, 0.45);
  transform: translateY(-1px);
}
.btn-lab-primary:active { transform: translateY(0); }

.btn-hero-primary {
  background: linear-gradient(135deg, var(--lab-blue), var(--lab-teal));
  color: #fff;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  padding: .75rem 2rem;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(26, 86, 219, 0.4);
  font-size: 1rem;
}
.btn-hero-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 8px 32px rgba(26, 86, 219, 0.5); }

.btn-hero-secondary {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 50px;
  font-weight: 600;
  padding: .75rem 2rem;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  font-size: 1rem;
}
.btn-hero-secondary:hover { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.4); }

/* ============================================================
   INPUT GROUPS
   ============================================================ */
.input-group-lab .input-group-text {
  background: var(--lab-surface);
  border-color: var(--lab-border);
  color: var(--lab-text-muted);
}
.input-group-lab .form-control,
.input-group-lab .form-select {
  border-color: var(--lab-border);
  font-size: .9rem;
}
.input-group-lab .form-control:focus {
  border-color: var(--lab-blue-lt);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

/* ============================================================
   LANDING PAGE — HERO
   ============================================================ */
.landing-page { background: var(--lab-navy); overflow-x: hidden; }

.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--navbar-h) + 3rem) 1rem 4rem;
  position: relative;
  background: radial-gradient(ellipse at 60% 0%, rgba(26,86,219,.35) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(13,148,136,.2) 0%, transparent 50%),
              var(--lab-navy);
}

.hero-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(26,86,219,.2);
  border: 1px solid rgba(26,86,219,.4);
  color: var(--lab-accent);
  padding: .4rem 1rem;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 500;
}

.hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(3rem, 7vw, 5.5rem);
  color: #fff;
  line-height: 1.05;
  letter-spacing: -.03em;
}
.hero-title em {
  color: var(--lab-accent);
  font-style: italic;
}

.hero-subtitle {
  font-size: clamp(.95rem, 2vw, 1.15rem);
  color: rgba(255,255,255,.65);
  max-width: 550px;
  margin: 0 auto;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 3rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-number {
  display: block;
  font-family: 'DM Serif Display', serif;
  font-size: 2.2rem;
  color: var(--lab-accent);
  line-height: 1;
}
.hero-stat-label {
  font-size: .75rem;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: .25rem;
  display: block;
}

/* ============================================================
   SECTIONS — LANDING
   ============================================================ */
body.landing-page section:not(.hero-section) {
  background: var(--lab-surface);
  color: var(--lab-text);
}
body.landing-page .bg-lab-light { background: #f8fafd !important; }

.section-tag {
  display: inline-block;
  background: rgba(26,86,219,.08);
  color: var(--lab-blue);
  padding: .25rem .75rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -.02em;
}

/* Feature cards */
.feature-card {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--radius-card);
  padding: 2rem;
  transition: var(--transition);
  height: 100%;
}
.feature-card:hover {
  border-color: var(--lab-blue-lt);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.feature-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto;
}
.feature-icon--blue   { background: rgba(59,130,246,.12);  color: var(--lab-blue); }
.feature-icon--teal   { background: rgba(13,148,136,.12);  color: var(--lab-teal); }
.feature-icon--indigo { background: rgba(79,70,229,.12);   color: var(--lab-indigo); }

/* Security section */
.security-list { list-style: none; padding: 0; margin: 0; }
.security-list li { padding: .5rem 0; font-size: .95rem; }
.security-visual {
  width: 200px; height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(26,86,219,.1), rgba(13,148,136,.1));
  display: flex; align-items: center; justify-content: center;
  font-size: 6rem;
  color: var(--lab-blue);
  margin: 0 auto;
  border: 2px solid rgba(26,86,219,.15);
}

/* CTA section */
.cta-section {
  background: linear-gradient(135deg, var(--lab-blue), var(--lab-indigo)) !important;
  color: #fff;
}

/* Footer */
.lab-footer {
  background: var(--lab-navy);
  color: rgba(255,255,255,.5);
}

/* ============================================================
   AUTH PAGE — LOGIN
   ============================================================ */
.auth-page {
  background: var(--lab-bg);
  min-height: 100vh;
}

.auth-split {
  display: flex;
  min-height: 100vh;
}

.auth-side-visual {
  width: 45%;
  flex-shrink: 0;
  background: radial-gradient(ellipse at 40% 30%, rgba(26,86,219,.5) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(13,148,136,.3) 0%, transparent 50%),
              var(--lab-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
}
.auth-side-visual::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
.auth-visual-content { position: relative; z-index: 1; max-width: 400px; }
.text-lab-accent { color: var(--lab-accent); }

.auth-features { display: flex; flex-direction: column; gap: .75rem; }
.auth-feature-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255,255,255,.7);
  font-size: .9rem;
}
.auth-feature-item i {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  color: var(--lab-accent);
  font-size: .9rem;
  flex-shrink: 0;
}

.auth-side-form {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}
.auth-form-wrapper {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}
.auth-form-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  letter-spacing: -.025em;
  margin-bottom: .25rem;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-page {
  background: var(--lab-bg);
  min-height: 100vh;
}

.dashboard-main {
  padding-top: calc(var(--navbar-h) + 1.5rem);
  padding-bottom: 5rem;
  min-height: 100vh;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.5rem 0 .5rem;
}
.dashboard-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.9rem;
  margin: 0;
  letter-spacing: -.02em;
}
.dashboard-subtitle {
  color: var(--lab-text-muted);
  margin: .25rem 0 0;
  font-size: .9rem;
}

/* Stats */
.stat-card {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--radius-card);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}
.stat-card:hover { box-shadow: var(--shadow-hover); border-color: var(--lab-blue-lt); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon--blue   { background: rgba(59,130,246,.12);  color: var(--lab-blue); }
.stat-icon--teal   { background: rgba(13,148,136,.12);  color: var(--lab-teal); }
.stat-icon--indigo { background: rgba(79,70,229,.12);   color: var(--lab-indigo); }
.stat-icon--green  { background: rgba(5,150,105,.12);   color: var(--lab-green); }

.stat-number { font-weight: 700; font-size: 1.4rem; line-height: 1; }
.stat-label  { font-size: .75rem; color: var(--lab-text-muted); margin-top: .15rem; }

/* Lab Card */
.lab-card {
  border: 1px solid var(--lab-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: var(--lab-surface);
}
.lab-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--lab-border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: .95rem;
}
.lab-card .card-body { padding: 1.25rem; }

/* Exam Cards */
.exam-card {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.exam-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--lab-blue-lt);
  transform: translateY(-3px);
}

.exam-card-header {
  padding: 1rem 1.1rem .75rem;
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  flex: 1;
}

.exam-badge {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.exam-badge--red    { background: rgba(239,68,68,.12);   color: #dc2626; }
.exam-badge--yellow { background: rgba(234,179,8,.12);   color: #ca8a04; }
.exam-badge--pink   { background: rgba(236,72,153,.12);  color: #db2777; }
.exam-badge--orange { background: rgba(249,115,22,.12);  color: #ea580c; }
.exam-badge--blue   { background: rgba(59,130,246,.12);  color: var(--lab-blue); }
.exam-badge--teal   { background: rgba(13,148,136,.12);  color: var(--lab-teal); }
.exam-badge--purple { background: rgba(168,85,247,.12);  color: #9333ea; }
.exam-badge--indigo { background: rgba(79,70,229,.12);   color: var(--lab-indigo); }
.exam-badge--green  { background: rgba(5,150,105,.12);   color: var(--lab-green); }

.exam-card-meta { flex: 1; min-width: 0; }
.exam-tipo {
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .02em;
}
.exam-data {
  font-size: .78rem;
  color: var(--lab-text-muted);
  margin-top: .2rem;
}
.exam-num {
  font-size: .7rem;
  color: var(--lab-text-muted);
  background: var(--lab-bg);
  border-radius: 6px;
  padding: .15rem .45rem;
  align-self: flex-start;
  white-space: nowrap;
}

.exam-card-footer {
  border-top: 1px solid var(--lab-border);
  padding: .6rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  background: rgba(0,0,0,.01);
}
.exam-import-date { min-width: 0; overflow: hidden; }

/* Empty State */
.empty-state-icon {
  width: 80px; height: 80px;
  border-radius: 20px;
  background: rgba(26,86,219,.07);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  color: var(--lab-blue-lt);
  margin: 0 auto;
}

/* User Avatar */
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lab-blue), var(--lab-teal));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Dashboard Footer */
.dashboard-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--lab-surface);
  border-top: 1px solid var(--lab-border);
  padding: .6rem 0;
  z-index: 100;
}

/* ============================================================
   ADMIN TABLE
   ============================================================ */
.admin-table thead th {
  background: var(--lab-bg);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--lab-text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--lab-border);
}
.admin-table tbody td { font-size: .875rem; vertical-align: middle; }

/* ============================================================
   QR CODE PAGE
   ============================================================ */
.qrcode-page { background: var(--lab-bg); }

.qr-card {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.qr-card-header {
  background: var(--lab-navy);
  color: rgba(255,255,255,.85);
  padding: .85rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
}
.qr-card-body { padding: 1.5rem; }

.qr-image-wrapper {
  display: inline-flex;
  padding: 1rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--lab-border);
  box-shadow: var(--shadow-card);
}
.qr-img {
  max-width: 280px;
  width: 100%;
  display: block;
  border-radius: 4px;
}
.qr-url {
  font-size: .8rem;
  color: var(--lab-text-muted);
  word-break: break-all;
}
.qr-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .lab-navbar, .dashboard-footer, .qr-actions, nav { display: none !important; }
  body { background: #fff !important; }
  .qr-card { border: none !important; box-shadow: none !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .auth-split { flex-direction: column; }
  .auth-side-visual { width: 100%; min-height: 40vh; }

  .dashboard-main { padding-top: calc(var(--navbar-h) + 1rem); padding-bottom: 4rem; }
  .dashboard-header { flex-direction: column; }

  .hero-stats { gap: 2rem; }
  .lab-brand-name { font-size: 1.1rem; }
}

@media (max-width: 576px) {
  .hero-title { font-size: 2.5rem; }
  .stat-number { font-size: 1.1rem; }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.exam-item {
  animation: fadeInUp .35s ease both;
}
.exam-item:nth-child(1)  { animation-delay: .05s; }
.exam-item:nth-child(2)  { animation-delay: .1s;  }
.exam-item:nth-child(3)  { animation-delay: .15s; }
.exam-item:nth-child(4)  { animation-delay: .2s;  }
.exam-item:nth-child(5)  { animation-delay: .25s; }
.exam-item:nth-child(6)  { animation-delay: .3s;  }
.exam-item:nth-child(7)  { animation-delay: .05s; }
.exam-item:nth-child(8)  { animation-delay: .1s;  }
.exam-item:nth-child(9)  { animation-delay: .15s; }

/* Hover lift global para .card */
.card { transition: var(--transition); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--lab-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--lab-text-muted); }
