/**
 * linktree.eknirb - Main Stylesheet
 * Fresh, friendly, light and responsive design (Mobile-First)
 */

@import url('../fonts/fonts.css');

:root {
  /* Color Palette: Fresh Light (Default) */
  --bg-gradient: linear-gradient(145deg, #f7f9fc 0%, #edf2f7 50%, #fef8f4 100%);
  --bg-blob-1: rgba(186, 230, 253, 0.45); /* Sky blue */
  --bg-blob-2: rgba(254, 215, 170, 0.45); /* Soft peach */
  --bg-blob-3: rgba(199, 210, 254, 0.35); /* Soft indigo */
  
  --surface-bg: rgba(255, 255, 255, 0.88);
  --surface-border: rgba(255, 255, 255, 0.85);
  --surface-border-subtle: rgba(226, 232, 240, 0.8);
  --surface-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --surface-shadow-hover: 0 10px 25px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  
  --primary: #1e293b;
  --primary-hover: #0f172a;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --accent-glow: rgba(37, 99, 235, 0.15);
  
  --highlight-border: #3b82f6;
  --highlight-bg: rgba(239, 246, 255, 0.9);
  --highlight-badge-bg: #eff6ff;
  --highlight-badge-text: #1d4ed8;

  --card-radius: 20px;
  --btn-radius: 14px;
  --pill-radius: 9999px;
  
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Theme Variations */
[data-theme="pastel-mint"] {
  --bg-gradient: linear-gradient(145deg, #f0fdf4 0%, #f7fee7 50%, #ecfdf5 100%);
  --bg-blob-1: rgba(167, 243, 208, 0.5);
  --bg-blob-2: rgba(254, 240, 138, 0.4);
  --bg-blob-3: rgba(153, 246, 228, 0.4);
  --accent: #059669;
  --accent-light: #d1fae5;
  --highlight-border: #10b981;
  --highlight-bg: rgba(240, 253, 244, 0.9);
  --highlight-badge-bg: #d1fae5;
  --highlight-badge-text: #065f46;
}

[data-theme="warm-peach"] {
  --bg-gradient: linear-gradient(145deg, #fff7ed 0%, #fef2f2 50%, #fff1f2 100%);
  --bg-blob-1: rgba(254, 215, 170, 0.55);
  --bg-blob-2: rgba(254, 205, 211, 0.5);
  --bg-blob-3: rgba(253, 230, 138, 0.4);
  --accent: #ea580c;
  --accent-light: #ffedd5;
  --highlight-border: #f97316;
  --highlight-bg: rgba(255, 247, 237, 0.9);
  --highlight-badge-bg: #ffedd5;
  --highlight-badge-text: #9a3412;
}

[data-theme="soft-lavender"] {
  --bg-gradient: linear-gradient(145deg, #faf5ff 0%, #f3e8ff 50%, #fdf4ff 100%);
  --bg-blob-1: rgba(233, 213, 255, 0.55);
  --bg-blob-2: rgba(245, 208, 254, 0.45);
  --bg-blob-3: rgba(224, 231, 255, 0.4);
  --accent: #7c3aed;
  --accent-light: #ede9fe;
  --highlight-border: #8b5cf6;
  --highlight-bg: rgba(250, 245, 255, 0.9);
  --highlight-badge-bg: #ede9fe;
  --highlight-badge-text: #5b21b6;
}

[data-theme="clean-sky"] {
  --bg-gradient: linear-gradient(145deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
  --bg-blob-1: rgba(186, 230, 253, 0.6);
  --bg-blob-2: rgba(199, 210, 254, 0.45);
  --bg-blob-3: rgba(224, 242, 254, 0.5);
  --accent: #0284c7;
  --accent-light: #e0f2fe;
  --highlight-border: #0ea5e9;
  --highlight-bg: rgba(240, 249, 255, 0.9);
  --highlight-badge-bg: #e0f2fe;
  --highlight-badge-text: #0369a1;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  padding: 0;
  margin: 0;
}

/* Ambient Background Glow */
.bg-ambient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  filter: blur(80px);
  border-radius: 50%;
  opacity: 0.85;
  transition: all 1s ease;
}

.blob-1 {
  top: -100px;
  right: -50px;
  width: 380px;
  height: 380px;
  background: var(--bg-blob-1);
}

.blob-2 {
  bottom: -80px;
  left: -60px;
  width: 350px;
  height: 350px;
  background: var(--bg-blob-2);
}

.blob-3 {
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: var(--bg-blob-3);
}

/* Layout Container */
.page-container {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Floating Actions Bar (Top right share button & optional admin quick link) */
.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.top-action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  box-shadow: var(--surface-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid var(--surface-border-subtle);
}

.top-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--surface-shadow-hover);
  color: var(--accent);
}

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

.top-action-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Profile Section */
.profile-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.avatar-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 1.1rem;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #ffffff;
  padding: 5px;
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.95);
  transition: transform 0.3s ease;
}

.avatar-wrapper:hover .avatar-img {
  transform: scale(1.03);
}

.profile-name {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.verified-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  display: inline-flex;
}

.verified-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.profile-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.65rem;
  border-radius: var(--pill-radius);
  margin-bottom: 0.6rem;
  letter-spacing: 0.01em;
  display: inline-block;
}

.profile-bio {
  font-size: 0.925rem;
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.55;
  font-weight: 400;
}

/* Links Container */
.links-container {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  flex: 1 0 auto;
}

/* Link Card */
.link-card {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.95rem 1.15rem;
  background: var(--surface-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: var(--card-radius);
  box-shadow: var(--surface-shadow);
  text-decoration: none;
  color: var(--text-main);
  transition: var(--transition-smooth);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.link-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--surface-shadow-hover);
  border-color: rgba(203, 213, 225, 0.9);
}

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

.link-card:active {
  transform: scale(0.985);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

/* Highlighted / Featured Card */
.link-card.is-highlighted {
  border: 2px solid var(--highlight-border);
  background: var(--highlight-bg);
  box-shadow: 0 6px 20px -3px var(--accent-glow), 0 3px 8px rgba(15, 23, 42, 0.04);
}

.link-card.is-highlighted:hover {
  box-shadow: 0 12px 28px -4px var(--accent-glow), 0 5px 12px rgba(15, 23, 42, 0.06);
}

/* Link Thumbnail / Icon */
.link-icon-wrap {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
  transition: transform 0.25s ease;
}

.link-card:hover .link-icon-wrap {
  transform: scale(1.06);
}

.link-icon-img {
  width: 100%;
  height: 100%;
  max-width: 44px;
  max-height: 44px;
  object-fit: contain;
  display: block;
}

.link-icon-svg {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}

.link-icon-emoji {
  font-size: 1.4rem;
  line-height: 1;
  user-select: none;
}

/* Link Details */
.link-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.link-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.link-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.link-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--pill-radius);
  background: var(--highlight-badge-bg);
  color: var(--highlight-badge-text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.link-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Link Arrow Action */
.link-action {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  margin-left: 0.75rem;
  transition: var(--transition-smooth);
}

.link-card:hover .link-action {
  color: var(--accent);
  transform: translateX(3px);
}

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

/* Empty State */
.links-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--surface-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--card-radius);
  border: 1.5px dashed var(--surface-border-subtle);
  color: var(--text-muted);
  box-shadow: var(--surface-shadow);
}

