:root {
  --bg-color: #ffffff;
  --bg-secondary: #f5f5f7;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --card-bg: rgba(255, 255, 255, 0.8);
  --card-border: rgba(255, 255, 255, 0.4);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --overlay-bg: rgba(0, 0, 0, 0.45);
  --overlay-blur: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-base: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --max-width: 520px;
  --avatar-size: 96px;
  --social-size: 44px;
}

[data-theme="dark"] {
  --bg-color: #000000;
  --bg-secondary: #1c1c1e;
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --glass-bg: rgba(30, 30, 32, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --card-bg: rgba(30, 30, 32, 0.8);
  --card-border: rgba(255, 255, 255, 0.06);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background var(--transition-base), color var(--transition-base);
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

.background-wrapper {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.background-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.background-gradient-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.background-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--transition-slow);
}

.background-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(var(--overlay-blur));
  -webkit-backdrop-filter: blur(var(--overlay-blur));
}

.background-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(255,255,255,0.04) 0%, transparent 50%);
  pointer-events: none;
}

.background-noise {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
}

.page-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.profile-card {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

.profile-header {
  text-align: center;
  margin-bottom: 32px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.avatar-wrapper {
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  margin: 0 auto 16px;
}

.avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--theme-color, #E91E63), var(--theme-secondary, #FF4081));
  opacity: 0.6;
  animation: spin 6s linear infinite;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  position: relative;
  z-index: 1;
  border: 3px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.85) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-username {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
  font-weight: 400;
}

.profile-description {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.75);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
}

.social-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s forwards;
}

.social-link {
  width: var(--social-size);
  height: var(--social-size);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: rgba(255,255,255,0.9);
  transition: all var(--transition-base);
  font-size: 1.2rem;
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--theme-color, #E91E63);
  opacity: 0;
  transition: opacity var(--transition-base);
  border-radius: var(--radius-full);
}

.social-link:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  border-color: rgba(255,255,255,0.2);
}

.social-link:hover::before {
  opacity: 0.2;
}

.social-link svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.links-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  color: var(--text-primary);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: 60px;
}

.link-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.link-item:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  border-color: rgba(255,255,255,0.15);
}

.link-item:hover::before {
  opacity: 1;
}

.link-item:active {
  transform: translateY(0) scale(0.99);
}

.link-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.link-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.link-icon-wrapper svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.link-content {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.link-title {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.link-subtitle {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.link-clicks {
  display:none !important;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.link-clicks svg {
  width: 14px;
  height: 14px;
}

.link-featured-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--theme-color, #E91E63);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 0 var(--radius-lg) 0 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.featured-glow {
  border-color: rgba(233, 30, 99, 0.3);
  box-shadow: 0 0 30px rgba(233, 30, 99, 0.08), var(--card-shadow);
}

.featured-glow:hover {
  box-shadow: 0 0 40px rgba(233, 30, 99, 0.12), 0 8px 30px rgba(0,0,0,0.12);
}

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-base);
  opacity: 0;
  animation: fadeInUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
}

.admin-link:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  transform: translateY(-1px);
}

.admin-link svg {
  width: 16px;
  height: 16px;
}

.theme-toggle {
  display:none !important;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: rgba(255,255,255,0.9);
  
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-base);
  box-shadow: var(--glass-shadow);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  background: rgba(255,255,255,0.15);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.search-bar {
  width: 100%;
  margin-bottom: 16px;
  position: relative;
  opacity: 0;
  animation: fadeInUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s forwards;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-base);
  box-shadow: var(--glass-shadow);
}

.search-input::placeholder {
  color: rgba(255,255,255,0.4);
}

.search-input:focus {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  font-size: 1rem;
  pointer-events: none;
}

.footer-section {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
  transition: all var(--transition-base);
}

.footer-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  transform: translateY(-1px);
}

.footer-btn svg {
  width: 14px;
  height: 14px;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  opacity: 0;
  animation: fadeInUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.25s forwards;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  max-width: 380px;
  min-width: 280px;
}

.toast.removing {
  animation: toastOut 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.toast.success { border-left: 3px solid #34C759; }
.toast.error { border-left: 3px solid #FF3B30; }
.toast.info { border-left: 3px solid #007AFF; }

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
  padding: 20px;
}

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

.modal {
  background: var(--bg-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.modal-btn-primary {
  background: var(--theme-color, #E91E63);
  color: white;
}

.modal-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.modal-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-btn-secondary:hover {
  opacity: 0.8;
}

.modal-btn-danger {
  background: #FF3B30;
  color: white;
}

.modal-btn-danger:hover {
  opacity: 0.9;
}

/* QR Code Modal */
.qr-modal-body {
  text-align: center;
  padding: 20px 0;
}

.qr-code-container {
  display: inline-block;
  background: white;
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.qr-code-container canvas {
  display: block;
  margin: 0 auto;
}

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

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Shimmer loading */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}

.skeleton-text {
  height: 16px;
  width: 60%;
  margin: 0 auto 8px;
}

.skeleton-text-sm {
  height: 12px;
  width: 40%;
  margin: 0 auto;
}

.skeleton-link {
  height: 60px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

/* Responsive */
@media (max-width: 600px) {
  :root {
    --avatar-size: 80px;
    --social-size: 40px;
    --max-width: 100%;
  }

  .page-container {
    padding: 24px 16px;
  }

  .profile-name {
    font-size: 1.3rem;
  }

  .profile-description {
    font-size: 0.875rem;
  }

  .link-item {
    padding: 14px 16px;
    min-height: 54px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    min-width: unset;
    max-width: unset;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
  }

  .modal {
    padding: 24px 20px;
  }
}

@media (min-width: 768px) {
  .link-item:hover {
    transform: translateY(-3px) scale(1.02);
  }
}

@media (max-width: 380px) {
  .profile-name {
    font-size: 1.1rem;
  }

  .social-bar {
    gap: 8px;
  }

  .social-link {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .link-item {
    padding: 12px 14px;
    min-height: 50px;
    gap: 10px;
  }
}
