:root {
  --apple-blue: #007aff;
  --apple-gray: #8e8e93;
  --apple-light-gray: #f2f2f7;
  --apple-border: #d1d1d6;
  --apple-text: #000000;
  --apple-secondary: #ffffff;
  --saul-orange: #ff6b35;
  --saul-teal: #00d9ff;
  --saul-yellow: #ffd23f;
  --accent-color: #007aff;
  --card-bg: #ffffff;
  --card-text: #000000;
  --theme-bg: #ffffff;
  --theme-text: #000000;
  --theme-secondary-bg: #f2f2f7;
  --theme-border: #d1d1d6;
  --theme-gray: #8e8e93;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #fafafa;
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  color: var(--apple-text);
  transition: background-color 0.3s ease;
}

/* --- Theme Classes --- */
body.light-theme {
  --theme-bg: #ffffff;
  --theme-text: #000000;
  --theme-secondary-bg: #f2f2f7;
  --theme-border: #d1d1d6;
  --theme-gray: #8e8e93;
}

body.dark-theme {
  --theme-bg: #1c1c1e;
  --theme-text: #ffffff;
  --theme-secondary-bg: #2c2c2e;
  --theme-border: #38383a;
  --theme-gray: #aeaeb2;
}

/* --- Background Shapes --- */
.abstract-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
}

.shape-1 {
  width: 600px;
  height: 600px;
  background: linear-gradient(135deg, var(--saul-orange), var(--saul-teal));
  top: -200px;
  right: -200px;
  animation: float 20s ease-in-out infinite;
}

.shape-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(45deg, var(--saul-teal), var(--saul-yellow));
  bottom: -100px;
  left: -100px;
  animation: float 15s ease-in-out infinite reverse;
}

.shape-3 {
  width: 300px;
  height: 300px;
  background: linear-gradient(90deg, var(--saul-yellow), var(--saul-orange));
  top: 40%;
  left: 60%;
  animation: float 25s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  50% {
    transform: translate(30px, -30px) rotate(180deg);
  }
}

/* --- Layout Structure --- */
#mainApp {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
}

.row.h-100 {
  height: 100%;
  margin: 0;
}

/* --- Sidebar (Editor) --- */
#sidebarCol {
  height: 100%;
  border-right: 0 solid var(--theme-border, var(--apple-border));
  background: var(--theme-bg, white);
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: transform 0.3s ease;
}

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.sidebar-navbar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--theme-border, var(--apple-border));
  background: var(--theme-bg, white);
  z-index: 10;
}

.nav-tabs {
  border-bottom: none;
  display: flex;
  margin: 0;
  padding: 0;
}

.nav-item {
  flex: 1;
  text-align: center;
  list-style: none;
}

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 12px 4px;
  border: none;
  background: transparent;
  color: var(--theme-gray, var(--apple-gray));
  font-size: 11px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-link i {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-link:hover {
  color: var(--accent-color);
  background: rgba(var(--accent-color-rgb, 0, 122, 255), 0.05);
}

.nav-link.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

/* FIX: Tabs visibility */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--theme-border) transparent;
}

/* --- Form Elements --- */
.form-section {
  margin-bottom: 32px;
}

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--theme-gray);
  margin-bottom: 16px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--theme-text);
}

.form-control,
.form-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--theme-secondary-bg);
  color: var(--theme-text);
  font-size: 15px;
  transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  background: var(--theme-bg);
  color: var(--theme-text);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.form-control-color {
  padding: 4px;
  height: 42px;
  cursor: pointer;
}

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}

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

.btn-add {
  width: 100%;
  border: 2px dashed var(--theme-border);
  background: transparent;
  color: var(--accent-color);
  padding: 16px;
}

.btn-add:hover {
  background: rgba(0, 122, 255, 0.05);
  border-color: var(--accent-color);
}

