/* ============================================
   Navigo Digital Business Card
   Mobile-first · Blue/White theme
   ============================================ */

:root {
  --navy-900: #042C53;
  --navy-800: #0C447C;
  --navy-700: #185FA5;
  --navy-100: #E6F1FB;
  --navy-50: #F4F9FE;

  --gray-900: #1A1A1A;
  --gray-700: #4A4A4A;
  --gray-500: #888;
  --gray-300: #D5D5D5;
  --gray-100: #F5F5F5;
  --white: #FFFFFF;

  --shadow-card: 0 4px 24px rgba(4, 44, 83, 0.08), 0 1px 3px rgba(4, 44, 83, 0.05);
  --shadow-modal: 0 24px 48px rgba(4, 44, 83, 0.25), 0 4px 12px rgba(4, 44, 83, 0.15);

  --radius-card: 20px;
  --radius-btn: 12px;
  --radius-sm: 8px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--navy-50) 0%, #FFFFFF 50%, var(--navy-50) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  line-height: 1.5;
}

/* prevent body scroll when modal open */
body.modal-open { overflow: hidden; }

/* ============================================
   Card
   ============================================ */
.card-wrapper { width: 100%; max-width: 380px; }

.card {
  background: var(--white);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.card-header {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 100%);
  padding: 24px 24px 56px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.card-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.brand {
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.8px;
  position: relative;
  z-index: 1;
}

.logo {
  width: 36px;
  height: 36px;
  background: var(--white);
  color: var(--navy-900);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  position: relative;
  z-index: 1;
}

/* ============================================
   Avatar
   ============================================ */
.avatar-container {
  padding: 0 24px;
  margin-top: -40px;
  position: relative;
  z-index: 2;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--navy-100);
  border: 4px solid var(--white);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-900);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.5px;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.avatar-fallback { background: var(--navy-100); }

/* ============================================
   Identity
   ============================================ */
.identity { padding: 14px 24px 20px; }

.name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--gray-900);
  margin-bottom: 4px;
  line-height: 1.2;
}

.title {
  font-size: 14px;
  color: var(--gray-700);
  font-weight: 500;
  line-height: 1.5;
}

.subtitle { color: var(--gray-500); font-weight: 400; }

/* ============================================
   Action grid
   ============================================ */
.actions {
  padding: 0 20px 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.action {
  background: var(--navy-100);
  color: var(--navy-900);
  border-radius: var(--radius-btn);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 11px;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}

.action svg { width: 22px; height: 22px; stroke-width: 2; }

.action:hover { background: #D5E5F5; transform: translateY(-1px); }
.action:active { transform: scale(0.96); }

.action-primary {
  grid-column: span 3;
  background: var(--navy-900);
  color: var(--white);
  flex-direction: row;
  padding: 14px;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.action-primary:hover { background: var(--navy-800); transform: translateY(-1px); }

/* ============================================
   QR trigger button
   ============================================ */
.qr-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 40px);
  margin: 0 20px 16px;
  padding: 12px;
  background: transparent;
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius-btn);
  color: var(--gray-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.qr-toggle svg { width: 18px; height: 18px; }

.qr-toggle:hover {
  border-color: var(--navy-700);
  color: var(--navy-900);
  background: var(--navy-50);
}

/* ============================================
   Footer
   ============================================ */
.card-footer {
  border-top: 1px solid var(--gray-100);
  padding: 14px 24px;
  text-align: center;
  font-size: 11px;
  color: var(--gray-500);
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* ============================================
   Modal (QR popup)
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 44, 83, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: overlayIn 0.2s ease;
}

.modal-overlay[hidden] { display: none; }

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

.modal {
  background: var(--white);
  border-radius: 24px;
  width: 100%;
  max-width: 340px;
  padding: 32px 24px 24px;
  position: relative;
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  border: none;
  color: var(--gray-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close svg { width: 16px; height: 16px; }

.modal-close:hover {
  background: var(--navy-100);
  color: var(--navy-900);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 20px;
}

.qr-box {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-btn);
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.qr-box canvas,
.qr-box img,
.qr-box > div {
  max-width: 100%;
  height: auto;
  display: block;
}

.qr-box > div { width: 240px; height: 240px; }

.modal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--navy-50);
  border-radius: var(--radius-btn);
}

.modal-logo {
  width: 36px;
  height: 36px;
  background: var(--navy-900);
  color: var(--white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.modal-brand-text { text-align: left; }

.modal-brand-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
}

.modal-brand-org {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 1px;
}

/* ============================================
   Small screens
   ============================================ */
@media (max-width: 360px) {
  .actions { gap: 6px; }
  .action { padding: 12px 6px; font-size: 10px; }
  .action svg { width: 20px; height: 20px; }
  .qr-box > div { width: 200px; height: 200px; }
}

/* ============================================
   Dark mode background only (card stays light)
   ============================================ */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #0a1828 0%, #050d1a 50%, #0a1828 100%);
  }
}
