/* ==========================================================================
   Business Card PWA - 90° Rotated Physical Paper Card on Portrait Display
   ========================================================================== */

:root {
  --bg-stage: #090c12;
  --bg-stage-radial: radial-gradient(ellipse at 50% 50%, #172033 0%, #090c12 100%);
  
  /* Physical Paper Card (Heavy Matte Unbleached Cotton) */
  --paper-top: #fefefe;
  --paper-bottom: #f4f3ed;
  --text-dark: #0f172a;
  --text-muted: #334155;
  --text-sub: #64748b;
  --accent-blue: #0284c7;
  
  --accent-cyan: #38bdf8;
  --accent-green: #22c55e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-stage);
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

/* App Container (Strictly portrait screen) */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: -webkit-fill-available;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: var(--bg-stage-radial);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

/* ==========================================================================
   Top Header Bar
   ========================================================================== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--safe-top) + 8px) 16px 6px 16px;
  z-index: 20;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #4ade80;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.status-badge.inactive {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2.2s infinite ease-in-out;
}

.status-badge.inactive .status-dot {
  background-color: #64748b;
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 25;
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: scale(0.96);
}

.install-btn {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ==========================================================================
   Presentation Stage: Centered Landscape Card rotated 90°
   ========================================================================== */
.presentation-stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 12px calc(var(--safe-bottom) + 54px) 12px;
  position: relative;
  overflow: hidden;
}

/* Card Geometry Wrapper (Screen Footprint in Portrait) */
.card-display-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(410px, calc(100vw - 16px));
  height: min(650px, calc((100vw - 16px) * 1.574), calc(100vh - var(--safe-top) - var(--safe-bottom) - 120px));
  position: relative;
}

/* The Paper Card (Rotated -90deg so text flows from bottom to top) */
.paper-card-landscape {
  position: absolute;
  width: min(650px, calc((100vw - 16px) * 1.574), calc(100vh - var(--safe-top) - var(--safe-bottom) - 120px));
  height: min(410px, calc(100vw - 16px));
  
  /* Rotation: -90deg turns left side to the bottom, right side to the top */
  transform: rotate(-90deg);
  transform-origin: center center;
  
  background: linear-gradient(172deg, var(--paper-top) 0%, var(--paper-bottom) 100%);
  color: var(--text-dark);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  
  /* Authentic multi-layered cast shadow */
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.08),
    0 12px 24px rgba(0, 0, 0, 0.28),
    0 32px 64px -8px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.95),
    inset 0 1px 2px rgba(255, 255, 255, 0.8),
    inset 0 -1px 2px rgba(0, 0, 0, 0.04);
}

/* Tactile Paper Texture */
.paper-grain {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
  background-size: 3px 3px;
  pointer-events: none;
  opacity: 0.8;
}

/* Two-column layout in Querformat */
.card-grid {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  padding: 20px 24px 12px 24px;
  gap: 20px;
  align-items: center;
}

/* Left Column: Portrait & Identity */
.card-col-left {
  flex: 0 0 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

/* Photo 30% larger: 78px * 1.30 = ~102px */
.photo-bezel {
  width: 102px;
  height: 102px;
  border-radius: 50%;
  padding: 3.5px;
  background: #ffffff;
  box-shadow: 
    0 3px 10px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.identity-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Name +25%: 1.35rem * 1.25 = 1.68rem */
.person-name {
  font-size: 1.68rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-dark);
  line-height: 1.15;
  margin-bottom: 4px;
}

.job-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Title +25%: 0.78rem * 1.25 = 0.98rem */
.job-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.accent-bar {
  margin-top: 6px;
  height: 3px;
  width: 60px;
  background: var(--accent-blue);
  border-radius: 1.5px;
}

/* Vertical Divider */
.card-divider-v {
  width: 1px;
  align-self: stretch;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.12) 15%, rgba(0, 0, 0, 0.12) 85%, transparent 100%);
  flex-shrink: 0;
}

/* Right Column: Contact Coordinates */
.card-col-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding-left: 4px;
}

.coord-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coord-item.coord-messengers {
  align-items: flex-start;
}

.coord-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(2, 132, 199, 0.08);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.coord-icon svg {
  width: 19px;
  height: 19px;
}

.coord-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Label +25%: 0.65rem * 1.25 = 0.82rem */
.coord-label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-sub);
  line-height: 1;
  margin-bottom: 2px;
}

/* Value +25%: 0.94rem * 1.25 = 1.18rem */
.coord-value {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coord-value.font-mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Messengers Stack (Separate Lines) */
.messengers-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

/* Messenger Row +25%: 0.82rem * 1.25 = 1.02rem */
.messenger-row {
  display: inline-block;
  font-size: 1.02rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
}

/* Card Bottom Tagline +25%: 0.68rem * 1.25 = 0.85rem */
.card-bottom-bar {
  position: relative;
  z-index: 2;
  border-top: 1px dashed rgba(0, 0, 0, 0.09);
  padding: 8px 18px 9px 18px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #64748b;
  text-transform: uppercase;
}

/* ==========================================================================
   Bottom Swipe-Up Teaser Bar
   ========================================================================== */
.swipe-teaser {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(13, 17, 26, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(56, 189, 248, 0.25);
  padding: 8px 16px calc(var(--safe-bottom) + 10px) 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.7);
}

.drag-handle-pill {
  width: 42px;
  height: 4px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  margin-bottom: 5px;
}

.swipe-teaser-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 0.02em;
}

.swipe-arrow {
  font-size: 0.75rem;
  animation: bounceUp 1.8s infinite;
}

@keyframes bounceUp {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  60% { transform: translateY(-1.5px); }
}

/* ==========================================================================
   Upslide QR-Code Bottom Sheet (30% Higher, Maximized QR Code)
   ========================================================================== */
.qr-sheet {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s ease;
}

.qr-sheet.open {
  pointer-events: auto;
  visibility: visible;
}

.qr-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.qr-sheet.open .qr-backdrop {
  opacity: 1;
}

.qr-sheet-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #0f172a;
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border-top: 1px solid rgba(56, 189, 248, 0.3);
  padding: 12px 18px calc(var(--safe-bottom) + 20px) 18px;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.85);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 95vh;
  overflow-y: auto;
}

.qr-sheet.open .qr-sheet-container {
  transform: translateY(0);
}

.sheet-handle-area {
  width: 100%;
  height: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: grab;
}

.sheet-pill {
  width: 46px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 4px;
}

.sheet-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #cbd5e1;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.close-btn:hover, .close-btn:active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* Maximized QR Code Card Wrapper (+30% Height) */
.qr-card-wrapper {
  background: #ffffff;
  border-radius: 20px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  margin-bottom: 16px;
  /* 30% larger than original 240px: min(320px, 86vw) */
  min-height: min(325px, 84vw);
}

.qr-code-box {
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(320px, 84vw);
  height: min(320px, 84vw);
  background: #ffffff;
}

.qr-code-img {
  width: 100%;
  height: 100%;
  max-width: 320px;
  max-height: 320px;
  object-fit: contain;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Sheet Controls: Clean, focused Quick Share */
.sheet-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Primary Quick Share Button */
.primary-share-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 14px 18px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.primary-share-btn:hover {
  opacity: 0.95;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.55);
}

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

.share-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.share-btn-text {
  display: flex;
  flex-direction: column;
}

.share-btn-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.share-btn-desc {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.85);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 65px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-cyan);
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 200;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}

.hidden {
  display: none !important;
}
