/* =================================================================
   CARD PAGE STYLES — Grupo Nextil Digital Business Card
   Design: Dark glassmorphism, animated background, premium feel
================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- TOKENS ---- */
:root {
  --bg:           #040814;
  --card-bg:      rgba(255, 255, 255, 0.05);
  --card-border:  rgba(255, 255, 255, 0.08);
  --text:         #FFFFFF;
  --text-muted:   rgba(255, 255, 255, 0.65);
  --text-faint:   rgba(255, 255, 255, 0.40);
  
  --accent:       #34D399; /* Mint Green from Logo */
  --accent-2:     #0B3A82; /* Navy Blue from Logo */
  --theme:        linear-gradient(135deg, #0B3A82 0%, #34D399 100%);
  --theme-glow:   rgba(52, 211, 153, 0.35);

  --btn-bg:       rgba(255, 255, 255, 0.05);
  --btn-border:   rgba(255, 255, 255, 0.07);
  --btn-hover:    rgba(255, 255, 255, 0.08);

  --blur:         blur(24px);
  --radius-card:  24px;
  --radius-btn:   16px;
  --radius-icon:  12px;
  --shadow-card:  0 20px 60px rgba(0, 0, 0, 0.4);
  --transition:   0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
  --bg:           #F8FAFC;
  --card-bg:      #FFFFFF;
  --card-border:  rgba(0, 0, 0, 0.08);
  --text:         #020617; /* Darker text for light mode */
  --text-muted:   #334155; /* Higher contrast muted text */
  --text-faint:   #64748B;
  --shadow-card:  0 12px 40px rgba(0, 0, 0, 0.08);
  
  --btn-bg:       #F1F5F9;
  --btn-border:   rgba(0, 0, 0, 0.04);
  --btn-hover:    #E2E8F0;
}

/* Company themes */
[data-company="apolo"] {
  --accent:     #F59E0B;
  --accent-2:   #D97706;
  --theme:      linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --theme-glow: rgba(245, 158, 11, 0.3);
}
[data-company="corretora"] {
  --accent:     #10B981;
  --accent-2:   #059669;
  --theme:      linear-gradient(135deg, #10B981 0%, #059669 100%);
  --theme-glow: rgba(16, 185, 129, 0.3);
}
[data-company="nextil"] {
  --accent:     #34D399;
  --accent-2:   #0B3A82;
  --theme:      linear-gradient(135deg, #0B3A82 0%, #34D399 100%);
  --theme-glow: rgba(52, 211, 153, 0.3);
}

/* ---- RESET ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- LOADING SCREEN ---- */
#loading-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loading-screen.fade-out { opacity: 0; visibility: hidden; }

.loading-ring {
  width: 52px; height: 52px;
  border: 3px solid rgba(37, 99, 235, 0.15);
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- ERROR STATE ---- */
#error-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.error-box {
  text-align: center; max-width: 320px;
}
.error-emoji { font-size: 64px; display: block; margin-bottom: 20px; }
.error-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }

.error-box p  { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.6; }
.btn-error-back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 12px;
  background: rgba(37,99,235,0.12); border: 1px solid rgba(37,99,235,0.25);
  color: #60A5FA; text-decoration: none; font-weight: 600; font-size: 14px;
  transition: all 0.2s;
}
.btn-error-back:hover { background: rgba(37,99,235,0.2); }

/* ---- ANIMATED BG ---- */
.bg-layer {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  pointer-events: none;
  display: none; /* Hide AI orbs */
}
.bg-orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.12;
}
.orb-1 {
  width: 600px; height: 600px; background: #2563EB;
  top: -200px; left: -200px;
  animation: orb-float 9s ease-in-out infinite;
}
.orb-2 {
  width: 500px; height: 500px; background: #7C3AED;
  bottom: -150px; right: -150px;
  animation: orb-float 12s ease-in-out infinite reverse;
}
.orb-3 {
  width: 350px; height: 350px; background: #0EA5E9;
  top: 40%; left: 55%;
  animation: orb-float 7s ease-in-out infinite 3s;
}
@keyframes orb-float {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-40px) scale(1.08); }
}