/* --- Link Items --- */
.link-item {
  background: var(--theme-secondary-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  cursor: grab;
  transition: box-shadow 0.2s;
}

.link-item:active {
  cursor: grabbing;
}

.link-item:hover {
  background: var(--theme-bg);
  border-color: var(--theme-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.link-item.dragging {
  opacity: 0.5;
  background: var(--theme-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* --- Preview Column --- */
#previewCol {
  height: 100%;
  background: #f0f0f3;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bio-preview {
  height: 100%;
  min-height: 100vh;
}

body.dark-theme #previewCol {
  background: #000000;
}

.preview-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.preview-content {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Bio Card System (Crucial for 3D Flip) --- */
.bio-wrapper {
  min-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  /* Stack card and buttons */
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 40px;
  /* Space between card and buttons */
  perspective: 1500px;
}

.bio-container {
  width: 100%;
  max-width: 440px;
  /* Instead of absolute height, let content dictate but ensure stacking */
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;

  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  border-radius: 24px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.2);
  background: transparent;
  /* Faces carry the background */
  position: relative;
}

.bio-container.flipped {
  transform: rotateY(180deg);
}

.card-face {
  grid-area: 1 / 1;
  /* Stack faces on top of each other */
  width: 100%;
  height: 100%;
  min-height: 600px;
  /* Ensure consistent height */

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  border-radius: inherit;
  background-color: var(--card-bg, #ffffff);
  color: var(--card-text, #000000);

  padding: 40px 32px;
  display: flex;
  flex-direction: column;

  /* Smooth out rendering */
  transform: translateZ(0);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  /* Subtle inner border */
}

.card-face.front {
  z-index: 2;
  transform: rotateY(0deg);
  align-items: center;
}

.card-face.back {
  transform: rotateY(180deg);
  z-index: 1;
  /* Remove center alignment, let content dictate layout */
  justify-content: flex-start;
  align-items: center;
  overflow-y: auto;
}

/* --- Card Content --- */
.bio-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  margin-bottom: 32px;
}

.bio-avatar-container {
  position: relative;
  margin-bottom: 24px;
}

.bio-avatar {
  width: 110px;
  height: 110px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.avatar-remove-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff3b30;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.bio-avatar-container:hover .avatar-remove-btn {
  opacity: 1;
}

.bio-name {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.bio-description {
  font-size: 15px;
  opacity: 0.7;
  margin: 0;
  line-height: 1.5;
}

.bio-logo-container {
  text-align: center;
  margin-bottom: 32px;
  width: 100%;
}

.bio-logo-text {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.5;
  margin-bottom: 8px;
}

.bio-logo img {
  height: 24px;
  width: auto;
}

.bio-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 60px;
  /* Space for fixed actions */
}

.bio-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.bio-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* --- Back Face Content (Download/Share) --- */
.back-content {
  display: none;
  /* Hidden by default */
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 10px 0;
  animation: fadeIn 0.4s ease 0.1s forwards;
  opacity: 0;
}

.back-content.active {
  display: flex;
  opacity: 1;
}

.back-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  color: inherit;
  text-align: center;
  width: 100%;
}

.qr-code-container {
  background: white;
  padding: 12px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  margin-bottom: 24px;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-container img {
  display: block;
  max-width: 100%;
}

.back-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 14px;
  border: none;
  margin-bottom: 0;
  /* Handled by gap */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* Align text leftish */
  gap: 16px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.2s;
  text-align: left;
}

.action-btn i {
  font-size: 20px;
  opacity: 0.8;
}

.action-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}

/* Close button for back face */
.flip-back-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  margin: 0;
  /* Reset margin */
  transition: all 0.2s;
  z-index: 10;
  background: rgba(128, 128, 128, 0.15);
  color: inherit;
  backdrop-filter: blur(5px);
}

.flip-back-btn:hover {
  transform: rotate(90deg);
  background: rgba(128, 128, 128, 0.25);
}

.share-url-box {
  display: flex;
  width: 100%;
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 24px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.share-url-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0 12px;
  outline: none;
  font-family: 'SF Mono', 'Roboto Mono', monospace;
  font-size: 13px;
  color: inherit;
}

.share-url-box button {
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: opacity 0.2s;
}

.share-url-box button:hover {
  opacity: 0.9;
}

/* --- Floating Actions on Card --- */
.card-actions {
  position: relative;
  /* Changed from absolute to flow with document */
  bottom: auto;
  left: auto;
  transform: none;
  z-index: 50;
  display: flex;
  gap: 20px;
  pointer-events: auto;
  margin-top: 20px;
}

/* Ensure wrapper handles the space */
.bio-wrapper {
  position: relative;
  padding-bottom: 40px;
}

.card-action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: white;
  color: black;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-action-btn:hover {
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

/* Dark mode adjustments */
body.dark-theme .card-action-btn {
  background: #2c2c2e;
  color: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Mobile overrides */
@media (max-width: 767.98px) {
  /* ... existing code ... */

  .card-actions {
    /* Keep relative flow on mobile too for simplicity, or fix if needed */
    position: relative;
    bottom: auto;
    z-index: 10;
  }

  .bio-wrapper {
    padding-bottom: 120px;
    /* More space on mobile */
  }

  .bio-container {
    /* Ensure card fits on screen with padding */
    min-height: auto;
    height: auto;
  }

  .card-face {
    min-height: 560px;
    /* slightly smaller on mobile */
  }
}

/* --- Mobile Responsiveness (Core logic for 2-column vs 1-column) --- */

/* Default Desktop: Sidebar left, Preview right (managed by Bootstrap grid) */
/* Logic: We use .mobile-hidden class controlled by JS to manage visibility ON MOBILE */

@media (min-width: 768px) {

  /* On desktop, ignore the .mobile-hidden class! Always show columns. */
  #sidebarCol.mobile-hidden,
  #previewCol.mobile-hidden {
    display: block !important;
  }

  /* Preview Tab button hidden on desktop */
  .nav-item:has([data-tab="apercu"]) {
    display: none;
  }
}

@media (max-width: 767.98px) {

  /* Mobile Layout */
  #sidebarCol,
  #previewCol {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
  }

  /* JS toggles this class to switch screens */
  .mobile-hidden {
    display: none !important;
  }

  /* Adjust spacing for mobile */
  .bio-wrapper {
    padding: 20px 10px;
    align-items: flex-start;
    /* Allow scrolling if needed */
  }

  .bio-container {
    min-height: 90vh;
    /* Nearly full screen card */
  }

  /* Sidebar adjustments */
  .sidebar-navbar {
    order: 2;
    /* Move navbar to bottom if desired, or keep top */
    border-top: 1px solid var(--theme-border);
    border-bottom: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    box-shadow: #000 0 9px 17px, #0005 0 9px 179px;
  }

  .sidebar-content {
    padding-bottom: 80px;
    /* Space for bottom navbar */
  }

  /* Preview needs space for the bottom navbar too if we want to keep it visible */
  #previewCol {
    padding-bottom: 60px;
  }

  /* Adjust Card Actions position on mobile */
  .card-actions {
    bottom: 80px;
    /* Above navbar */
  }
}

/* --- Modal --- */
.onboarding-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.onboarding-content {
  background: white;
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Neon 3D Mode (Ultra Wide Only) --- */
@media (min-width: 2400px) and (min-height: 1200px) {
  body {
    background: #050505;
    overflow: hidden;
    perspective: 3000px;
  }

  .abstract-shapes {
    filter: blur(80px);
    opacity: 0.2;
  }

  #mainApp {
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
  }

  .row.h-100 {
    width: 80%;
    height: 80vh;
    transform: rotateX(2deg);
    transform-style: preserve-3d;
    gap: 60px;
    justify-content: center;
  }

  #sidebarCol,
  #previewCol {
    flex: 0 0 45%;
    max-width: 45%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(40px);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 40px 80px rgba(0, 0, 0, 0.5);
  }

  #sidebarCol {
    transform: translateZ(40px) rotateY(3deg);
  }

  #previewCol {
    background: transparent !important;
    transform: translateZ(40px) rotateY(-3deg);
    border: none;
    box-shadow: none;
  }

  .sidebar {
    background: transparent;
  }

  /* Neon Text & Inputs */
  .section-label,
  .sidebar-title,
  .form-label {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  }

  .form-control,
  .form-select,
  .link-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
  }
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--theme-text, var(--apple-text));
  margin-bottom: 8px;
  display: block;
}

