/* Import Poppins Font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* Color Variables */
:root {
  --bg-color: #120917;
  /* Deep violet-black */
  --bg-gradient: radial-gradient(circle at 50% 50%, #1a6831 0%, #031402 100%);
  --card-bg: rgba(30, 20, 38, 0.65);
  --card-border: rgba(46, 153, 101, 0.9);
  --text-primary: #88c6a8;
  --text-secondary: #b5aeb7;
  --primary-color: #1d7549;
  /* Emerald green */
  --primary-glow: rgba(46, 153, 101, 0.9);
  --accent-color: #52c48d;
  /* Cyan */
  --error-color: #ff3366;
  --success-color: #00c03b;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
  text-decoration: none;
  list-style: none;
  outline: none;
  border: none;
}

html {
  font-size: 62.5%;
  height: 100%;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 2rem 1.5rem;
  position: relative;
}

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

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 350px;
  height: 350px;
  background: var(--primary-color);
  top: -100px;
  left: -50px;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-color);
  bottom: -150px;
  right: -50px;
  animation-delay: -5s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: #9d4edd;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(30px, -40px) scale(1.1);
  }

  100% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

/* Main Container (Linktree Card) */
.container {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--card-border);
  border-radius: 2.5rem;
  padding: 4rem 3rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(46, 153, 101, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 10;
  transition: var(--transition);
}

.container:hover {
  border-color: rgba(46, 153, 101, 0.4);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5), 0 0 35px rgba(46, 153, 101, 0.2);
}

/* Profile Section */
.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 3.5rem;
  width: 100%;
}

.avatar-wrapper {
  position: relative;
  width: 18rem;
  height: 18rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar {
  width: 17rem;
  height: 17rem;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.05);
  z-index: 5;
}

.avatar-spin {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border-top: 3px solid var(--primary-color);
  border-bottom: 3px solid var(--accent-color);
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  animation: spin 8s linear infinite;
  z-index: 1;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.profile-title {
  font-size: 4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 10px rgba(46, 153, 101, 0.2);
}

.profile-subtitle {
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 90%;
}

/* Links List */
.links-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  margin-bottom: 3.5rem;
}

.link-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.6rem 2.2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.4rem;
  color: var(--text-primary);
  font-size: 2rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* Left accent bar on link buttons */
.link-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 4px;
  background: var(--btn-theme-color, var(--primary-color));
  transform: scaleY(0);
  transition: var(--transition);
}

.link-btn:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--btn-theme-color, var(--primary-color));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 12px var(--btn-theme-color-alpha, rgba(46, 153, 101, 0.15));
}

.link-btn:hover::before {
  transform: scaleY(1);
}

.link-btn-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  z-index: 2;
}

.link-btn-content i {
  font-size: 3rem;
  color: var(--btn-theme-color, var(--primary-color));
  transition: var(--transition);
}

.link-btn:hover .link-btn-content i {
  transform: scale(1.15) rotate(-5deg);
}

.link-chevron {
  font-size: 1.8rem;
  color: var(--text-secondary);
  opacity: 0.6;
  transition: var(--transition);
  z-index: 2;
}

.link-btn:hover .link-chevron {
  transform: translateX(4px);
  color: var(--text-primary);
  opacity: 1;
}

/* Social Footer Icons */
.social-footer {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: auto;
  width: 100%;
}

.social-icon {
  width: 4.5rem;
  height: 4.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 2.2rem;
  transition: var(--transition);
}

.social-icon:hover {
  transform: translateY(-4px) scale(1.08);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--brand-color, var(--primary-color));
  color: var(--brand-color, var(--text-primary));
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2), 0 0 8px var(--brand-color-alpha, rgba(46, 153, 101, 0.2));
}

