/* ========================================================
   Redz Team - High Performance Ultra-Smooth Stylesheet
   Optimized for Mobile (120 FPS / Instant Load)
   ======================================================== */

:root {
  --bg-dark: #08090d;
  --bg-card: #10121a;
  --bg-card-hover: #151824;
  --bg-element: rgba(255, 255, 255, 0.05);
  --bg-element-hover: rgba(255, 255, 255, 0.09);

  --primary-red: #ff2a3b;
  --primary-red-glow: rgba(255, 42, 59, 0.3);
  --primary-red-dark: #cc1829;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 42, 59, 0.45);

  --accent-instagram: linear-gradient(135deg, #f09433, #dc2743, #bc1888);
  --accent-whatsapp: #25d366;
  --accent-facebook: #1877f2;
  --accent-email: #ea4335;
  --accent-phone: #34a853;

  --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-en: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-ar);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

html[dir="ltr"] {
  font-family: var(--font-en);
}

/* Body with GPU-friendly Pure CSS Ambient Glow & Cyber Dots */
body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 36px;
  background-color: #08090d;
  background-image: 
    radial-gradient(circle at 50% -80px, rgba(255, 42, 59, 0.22) 0%, transparent 480px),
    radial-gradient(circle at 100% 40%, rgba(220, 38, 54, 0.08) 0%, transparent 320px),
    radial-gradient(circle at 0% 80%, rgba(180, 20, 35, 0.08) 0%, transparent 350px),
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* UI Icons (Lightweight Vector Symbols) */
.ui-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.brand-icon {
  width: 26px;
  height: 26px;
}

/* Top Sticky Bar */
.top-nav {
  position: sticky;
  top: 10px;
  z-index: 40;
  width: 100%;
  max-width: 540px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  margin: 10px auto 20px;
  background: rgba(16, 18, 26, 0.88);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

@supports (backdrop-filter: blur(10px)) {
  .top-nav {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}

.code-tag {
  color: var(--primary-red);
  font-weight: 800;
}

.nav-brand-text {
  color: #ffffff;
  font-family: var(--font-en);
}

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

.nav-btn {
  background: var(--bg-element);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: transform 0.15s ease, background 0.15s ease;
}

.nav-btn:active {
  transform: scale(0.94);
}

.lang-label {
  font-weight: 700;
  font-size: 0.78rem;
  font-family: var(--font-en);
}

/* Card Container */
.card-container {
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Profile Hero */
.profile-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 30px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, var(--primary-red), transparent);
}

.avatar-wrapper {
  position: relative;
  width: 104px;
  height: 104px;
  margin-bottom: 16px;
}

.avatar-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 42, 59, 0.45);
  animation: slowSpin 24s linear infinite;
  will-change: transform;
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
  border: 2.5px solid #1a1d29;
  display: block;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.avatar-wrapper:hover .profile-avatar,
.avatar-wrapper:active .profile-avatar {
  transform: scale(1.05);
}

.status-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: #00e676;
  border: 2.5px solid #10121a;
  border-radius: 50%;
  box-shadow: 0 0 8px #00e676;
}

html[dir="rtl"] .status-indicator {
  right: auto;
  left: 4px;
}