.form-control,
.form-select {
  background: var(--theme-secondary-bg, var(--apple-light-gray));
  border: 1px solid transparent;
  color: var(--theme-text, var(--apple-text));
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-theme .form-control,
.dark-theme .form-select {
  color: #ffffff;
}

.form-control:focus,
.form-select:focus {
  background: var(--theme-bg, white);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px rgba(var(--accent-color-rgb, 0, 122, 255), 0.1);
  outline: none;
}

.dark-theme .form-control:focus,
.dark-theme .form-select:focus {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.form-control::placeholder {
  color: var(--theme-gray, var(--apple-gray));
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-control-color {
  height: 50px;
  padding: 6px;
  border-radius: 10px;
  cursor: pointer;
}

/* Buttons */
.btn {
  border-radius: 12px;
  font-weight: 500;
  font-size: 15px;
  padding: 12px 24px;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

.btn-primary {
  background: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-color);
  filter: brightness(0.9);
}

.btn-secondary {
  background: var(--theme-secondary-bg, var(--apple-light-gray));
  color: var(--theme-text, var(--apple-text));
}

.btn-secondary:hover {
  background: var(--theme-secondary-bg, #e5e5ea);
  filter: brightness(0.95);
}

.btn-add {
  background: transparent;
  color: var(--accent-color);
  border: 2px dashed var(--theme-border, var(--apple-border));
  box-shadow: none;
}

.btn-add:hover {
  border-color: var(--accent-color);
  background: rgba(var(--accent-color-rgb, 0, 122, 255), 0.05);
}

.dark-theme .btn-add:hover {
  background: rgba(255, 255, 255, 0.05);
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Link items */
.link-item {
  background: var(--theme-secondary-bg, var(--apple-light-gray));
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: grab;
}

.link-item:active {
  cursor: grabbing;
}

.link-item.dragging {
  opacity: 0.5;
}

.link-item.drag-over {
  border-color: var(--accent-color);
  background: var(--theme-bg, white);
}

.link-item:hover {
  background: var(--theme-bg, white);
  border-color: var(--theme-border, var(--apple-border));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dark-theme .link-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.link-item .btn-outline-danger {
  background: transparent;
  border: none;
  color: #ff3b30;
  padding: 6px 12px;
  box-shadow: none;
}

.link-item .btn-outline-danger:hover {
  background: rgba(255, 59, 48, 0.1);
}

/* Mobile menu button */
.mobile-menu-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1060;
  background: var(--theme-bg, white);
  color: var(--theme-text, var(--apple-text));
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 12px 16px;
}

.mobile-menu-toggle:hover {
  background: var(--theme-secondary-bg, var(--apple-light-gray));
  transform: scale(1.05);
}

/* Preview container */
.preview-container {
  background: var(--theme-bg, white);
  box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.04);
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
}

.dark-theme .preview-container {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.1);
}

.preview-content {
  flex: 1;
  overflow-y: auto;
  background: #fafafa;
}

body.dark-theme .preview-content {
  background: #000000;
}

/* Bio preview */
.bio-preview {
  width: 100%;
  height: 100%;
}

.bio-wrapper {
  width: 100%;
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
}

.bio-container {
  max-width: 470px;
  width: 100%;
  margin: 0 auto;
  /* padding moved to .card-face */
  padding: 0;
  /* 3D Transform Properties */
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: grid !important;
  /* Stack faces */
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.bio-container.flipped {
  transform: rotateY(180deg);
}

/* Card Faces */
.card-face {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: inherit;
  background: inherit;
  /* Inherit color from container */
  overflow-y: visible;
}

.card-face.front {
  z-index: 2;
  transform: rotateY(0deg);
}

.card-face.back {
  z-index: 1;
  transform: rotateY(180deg);
  justify-content: center;
}

/* Back Face Content */
.back-content {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  opacity: 0;
  transition: opacity 0.3s ease 0.2s;
}

.back-content.active {
  display: flex;
  opacity: 1;
}

.back-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}

.back-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  width: 100%;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.action-btn:hover {
  transform: scale(1.02);
  filter: brightness(0.95);
}

.flip-back-btn {
  margin-top: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.flip-back-btn:hover {
  transform: scale(1.1) rotate(90deg);
}

.bio-logo-container {
  text-align: center;
  margin-bottom: 48px;
}

.bio-logo-text {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.6;
  margin-bottom: 0px;
  letter-spacing: 0.7px;
}

.bio-logo {
  position: relative;
  width: 110px;
  height: 36px;
  margin: 0 auto;
}

.bio-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0);
}

.bio-logo .dark-logo {
  display: none;
}

.dark-theme .bio-logo .light-logo {
  display: none;
}

.dark-theme .bio-logo .dark-logo {
  display: block;
  filter: brightness(1);
}

.bio-logo::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--logo-color);
  mix-blend-mode: screen;
  pointer-events: none;
}