.links-empty-icon {
  font-size: 2.75rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.links-empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.links-empty-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Footer (Matching Ant-Colony & Biom-Racer standard) */
.site-footer {
  margin-top: auto;
  padding-top: 3.5rem;
  padding-bottom: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.825rem;
}

.footer-legal-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.footer-legal-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-legal-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-sep {
  opacity: 0.4;
  font-size: 0.75rem;
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-admin-row {
  margin-top: 0.25rem;
}

.admin-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-light);
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
  transition: var(--transition-smooth);
}

.admin-footer-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--surface-border-subtle);
}

.admin-footer-btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #f8fafc;
  padding: 0.65rem 1.15rem;
  border-radius: var(--pill-radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: #ffffff;
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 2.5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: clamp(1.25rem, 5vw, 2rem);
  box-shadow: 0 20px 40px -8px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(226, 232, 240, 0.8);
  transform: translateY(15px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.modal-overlay.is-open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-close-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Floating Admin Bar for Logged-In User */
.admin-badge-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.6rem 1rem;
  border-radius: var(--pill-radius);
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.3);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 999;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.admin-badge-bar:hover {
  transform: translateY(-2px);
  background: #1e293b;
  box-shadow: 0 14px 30px -4px rgba(15, 23, 42, 0.4);
}

.admin-badge-bar svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: var(--btn-radius);
  border: 1.5px solid #e2e8f0;
  font-family: inherit;
  font-size: 16px; /* Prevents auto-zoom on iOS Safari */
  color: var(--text-main);
  background: #f8fafc;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

.btn-primary {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border-radius: var(--btn-radius);
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

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

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

/* Responsive Breakpoints */
@media (min-width: 640px) {
  .page-container {
    padding-top: 3.5rem;
  }
  .profile-card {
    margin-bottom: 2.5rem;
  }
  .avatar-wrapper {
    width: 110px;
    height: 110px;
  }
  .profile-name {
    font-size: 1.5rem;
  }
  .profile-bio {
    font-size: 1rem;
  }
  .link-card {
    padding: 1.1rem 1.35rem;
  }
  .link-icon-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }
}