/* ---- MAIN CARD LAYOUT ---- */
#card-container {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px 80px;
}
.card-wrapper {
  width: 100%; max-width: 440px;
  background: var(--card-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 36px 28px 32px;
  box-shadow: var(--shadow-card);
  animation: card-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(50px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ---- COMPANY BADGE ---- */
.company-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 100px;
  padding: 6px 14px 6px 10px;
  width: fit-content; margin: 0 auto 28px;
}
/* No Dark Mode usamos drop-shadow branco para que a logo (escura) fique visível */
.company-badge img { 
  height: 22px; width: auto; object-fit: contain; 
  filter: drop-shadow(1px 1px 0 rgba(255,255,255,0.9)) drop-shadow(-1px -1px 0 rgba(255,255,255,0.9)) drop-shadow(1px -1px 0 rgba(255,255,255,0.9)) drop-shadow(-1px 1px 0 rgba(255,255,255,0.9)); 
}
[data-theme="light"] .company-badge img {
  filter: none;
}
.company-badge span {
  font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,0.65);
  letter-spacing: 1px; text-transform: uppercase;
}

/* ---- PROFILE SECTION ---- */
.profile-section { text-align: center; margin-bottom: 28px; }

.avatar-wrap {
  position: relative; width: 108px; height: 108px;
  margin: 0 auto 18px;
}
.avatar-ring {
  position: absolute; inset: -4px; border-radius: 50%;
  background: var(--theme);
  animation: ring-pulse 3s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%,100% { box-shadow: 0 0 0 0 var(--theme-glow); }
  50%      { box-shadow: 0 0 0 8px transparent; }
}
.avatar-img, .avatar-initials {
  position: absolute; inset: 4px; border-radius: 50%;
  border: 3px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.avatar-img {
  object-fit: cover; width: calc(100% - 8px); height: calc(100% - 8px);
}
.avatar-initials {
  background: linear-gradient(135deg, rgba(37,99,235,0.25), rgba(124,58,237,0.25));
  font-size: 32px; font-weight: 800;
  background: var(--theme); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile-name  { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.profile-title { font-size: 14px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.profile-company {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--theme); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 10px;
}
.profile-bio {
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
  max-width: 340px; margin: 0 auto;
}

/* ---- DIVIDER ---- */
.divider {
  height: 1px; background: var(--card-border);
  margin: 20px 0;
}

/* ---- LINKS ---- */
.links-section { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.link-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-btn);
  color: var(--text);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  cursor: pointer; width: 100%;
  text-align: left;
  transition: all var(--transition);
  position: relative; overflow: hidden;
}
.link-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--btn-glow, rgba(255,255,255,0.04));
  opacity: 0;
  transition: opacity 0.2s;
}
.link-btn:hover {
  transform: translateY(-2px);
  background: var(--btn-hover);
  border-color: var(--theme-glow);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.link-btn:hover::after  { opacity: 1; }
.link-btn:active { transform: translateY(0) scale(0.99); }

.link-icon-wrap {
  width: 42px; height: 42px; border-radius: var(--radius-icon);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
  background: var(--btn-bg, rgba(255,255,255,0.06));
  transition: transform var(--transition);
  position: relative; z-index: 1;
}
.link-btn:hover .link-icon-wrap { transform: scale(1.12) rotate(-6deg); }

.link-label { flex: 1; position: relative; z-index: 1; }
.link-label strong { display: block; font-size: 14px; font-weight: 600; }
.link-label small  { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.link-arrow {
  color: var(--text-faint); font-size: 12px;
  position: relative; z-index: 1;
  transition: transform 0.2s, color 0.2s;
}
.link-btn:hover .link-arrow { transform: translateX(4px); color: var(--text-muted); }

/* Type-specific colors */
.type-whatsapp  { --btn-bg: rgba(37,211,102,0.15); --btn-glow: rgba(37,211,102,0.06); }
.type-instagram { --btn-bg: rgba(225,48,108,0.15); --btn-glow: rgba(225,48,108,0.06); }
.type-website   { --btn-bg: rgba(37,99,235,0.15);  --btn-glow: rgba(37,99,235,0.06);  }
.type-map       { --btn-bg: rgba(234,179,8,0.15);  --btn-glow: rgba(234,179,8,0.06);  }
.type-email     { --btn-bg: rgba(99,102,241,0.15); --btn-glow: rgba(99,102,241,0.06); }
.type-phone     { --btn-bg: rgba(20,184,166,0.15); --btn-glow: rgba(20,184,166,0.06); }
.type-linkedin  { --btn-bg: rgba(10,102,194,0.15); --btn-glow: rgba(10,102,194,0.06); }
.type-catalog   { --btn-bg: rgba(239,68,68,0.15);  --btn-glow: rgba(239,68,68,0.06);  }
.type-facebook  { --btn-bg: rgba(24,119,242,0.15); --btn-glow: rgba(24,119,242,0.06); }
.type-youtube   { --btn-bg: rgba(255,0,0,0.15);    --btn-glow: rgba(255,0,0,0.06);    }

/* ---- SAVE CONTACT BTN ---- */
.btn-save {
  width: 100%;
  padding: 16px;
  border: none; border-radius: var(--radius-btn);
  background: var(--theme);
  color: white; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; letter-spacing: 0.1px;
  box-shadow: 0 6px 24px var(--theme-glow);
  transition: all var(--transition);
  margin-bottom: 28px;
}
.btn-save:hover { transform: translateY(-3px); box-shadow: 0 12px 36px var(--theme-glow); }
.btn-save:active { transform: translateY(0); }

.btn-save .check-icon { display: none; }
.btn-save.saved .save-icon  { display: none; }
.btn-save.saved .check-icon { display: inline; }

/* ---- CARD FOOTER ---- */
.card-footer {
  text-align: center;
  padding-top: 4px;
}
.footer-link {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--text-faint);
  font-size: 11px; font-weight: 500;
  transition: color 0.2s;
}
.footer-link:hover { color: var(--text-muted); }
.footer-link img {
  height: 16px; width: auto;
  opacity: 0.35; filter: brightness(0) invert(1);
  transition: opacity 0.2s;
}
.footer-link:hover img { opacity: 0.55; }
.footer-link span { letter-spacing: 0.5px; text-transform: uppercase; font-size: 10px; }

/* ---- QR SHARE BUTTON ---- */
.btn-share {
  position: fixed; bottom: 24px; right: 24px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--theme);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
  box-shadow: 0 4px 20px var(--theme-glow);
  transition: all var(--transition);
  z-index: 50;
}
.btn-share:hover { transform: scale(1.1); }

/* ---- TOAST NOTIFICATION ---- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(30,40,60,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(16px);
  color: white; padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  z-index: 200;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast.out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-out {
  to { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* ---- UTILITY ---- */
.hidden { display: none !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
  #card-container { padding: 24px 12px 64px; }
  .card-wrapper   { border-radius: 22px; padding: 28px 20px 24px; }
  .profile-name   { font-size: 24px; }
}

/* Accordion Styles */
.accordion-wrap {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 16px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}
.accordion-wrap.active {
  border-color: var(--accent);
  background: var(--btn-hover);
}
.accordion-btn {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  transition: all 0.2s ease;
}
.accordion-btn:hover {
  background: rgba(0,0,0,0.02);
}
.accordion-btn .fa-chevron-down {
  transition: transform 0.3s ease;
  color: var(--text-faint);
}
.accordion-wrap.active .accordion-btn .fa-chevron-down {
  transform: rotate(180deg);
  color: var(--text);
}
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.accordion-inner {
  padding: 0 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.accordion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--btn-bg);
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.accordion-item:hover {
  color: var(--text);
  background: var(--btn-hover);
  transform: translateX(4px);
}

/* ---- THEME TOGGLE ---- */
.btn-theme {
  position: absolute; top: 24px; right: 24px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--btn-bg); border: 1px solid var(--btn-border);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: all var(--transition);
  z-index: 50;
}
.btn-theme:hover { background: var(--btn-hover); transform: scale(1.05); }