.dark-theme .bio-logo::after {
  display: none;
}

.bio-profile {
  text-align: center;
  margin-bottom: 56px;
}

.bio-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.bio-avatar:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

.bio-avatar-container {
  position: relative;
  display: inline-block;
  margin-bottom: 28px;
}

.avatar-remove-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 59, 48, 0.9);
  border: 2px solid white;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-size: 12px;
}

.avatar-remove-btn:hover {
  background: rgba(255, 59, 48, 1);
  transform: scale(1.1);
}

.bio-avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  margin: 0 auto 28px;
  opacity: 0.2;
  color: var(--apple-gray);
}

.bio-name {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.8px;
}

.bio-description {
  font-size: 16px;
  opacity: 0.7;
  line-height: 1.6;
  margin: 0 auto;
  font-weight: 400;
}

.bio-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bio-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 32px;
  background: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  letter-spacing: -0.2px;
}

.bio-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.bio-link i {
  font-size: 18px;
}

.rounded {
  border-radius: 12px;
}

.rounded-0 {
  border-radius: 0;
}

.rounded-pill {
  border-radius: 50px;
}

/* Custom scrollbar */
.preview-content::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.preview-content::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.preview-content::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.preview-content::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Toast notifications */
.alert {
  border-radius: 12px;
  border: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-weight: 500;
}

