/* ==========================================================================
   Miras Digital Business Card — Main Card CSS (Minimal Luxury)
   Mobile First | Zero external CSS frameworks | RTL First
   ========================================================================== */

/* ─── CSS Variables / Design Tokens ─────────────────────────────────────── */
:root {
  /* Colors from mirasalco.com identity */
  --color-gold: #B8956E;
  --color-gold-dark: #8B7355;
  --color-gold-light: #D4C5B5;
  --color-gold-bg: rgba(184, 149, 110, 0.08);

  --color-charcoal: #2C2C2C;
  --color-muted: #6B6B6B;
  --color-bg: #F8F5F0;
  --color-card-bg: #FFFFFF;

  --color-border: #E8E0D4;
  --color-border-light: #F0EADF;

  --color-text: #2C2C2C;
  --color-text-secondary: #5A5A5A;

  /* WhatsApp Brand Accent */
  --color-whatsapp: #25D366;
  --color-whatsapp-bg: rgba(37, 211, 102, 0.08);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 24px rgba(44, 44, 44, 0.06);
  --shadow-lg: 0 16px 40px rgba(44, 44, 44, 0.09);
  --shadow-gold: 0 8px 25px rgba(184, 149, 110, 0.25);

  /* Typography */
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --color-bg: #1A1A1A;
  --color-card-bg: #242424;
  --color-border: #333333;
  --color-border-light: #2D2D2D;
  --color-text: #EAEAEA;
  --color-text-secondary: #B0B0B0;
  --color-muted: #999999;
  --color-gold-bg: rgba(184, 149, 110, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* ─── Base Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.25rem 1rem 3rem 1rem;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

/* ─── Top Utility Bar ─────────────────────────────────────────────────────── */
.top-bar {
  width: 100%;
  max-width: 440px;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.icon-btn {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.icon-btn:hover {
  transform: scale(1.05);
  border-color: var(--color-gold);
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--color-gold-dark);
  outline-offset: 3px;
}

.sun-icon { display: none; width: 20px; height: 20px; }
.moon-icon { display: block; width: 20px; height: 20px; }

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* ─── Card Container ─────────────────────────────────────────────────────── */
.card-container {
  width: 100%;
  max-width: 440px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border-light);
  border-radius: 24px;
  padding: 2.25rem 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: background var(--transition-smooth), border-color var(--transition-smooth);
}

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

/* ─── Header & Logo ──────────────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.logo-link {
  display: inline-block;
  transition: transform var(--transition-fast);
}

.logo-link:hover {
  transform: scale(1.02);
}

.logo-img {
  max-width: 140px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.04));
}

[data-theme="dark"] .logo-img {
  filter: brightness(1.2) drop-shadow(0 2px 8px rgba(255,255,255,0.1));
}

.header-divider {
  width: 36px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  margin: 1.25rem auto 0 auto;
  border-radius: 2px;
}

/* ─── Profile Section ────────────────────────────────────────────────────── */
.profile-section {
  text-align: center;
  margin-bottom: 2rem;
}

.avatar-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 1.25rem auto;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--color-card-bg);
  outline: 2px solid var(--color-gold);
  box-shadow: var(--shadow-md);
  background-color: var(--color-bg);
}

.avatar-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-gold) 0%, transparent 70%);
  opacity: 0.15;
  z-index: -1;
}

.person-name {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
}

.person-name-en {
  font-size: 0.85rem;
  color: var(--color-muted);
  font-weight: 400;
  direction: ltr;
  display: block;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.job-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-gold-bg);
  color: #765F47;
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(184, 149, 110, 0.2);
}

[data-theme="dark"] .job-badge {
  color: var(--color-gold);
}

.job-divider {
  opacity: 0.5;
  font-size: 0.7rem;
}

.job-title-en {
  font-size: 0.8rem;
  font-weight: 500;
  direction: ltr;
}

/* ─── Action Grid (Call, WhatsApp, Email, Web) ───────────────────────────── */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--color-text);
  padding: 0.85rem 0.25rem;
  border-radius: 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-fast);
}

.action-btn:hover {
  transform: translateY(-3px);
  border-color: var(--color-gold);
  background: var(--color-card-bg);
  box-shadow: var(--shadow-sm);
}

.btn-icon {
  width: 22px;
  height: 22px;
  color: var(--color-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .btn-icon {
  color: var(--color-gold);
}

.btn-icon svg {
  width: 100%;
  height: 100%;
}

.btn-whatsapp .btn-icon {
  color: var(--color-whatsapp);
}

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

/* ─── Save Contact CTA (Primary Gold Button) ────────────────────────────── */
.save-contact-section {
  margin-bottom: 1.75rem;
}

.btn-save-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-dark) 100%);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 16px;
  box-shadow: var(--shadow-gold);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
}

.btn-save-contact:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(184, 149, 110, 0.35);
  filter: brightness(1.05);
}

.btn-save-contact:active {
  transform: translateY(0);
}

.btn-save-icon {
  width: 20px;
  height: 20px;
}

/* ─── Details Section ────────────────────────────────────────────────────── */
.details-section {
  margin-bottom: 1.75rem;
}

.detail-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: 18px;
  padding: 0.5rem 1rem;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0.25rem;
}

.detail-item:not(:last-child) {
  border-bottom: 1px solid var(--color-border-light);
}

.detail-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold);
  flex-shrink: 0;
}

.detail-icon svg {
  width: 18px;
  height: 18px;
}

.detail-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-label {
  font-size: 0.7rem;
  color: var(--color-muted);
  font-weight: 500;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}

.detail-value:hover {
  color: var(--color-gold);
}

/* ─── Social Links ───────────────────────────────────────────────────────── */
.socials-section {
  margin-bottom: 1.75rem;
  text-align: center;
}

.section-subtitle {
  font-size: 0.8rem;
  color: var(--color-muted);
  font-weight: 600;
  margin-bottom: 0.85rem;
  letter-spacing: 0.05em;
}

.socials-grid {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
}

.social-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.social-btn svg {
  width: 20px;
  height: 20px;
}

.social-btn:hover {
  transform: scale(1.1);
  color: var(--color-gold);
  border-color: var(--color-gold);
  background: var(--color-card-bg);
  box-shadow: var(--shadow-sm);
}

/* ─── Utility Buttons ────────────────────────────────────────────────────── */
.utilities-section {
  margin-bottom: 1.75rem;
}

.utility-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.util-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.util-btn svg {
  width: 16px;
  height: 16px;
  color: var(--color-gold);
}

.util-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-dark);
  transform: translateY(-1px);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.card-footer {
  text-align: center;
  padding-top: 1rem;
}

.footer-gold-line {
  width: 40px;
  height: 2px;
  background: var(--color-gold);
  margin: 0 auto 0.85rem auto;
  border-radius: 2px;
  opacity: 0.4;
}

.copyright {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.copyright-sub {
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.modal-header p {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.qr-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: #FFFFFF;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  margin-bottom: 1rem;
}

.qr-container svg, .qr-container img {
  width: 180px;
  height: 180px;
}

.qr-url-text {
  font-size: 0.75rem;
  color: var(--color-muted);
  word-break: break-all;
}

/* ─── Toast Notification ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-charcoal);
  color: #FFFFFF;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 1100;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

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

/* ─── Media Queries ──────────────────────────────────────────────────────── */
@media (min-width: 480px) {
  body {
    padding-top: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