/* Brand Name - Locked LTR to prevent BiDi inversion in RTL */
.brand-title-wrap {
  direction: ltr !important;
  unicode-bidi: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.brand-name {
  direction: ltr !important;
  unicode-bidi: isolate;
  font-family: var(--font-en);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.name-main {
  direction: ltr !important;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: baseline;
}

.name-white { color: #ffffff; }
.name-red { color: var(--primary-red); }

.name-sub {
  direction: ltr !important;
  unicode-bidi: isolate;
  font-size: 0.92rem;
  letter-spacing: 4px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.badge-dev {
  direction: ltr !important;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 14px;
  background: rgba(255, 42, 59, 0.08);
  border: 1px solid rgba(255, 42, 59, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: #ff9ca6;
  font-weight: 600;
}

.dev-icon {
  width: 14px;
  height: 14px;
  stroke: var(--primary-red);
}

.verified-icon {
  width: 15px;
  height: 15px;
  fill: #3b82f6;
}

.brand-bio {
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
  max-width: 440px;
  margin-bottom: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.25);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: #69f0ae;
  font-weight: 600;
  margin-bottom: 20px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: #00e676;
  border-radius: 50%;
  box-shadow: 0 0 6px #00e676;
  animation: statusBreathe 2.4s ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes statusBreathe {
  0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 6px #00e676; }
  50% { transform: scale(1.25); opacity: 0.75; box-shadow: 0 0 10px #00e676; }
}

/* Quick Actions Bar */
.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  background: var(--bg-element);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease;
}

.quick-btn:active {
  transform: scale(0.95);
  background: rgba(255, 42, 59, 0.12);
}

.btn-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.btn-whatsapp .btn-icon-wrap { color: #25d366; }
.btn-vcard .btn-icon-wrap { color: #3b82f6; }

/* Services Strip */
.services-strip {
  overflow: hidden;
}

.services-scroller {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.service-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-red);
}

/* Links & Socials */
.links-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin: 4px 0 2px;
}

.title-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.links-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Link Cards (Optimized with content-visibility for ultra smooth scroll) */
.link-card {
  content-visibility: auto;
  contain-intrinsic-size: 78px;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.link-card:active {
  transform: scale(0.985);
  border-color: rgba(255, 42, 59, 0.4);
}

@media (hover: hover) {
  .link-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
  }
}

.card-icon-box {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-element);
}

.card-instagram .card-icon-box { color: #f56040; }
.card-whatsapp .card-icon-box { color: var(--accent-whatsapp); }
.card-facebook .card-icon-box { color: var(--accent-facebook); }
.card-email .card-icon-box { color: #ff5252; }
.card-phone .card-icon-box { color: #34d399; }
.card-qr-show .card-icon-box { color: var(--primary-red); }

.card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.card-platform {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.badge-featured {
  background: rgba(255, 42, 59, 0.15);
  color: #ff6b78;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.badge-fast {
  background: rgba(37, 211, 102, 0.15);
  color: #4ade80;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.card-handle {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-mono {
  font-family: var(--font-mono);
  font-size: 0.94rem;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-action-arrow {
  color: var(--text-dim);
  padding: 4px;
}

.card-primary-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.card-side-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-copy, .btn-action-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-element);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.btn-copy:active, .btn-action-round:active {
  transform: scale(0.9);
}

.card-qr-show {
  cursor: pointer;
}

/* Footer Section */
.card-footer {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cta-banner {
  background: #11141e;
  border: 1px solid rgba(255, 42, 59, 0.28);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cta-text h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.cta-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cta-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--primary-red);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease;
}

.cta-action-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transform: rotate(25deg);
  animation: sweepLight 4s ease-in-out infinite;
}

@keyframes sweepLight {
  0%, 75% { transform: translateX(0) rotate(25deg); }
  100% { transform: translateX(420%) rotate(25deg); }
}

.cta-action-btn:active {
  transform: scale(0.96);
}

.copyright-wrap {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.redz-glow {
  color: var(--primary-red);
  font-weight: 700;
}

.built-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.78rem;
}

/* QR Code Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.glass-box {
  background: #10121a;
  border: 1px solid var(--border-glass);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-lg);
  padding: 28px 20px 22px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.active .glass-box {
  transform: scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-element);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

html[dir="ltr"] .modal-close-btn {
  left: auto;
  right: 12px;
}

.modal-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 42, 59, 0.12);
  border: 1px solid rgba(255, 42, 59, 0.3);
  color: var(--primary-red);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 4px;
}

.modal-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* QR Code Color Theme Switcher */
.qr-theme-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.qr-theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.qr-theme-pill.active {
  background: rgba(255, 42, 59, 0.18);
  border-color: rgba(255, 42, 59, 0.45);
  color: #ffffff;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #ff2a3b; }
.dot-dark { background: #1e2230; border: 1px solid #636b84; }
.dot-classic { background: #ffffff; }

.qr-canvas-wrapper {
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.qr-canvas-wrapper canvas, .qr-canvas-wrapper img {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.modal-btn {
  flex: 1;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.modal-btn-primary {
  background: var(--primary-red);
  color: #fff;
}

.modal-btn-secondary {
  background: var(--bg-element);
  border: 1px solid var(--border-glass);
  color: #fff;
}

/* Toast Notification */
.toast-popup {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #151824;
  border: 1px solid var(--primary-red);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

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

.toast-icon {
  fill: var(--primary-red);
}

/* Mobile Tweaks */
@media (max-width: 480px) {
  body { padding: 0 10px 28px; }
  .profile-hero { padding: 24px 14px 20px; }
  .brand-name { font-size: 1.85rem; }
  .quick-btn { padding: 10px 4px; font-size: 0.75rem; }
  .btn-icon-wrap { width: 36px; height: 36px; }
  .link-card { padding: 12px 14px; gap: 12px; }
  .card-icon-box { width: 44px; height: 44px; min-width: 44px; }
  .card-handle { font-size: 0.94rem; }
}

/* 60/120 FPS Composited Entrance Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-hero {
  animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.quick-btn {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.quick-btn:nth-child(1) { animation-delay: 0.04s; }
.quick-btn:nth-child(2) { animation-delay: 0.08s; }
.quick-btn:nth-child(3) { animation-delay: 0.12s; }
.quick-btn:nth-child(4) { animation-delay: 0.16s; }

.services-strip {
  animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.14s both;
}

.links-grid .link-card {
  animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.links-grid .link-card:nth-child(1) { animation-delay: 0.06s; }
.links-grid .link-card:nth-child(2) { animation-delay: 0.12s; }
.links-grid .link-card:nth-child(3) { animation-delay: 0.18s; }
.links-grid .link-card:nth-child(4) { animation-delay: 0.24s; }
.links-grid .link-card:nth-child(5) { animation-delay: 0.30s; }
.links-grid .link-card:nth-child(6) { animation-delay: 0.36s; }

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