/* Responsive design and Mobile sidebar styles */
@media (max-width: 768px) {
  #previewArea {
    display: none;
  }

  #previewArea.show-mobile {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
  }

  .mobile-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    width: 100%;
    z-index: 1050;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .mobile-sidebar.show {
    left: 0;
  }

  .mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
  }

  .mobile-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-header {
    padding: 32px 24px 24px;
  }

  .sidebar-title {
    font-size: 28px;
  }

  .sidebar-content {
    padding: 24px;
  }

  .form-section {
    margin-bottom: 32px;
  }

  .bio-container {
    padding: 48px 32px;
    border-radius: 20px;
  }

  .bio-logo {
    width: 160px;
    height: 48px;
    margin-bottom: 40px;
  }

  .card-face {
    padding: 48px 32px;
  }

  .bio-avatar,
  .bio-avatar-placeholder {
    width: 100px;
    height: 100px;
  }

  .bio-avatar-placeholder {
    font-size: 52px;
  }

  .bio-name {
    font-size: 28px;
  }

  .bio-description {
    font-size: 15px;
  }

  .bio-link {
    padding: 16px 28px;
    font-size: 15px;
  }
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bio-link {
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus states for accessibility */
.btn:focus-visible,
.form-select:focus-visible,
.form-control:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Dark theme specific adjustments */
body.dark-theme .abstract-shapes {
  opacity: 0.05;
}

body.dark-theme {
  background: #000000;
}

body.dark-theme .link-item small {
  color: var(--theme-gray) !important;
}

/* Card Action Buttons */
.card-actions {
  position: fixed;
  bottom: 32px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 32px;
  pointer-events: none;
  z-index: 200;
}

@media (min-width: 768px) {
  .card-actions {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 470px;
    right: auto;
  }
}

.card-action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--accent-color);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  animation: floatBubble 8s ease-in-out infinite;
}