/* Footer Credits & Admin Button */
.app-footer {
  margin-top: 3.5rem;
  font-size: 1.25rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

.app-footer a {
  color: var(--primary-color);
  font-weight: 500;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* Admin Toggle Trigger */
.admin-trigger {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  width: 4rem;
  height: 4rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  z-index: 50;
}

.admin-trigger:hover {
  color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(46, 153, 101, 0.2);
}

/* Modal Overlay & Panel */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 5, 14, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
}

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

.modal-card {
  width: 100%;
  max-width: 520px;
  background: #190f1f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2rem;
  padding: 3rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.modal-header h3 i {
  color: var(--primary-color);
}

.close-btn {
  background: transparent;
  color: var(--text-secondary);
  font-size: 2.4rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.close-btn:hover {
  color: var(--error-color);
  transform: scale(1.1);
}

/* Modal Scrollable Body */
.modal-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 0.5rem;
  margin-bottom: 2rem;
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Admin Links List Table */
.admin-links-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

.admin-link-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 1.2rem 1.5rem;
  transition: var(--transition);
}

.admin-link-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.admin-link-drag-controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.drag-btn {
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.5;
}

.drag-btn:hover {
  opacity: 1;
  color: var(--primary-color);
}

.drag-btn:disabled {
  opacity: 0.15;
  cursor: not-allowed;
}

.admin-link-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  min-width: 0;
}

.admin-link-info i {
  font-size: 2.2rem;
  color: var(--primary-color);
  min-width: 24px;
}

.admin-link-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-link-title {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-link-url {
  font-size: 1.1rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-link-actions {
  display: flex;
  gap: 0.8rem;
}

.action-btn {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 1.6rem;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.action-btn.edit:hover {
  background: rgba(46, 153, 101, 0.15);
  color: var(--primary-color);
}

.action-btn.delete:hover {
  background: rgba(255, 51, 102, 0.15);
  color: var(--error-color);
}

/* Edit Form */
.edit-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 1.2rem;
  padding: 2rem;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form-group label {
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 1rem 1.4rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.8rem;
  color: var(--text-primary);
  font-size: 1.3rem;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(46, 153, 101, 0.25);
}

.form-row {
  display: flex;
  gap: 1.5rem;
}

.form-row .form-group {
  flex: 1;
}

.color-input-container {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.color-picker {
  width: 3.8rem;
  height: 3.8rem;
  padding: 0;
  border-radius: 0.8rem;
  background: transparent;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 0.7rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

/* General Buttons */
.btn {
  padding: 1rem 1.8rem;
  font-size: 1.3rem;
  font-weight: 500;
  border-radius: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary-color);
  color: #120917;
  font-weight: 600;
}

.btn-primary:hover {
  background: #39be7e;
  box-shadow: 0 0 12px rgba(46, 153, 101, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(255, 51, 102, 0.1);
  color: var(--error-color);
  border: 1px solid rgba(255, 51, 102, 0.2);
}

.btn-danger:hover {
  background: var(--error-color);
  color: var(--text-primary);
}

.add-link-btn {
  width: 100%;
  justify-content: center;
  padding: 1.2rem;
  border: 1px dashed rgba(46, 153, 101, 0.4);
  background: rgba(46, 153, 101, 0.04);
  color: var(--primary-color);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

.add-link-btn:hover {
  background: rgba(46, 153, 101, 0.08);
  border-color: var(--primary-color);
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-indicator {
  font-size: 1.2rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-indicator i {
  font-size: 1.4rem;
}

.status-indicator.success i {
  color: var(--success-color);
}

.status-indicator.error i {
  color: var(--error-color);
}

.status-indicator.saving i {
  color: var(--accent-color);
  animation: rotation 1.5s infinite linear;
}

@keyframes rotation {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(25, 15, 31, 0.95);
  border: 1px solid var(--primary-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(46, 153, 101, 0.2);
  border-radius: 1rem;
  padding: 1.2rem 2.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary);
  font-size: 1.4rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.toast-container i {
  color: var(--primary-color);
  font-size: 1.8rem;
}

.toast-container.error {
  border-color: var(--error-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 51, 102, 0.2);
}

.toast-container.error i {
  color: var(--error-color);
}

/* Media Queries for Responsiveness */
@media (max-width: 576px) {
  body {
    padding: 1.5rem 1rem;
  }

  .container {
    padding: 3rem 2rem;
    border-radius: 2rem;
  }

  .avatar-wrapper {
    width: 11rem;
    height: 11rem;
  }

  .avatar {
    width: 9.6rem;
    height: 9.6rem;
  }

  .profile-title {
    font-size: 2.4rem;
  }

  .link-btn {
    padding: 1.4rem 1.8rem;
    font-size: 1.5rem;
  }

  .modal-card {
    padding: 2.2rem;
    max-height: 95vh;
  }

  .form-row {
    flex-direction: column;
    gap: 1.5rem;
  }
}