:root {
  --bg-primary: #0b1329;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #f43f5e;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(52, 211, 153, 0.1) 0px, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

#app-container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), #6366f1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.network-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.network-badge.online {
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.network-badge.offline {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Glassmorphic Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Unbound View & Form */
.unbound-hero {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unbound-icon {
  align-self: center;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.1);
  border: 1px dashed var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.unbound-hero h2 {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.form-instruction {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.binding-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group label .required {
  color: var(--accent-rose);
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.form-group input[readonly] {
  background: rgba(30, 41, 59, 0.9);
  color: var(--accent-emerald);
  font-family: monospace;
  font-weight: bold;
  cursor: not-allowed;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.btn-scan-trigger {
  white-space: nowrap;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-blue);
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn-scan-trigger:active {
  background: rgba(56, 189, 248, 0.3);
}

.id-number-tag {
  font-size: 0.8rem;
  color: var(--accent-blue);
  font-family: monospace;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
}


.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--accent-blue), #3b82f6);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: rgba(148, 163, 184, 0.2);
  color: rgba(248, 250, 252, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none;
  cursor: not-allowed;
}


.btn-secondary {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 12px;
}

/* Scanner Container */
#scanner-container {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.scanner-modal-card {
  max-width: 440px;
  gap: 12px;
}

#reader {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--accent-blue);
  background: #000;
  min-height: 250px;
}


/* Bound View (Employee ID Badge) */
.badge-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.badge-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-blue));
}

.badge-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.profile-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.profile-info h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.barcode-wrapper {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#barcode-canvas {
  max-width: 100%;
  height: auto;
}

.id-text-display {
  color: #0f172a;
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 2px;
  margin-top: 8px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bg-card-border);
}

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

.meta-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.meta-value {
  font-size: 0.85rem;
  font-weight: 600;
}

.instructions-card {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.instructions-card strong {
  color: var(--text-primary);
}

/* Floating Update Banner */
.update-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 420px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.3);
  z-index: 9999;
  animation: slideUp 0.3s ease-out;
}

.update-banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-update-action {
  background: linear-gradient(135deg, var(--accent-emerald), #10b981);
  color: #0f172a;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(52, 211, 153, 0.3);
}

.btn-update-action:active {
  transform: scale(0.96);
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 100px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* Modal Overlay & Card Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.close-btn:hover {
  color: var(--text-primary);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.hidden {
  display: none !important;
}