.card-action-btn:first-child {
  animation: floatBubble 7s ease-in-out infinite;
  animation-delay: -2s;
}

.card-action-btn:last-child {
  animation: floatBubble 9s ease-in-out infinite;
  animation-delay: -4s;
}

@keyframes floatBubble {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  25% {
    transform: translateY(-8px) scale(1.02);
  }

  50% {
    transform: translateY(-4px) scale(0.98);
  }

  75% {
    transform: translateY(-12px) scale(1.01);
  }
}

.card-action-btn:hover {
  transform: translateY(-8px) scale(1.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  animation: none;
}

.card-action-btn:active {
  transform: translateY(-4px) scale(1.05);
}

/* Action Panel Overlay */
.action-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  backdrop-filter: blur(0);
  z-index: 250;
  opacity: 0;
  visibility: hidden;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.action-panel-overlay.active {
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.dark-theme .action-panel-overlay.active {
  background: rgba(0, 0, 0, 0.4);
}

/* Action Panels - REMOVED OLD STYLES */

.qr-code-container {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: white;
  border-radius: 16px;
  margin: 0;
}

.qr-code-container canvas,
.qr-code-container img {
  max-width: 180px;
  height: auto;
  display: block;
}

.share-url-box {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 8px;
  width: 100%;
  margin: 0;
}

.dark-theme .share-url-box {
  background: rgba(255, 255, 255, 0.08);
}

.share-url-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 14px;
  font-family: 'SF Mono', Monaco, monospace;
  outline: none;
  color: var(--apple-text);
}

.dark-theme .share-url-box input {
  color: white;
}

.share-url-box button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: none;
  background: var(--accent-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.share-url-box button:hover {
  transform: scale(1.05);
}

.share-url-box button:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .card-actions {
    bottom: 24px;
    padding: 0 24px;
  }

  .card-action-btn {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }

  .action-panel {
    max-height: 70vh;
  }
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.og-preview {
  background: var(--theme-secondary-bg, var(--apple-light-gray));
  border: 1px solid var(--theme-border, var(--apple-border));
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 16px;
}

.og-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: var(--accent-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
}

.og-info {
  flex: 1;
  min-width: 0;
}

.og-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--theme-text, var(--apple-text));
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.og-description {
  font-size: 13px;
  color: var(--theme-gray, var(--apple-gray));
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.og-url {
  font-size: 12px;
  color: var(--accent-color);
  font-family: 'SF Mono', Monaco, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--theme-secondary-bg, var(--apple-light-gray));
  border: 1px solid var(--theme-border, var(--apple-border));
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--theme-gray, var(--apple-gray));
  font-weight: 500;
}


.url-box {
  display: flex;
  gap: 8px;
  background: var(--apple-light-gray);
  border-radius: 12px;
  padding: 8px;
}

.url-box .form-control {
  flex: 1;
  border: 1px solid var(--apple-border);
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 14px;
}

.url-box .btn {
  padding: 12px 16px;
  flex-shrink: 0;
}


/* --- Floating Actions on Card --- */
.card-actions {
  position: relative;
  /* Changed from absolute to flow with document */
  bottom: auto;
  left: auto;
  transform: none;
  z-index: 50;
  display: flex;
  gap: 20px;
  pointer-events: auto;
  margin-top: 20px;
}

/* Ensure wrapper handles the space */
.bio-wrapper {
  position: relative;
  padding-bottom: 40px;
}

.card-action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: white;
  color: black;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-action-btn:hover {
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

/* Dark mode adjustments */
body.dark-theme .card-action-btn {
  background: #2c2c2e;
  color: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Mobile overrides */
@media (max-width: 767.98px) {
  /* ... existing code ... */

  .card-actions {
    /* Keep relative flow on mobile too for simplicity, or fix if needed */
    position: relative;
    bottom: auto;
    z-index: 10;
  }
}


h1 {
  font-size: 144% !important;
}

.main-title {
  white-space: pre-wrap;
}