/* ── Portal Styles ── */
/* Premium light design with smooth animations */

:root {
  --primary: #005aab;
  --primary-light: #3b82f6;
  --primary-dark: #003d7a;
  --primary-glow: rgba(0, 90, 171, 0.2);
  --bg-gradient-start: #f8fafc;
  --bg-gradient-mid: #f1f5f9;
  --bg-gradient-end: #e2e8f0;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --surface-border: #cbd5e1;
  --text: #334155;
  --text-muted: #64748b;
  --text-bright: #0f172a;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-x: hidden;
}

/* Animated background orbs */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.6;
  z-index: -1;
  animation: float 20s ease-in-out infinite;
}
body::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0, 90, 171, 0.15), transparent);
  top: -100px; right: -100px;
}
body::after {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1), transparent);
  bottom: -50px; left: -50px;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.portal-container {
  max-width: 580px;
  width: 100%;
}

/* ── Header ── */
.portal-header {
  text-align: center;
  margin-bottom: 32px;
  animation: fadeInDown 0.6s ease-out;
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px; height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px var(--primary-glow);
}

.portal-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.org-name {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Step Card ── */
.step-card {
  background: var(--surface);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  position: relative;
  transition: var(--transition);
  animation: fadeInUp 0.6s ease-out;
}

.step-card:nth-child(3) { animation-delay: 0.1s; }

.step-card.disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.3);
}

.step-card.active {
  opacity: 1;
  pointer-events: auto;
  filter: none;
  border-color: var(--primary);
  box-shadow: 0 8px 30px var(--primary-glow);
}

.step-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.step-card h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.step-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ── Search ── */
.search-container {
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: #ffffff;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  box-shadow: 0 2px 5px rgba(0,0,0,0.02) inset;
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #ffffff;
}

.search-spinner {
  position: absolute;
  right: 14px;
}

.spinner-ring {
  width: 20px; height: 20px;
  border: 2px solid var(--surface-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Search Results Dropdown ── */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #ffffff;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1);
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover {
  background: rgba(0, 90, 171, 0.05);
}

.result-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.result-info { flex: 1; min-width: 0; }

.result-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.search-no-results {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Employee Card ── */
.employee-card {
  background: rgba(0, 90, 171, 0.03);
  border: 1px solid rgba(0, 90, 171, 0.15);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 16px;
  position: relative;
  animation: fadeInUp 0.4s ease-out;
}

.employee-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.employee-avatar {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.employee-main-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-bright);
}

.employee-code {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
}

.employee-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text);
}

.detail-row svg { color: var(--text-muted); flex-shrink: 0; }

.btn-change {
  position: absolute;
  top: 12px; right: 12px;
  background: #ffffff;
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.btn-change:hover {
  background: var(--surface-hover);
  color: var(--text-bright);
  border-color: #94a3b8;
}

/* ── Instructions ── */
.instructions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0 24px;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--text);
}

.instruction-num {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(0, 90, 171, 0.1);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Download Button ── */
.btn-download {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-download:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-download:not(:disabled):active {
  transform: translateY(0);
}

.btn-download:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn-download.loading {
  pointer-events: none;
}

.btn-download.loading span { visibility: hidden; }
.btn-download.loading svg { visibility: hidden; }

.btn-download.loading::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Status Message ── */
.status-message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeInUp 0.3s ease-out;
}

.status-message.success {
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: var(--success);
}

.status-message.error {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--error);
}

/* ── Footer ── */
.portal-footer {
  text-align: center;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ── */
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  body { padding: 20px 12px; }
  .portal-header h1 { font-size: 1.4rem; }
  .step-card { padding: 20px; }
}

/* ── Turnstile Overlay ── */
.turnstile-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  animation: fadeIn 0.4s ease-out;
  transition: opacity 0.4s ease-out;
}

.turnstile-box {
  text-align: center;
  padding: 20px;
}

.turnstile-box h3 {
  font-size: 1.2rem;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.turnstile-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

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