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

:root {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bg-overlay: rgba(8, 12, 22, 0.76);
  --card-surface: rgba(15, 23, 42, 0.78);
  --card-border: rgba(255, 255, 255, 0.16);
  --text-main: #FFFFFF;
  --text-muted: #94A3B8;
  --text-sub: #CBD5E1;
  --accent-cyan: #38BDF8;
  --accent-green: #22C55E;
  --accent-blue: #3B82F6;
  --accent-ig: linear-gradient(135deg, #833AB4, #FD1D1D, #F77737);
  --bg-image: url('https://i.postimg.cc/pry2V8Sw/abstract-design-background-smooth-flowing-lines.jpg');
  --body-bg: #050811;
  --modal-bg: #0F172A;
  --modal-title-color: #FFFFFF;
  --btn-vcard-bg: linear-gradient(135deg, #1E293B, #0F172A);
  --btn-vcard-text: #F8FAFC;
  --icon-btn-bg: rgba(255, 255, 255, 0.12);
  --icon-btn-border: rgba(255, 255, 255, 0.25);
  --icon-btn-color: #FFFFFF;
}

/* ==========================================================
   ADAPTACIÓN A MODO CLARO (CONSERVA TODO Y CAMBIA EL FONDO)
   ========================================================== */
@media (prefers-color-scheme: light) {
  :root {
    --bg-overlay: rgba(255, 255, 255, 0.58);
    --card-surface: rgba(255, 255, 255, 0.88);
    --card-border: rgba(203, 213, 225, 0.85);
    --text-main: #0F172A;
    --text-muted: #334155;
    --text-sub: #475569;
    --bg-image: url('https://i.postimg.cc/mrxJtMc4/fondo-claro.jpg');
    --body-bg: #F8FAFC;
    --modal-bg: #FFFFFF;
    --modal-title-color: #0F172A;
    --btn-vcard-bg: linear-gradient(135deg, #0F172A, #1E293B);
    --btn-vcard-text: #FFFFFF;
    --icon-btn-bg: rgba(255, 255, 255, 0.8);
    --icon-btn-border: rgba(15, 23, 42, 0.15);
    --icon-btn-color: #0F172A;
  }
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-family);
  color: var(--text-main);
  background-color: var(--body-bg);
  display: flex;
  justify-content: center;
  align-items: center;
}

body {
  background-image: 
    linear-gradient(to bottom, var(--bg-overlay), var(--bg-overlay)),
    var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.3s ease;
}

.app-card {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(12px, 2.5vh, 24px) clamp(16px, 4vw, 24px);
  position: relative;
  z-index: 1;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #15803D;
}

@media (prefers-color-scheme: dark) {
  .status-badge {
    color: #86EFAC;
  }
}

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

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

.top-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-circle-btn {
  background: var(--icon-btn-bg);
  border: 1px solid var(--icon-btn-border);
  color: var(--icon-btn-color);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.icon-circle-btn:active {
  transform: scale(0.92);
}

.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: clamp(4px, 1.2vh, 12px) 0;
  flex-shrink: 0;
}

.avatar-wrapper {
  position: relative;
  width: clamp(70px, 11vh, 92px);
  height: clamp(70px, 11vh, 92px);
  margin-bottom: clamp(6px, 1.2vh, 10px);
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #38BDF8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.45);
}

.online-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 15px;
  height: 15px;
  background-color: var(--accent-green);
  border: 2.5px solid #0B0F19;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
}

.profile-name {
  font-size: clamp(1.2rem, 2.5vh, 1.5rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.profile-bio {
  font-size: clamp(0.78rem, 1.5vh, 0.88rem);
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 600;
}

.social-quickbar {
  display: flex;
  gap: 12px;
  margin-top: clamp(8px, 1.5vh, 12px);
}

.quick-icon-btn {
  width: clamp(34px, 5vh, 40px);
  height: clamp(34px, 5vh, 40px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: transform 0.18s ease;
}

.quick-icon-btn:active {
  transform: scale(0.90);
}

.tel-bg { background: linear-gradient(135deg, #0284C7, #0369A1); }
.wa-bg  { background: linear-gradient(135deg, #10B981, #059669); }
.ig-bg  { background: var(--accent-ig); }
.web-bg { background: linear-gradient(135deg, #6366F1, #4F46E5); }

.links-container {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.4vh, 12px);
  flex: 1;
  justify-content: center;
  min-height: 0;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: clamp(8px, 1.4vh, 13px) 14px;
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text-main);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.link-item:active {
  transform: scale(0.98);
}

.link-icon-box {
  width: clamp(38px, 5.2vh, 44px);
  height: clamp(38px, 5.2vh, 44px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.phone-box { background: linear-gradient(135deg, #0EA5E9, #0284C7); color: #FFF; }
.wa-box    { background: linear-gradient(135deg, #22C55E, #16A34A); color: #FFF; }
.web-box   { background: linear-gradient(135deg, #6366F1, #4338CA); color: #FFF; }
.ig-box    { background: var(--accent-ig); color: #FFF; }

.link-texts {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.link-title {
  font-size: clamp(0.88rem, 1.8vh, 0.98rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.link-subtitle {
  font-size: clamp(0.72rem, 1.35vh, 0.8rem);
  color: var(--text-sub);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chevron-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.badge-call {
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: #0284C7;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  flex-shrink: 0;
  text-transform: uppercase;
}

@media (prefers-color-scheme: dark) {
  .badge-call {
    color: #7DD3FC;
  }
}

.tag-official {
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(129, 140, 248, 0.6);
  color: #4F46E5;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
  .tag-official {
    color: #C7D2FE;
  }
}

.vcard-section {
  margin: clamp(6px, 1.2vh, 12px) 0;
  flex-shrink: 0;
}

.btn-save-vcard {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: clamp(9px, 1.6vh, 13px) 16px;
  background: var(--btn-vcard-bg);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  color: var(--btn-vcard-text);
  font-family: inherit;
  font-size: clamp(0.82rem, 1.6vh, 0.9rem);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.btn-save-vcard:active {
  transform: scale(0.97);
}

.app-footer {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* ==========================================================
   MODAL QR CON DESENFOQUE REFORZADO (BLUR GLASS)
   ========================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--modal-bg);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  position: relative;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.4);
  animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  0% { transform: scale(0.88); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--modal-title-color);
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 6px 0 16px;
}

.qr-container {
  background: #FFFFFF;
  padding: 12px;
  border-radius: 16px;
  display: inline-block;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.qr-container img {
  width: 200px;
  height: 200px;
  display: block;
}

.modal-action-btn {
  width: 100%;
  padding: 11px;
  background: #38BDF8;
  border: none;
  border-radius: 12px;
  color: #030712;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: all 0.28s ease;
  z-index: 2000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}