@property --draw-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  --primary-color: #204381;
  --primary-hover: #163060;
  --bg-gradient-start: #f1f5f9;
  --bg-gradient-end: #e2e8f0;
  --card-bg: #ffffff;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --white: #ffffff;
  
  --shadow-sm: 0 4px 6px -1px rgba(32, 67, 129, 0.08), 0 2px 4px -1px rgba(32, 67, 129, 0.04);
  --shadow-md: 0 10px 25px -5px rgba(32, 67, 129, 0.15), 0 8px 10px -6px rgba(32, 67, 129, 0.08);
  --shadow-hover: 0 20px 25px -5px rgba(32, 67, 129, 0.2), 0 10px 10px -5px rgba(32, 67, 129, 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 20px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  height: 100dvh;
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-dark);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  position: relative;
  overflow: hidden;
}

.background-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(32, 67, 129, 0.05), transparent 30%),
    radial-gradient(circle at 85% 30%, rgba(32, 67, 129, 0.05), transparent 30%);
}

.profile-container {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 420px;
  max-height: 96%;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.profile-container::-webkit-scrollbar {
  display: none;
}

@keyframes slideUp {
  0% { transform: translateY(15px) scale(0.98); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.profile-header {
  padding: 50px 24px 24px;
  text-align: center;
  position: relative;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120px;
  background: var(--primary-color);
  border-bottom-left-radius: 10% 20px;
  border-bottom-right-radius: 10% 20px;
  z-index: 0;
}

.profile-avatar {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--white);
  padding: 4px;
  box-shadow: 0 8px 16px rgba(32, 67, 129, 0.15);
  z-index: 1;
  transition: transform 0.4s ease;
}

.profile-container:hover .profile-avatar {
  transform: scale(1.05);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-name {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  color: var(--primary-color);
}

.profile-title {
  position: relative;
  z-index: 1;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.action-links {
  padding: 8px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.action-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  position: relative;
  -webkit-tap-highlight-color: transparent; /* Remove default mobile tap square */
}

.action-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-color);
  border-radius: inherit; /* perfectly tracks the button rounded corners */
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.action-btn:active {
  transform: scale(0.96); /* Satisfying physical press down */
  box-shadow: none;
}

.action-btn:active::after {
  opacity: 0.12;
  transition: 0s; /* Instant color pop on touch */
}

.action-btn:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-hover);
}

.icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  margin-right: 16px;
  flex-shrink: 0;
  transition: var(--transition);
}

.icon-wrapper img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.btn-text {
  flex-grow: 1;
  text-align: left;
}

/* Primary Button (Guardar Contacto) */
.primary-btn {
  background: var(--primary-color);
  color: var(--white);
  box-shadow: 0 8px 16px -4px rgba(32, 67, 129, 0.3);
  margin-bottom: 8px;
}

.primary-btn .icon-wrapper {
  background: rgba(255, 255, 255, 0.15);
}

.primary-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 12px 24px -6px rgba(32, 67, 129, 0.4);
}

/* Secondary Button */
.secondary-btn {
  background: var(--white);
  color: var(--text-dark);
  border: 1px solid rgba(32, 67, 129, 0.2); /* Inicia tenue como gris azulado */
  box-shadow: var(--shadow-sm);
}

.secondary-btn .icon-wrapper {
  background: transparent;
}

@media (hover: hover) {
  /* Pseudo-elemento transparente reservado para la animación de borde */
  .secondary-btn::before {
    content: '';
    position: absolute;
    top: -1.5px;
    left: -1.5px;
    right: -1.5px;
    bottom: -1.5px;
    border-radius: inherit;
    border: 1.5px solid var(--primary-color);
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    
    --draw-angle: 0deg;
    -webkit-mask: conic-gradient(
      from 180deg, 
      #000 0deg, 
      #000 var(--draw-angle), 
      transparent var(--draw-angle), 
      transparent calc(360deg - var(--draw-angle)), 
      #000 calc(360deg - var(--draw-angle)),
      #000 360deg
    );
    transition: --draw-angle 0.4s ease-out, opacity 0.4s ease;
  }

  /* Animación mágica al acercar cursor en PC */
  .secondary-btn:hover {
    background: #f8fafc;
    box-shadow: 0 0 0 6px rgba(32, 67, 129, 0.05); /* Resplandor súper tenue y elegante */
    border-color: transparent; /* Oculta el borde estático para dejar brillar a la animación */
  }

  .secondary-btn:hover::before {
    opacity: 1;
    --draw-angle: 180deg; /* Rodea exactamente hacia arriba hasta chocar a la mitad - cerrando */
    transition: --draw-angle 1.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 1.5s ease;
  }

  .primary-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 0 5px rgba(32, 67, 129, 0.2);
  }
}


.secondary-btn:hover .icon-wrapper {
  transform: scale(1.1);
}

.profile-footer {
  width: 100%;
  margin-top: auto;
  border-top: 1px solid rgba(32, 67, 129, 0.1);
  flex-shrink: 0;
}

.footer-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  max-height: 120px;
  filter: saturate(1.1);
}

/* Adjust sizes for particularly short screens (like laptops resolving to 1366x768) */
@media (max-height: 780px) {
  .profile-header {
    padding: 30px 20px 10px;
  }
  .profile-header::before {
    height: 90px;
  }
  .profile-avatar {
    width: 100px;
    height: 100px;
  }
  .profile-name {
    font-size: 24px;
  }
  .action-btn {
    padding: 10px 16px;
    font-size: 15px;
  }
  .icon-wrapper {
    width: 38px;
    height: 38px;
    margin-right: 12px;
  }
  .icon-wrapper img {
    width: 20px;
    height: 20px;
  }
  .footer-image {
    max-height: 90px;
  }
  .action-links {
    gap: 10px;
  }
}

/* Add custom animations for list items */
.action-links .action-btn {
  opacity: 0;
  animation: fadeInRight 0.5s ease forwards;
}

.action-links .action-btn:nth-child(1) { animation-delay: 0.1s; }
.action-links .action-btn:nth-child(2) { animation-delay: 0.2s; }
.action-links .action-btn:nth-child(3) { animation-delay: 0.3s; }
.action-links .action-btn:nth-child(4) { animation-delay: 0.4s; }
.action-links .action-btn:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInRight {
  0% { opacity: 0; transform: translateX(-20px); }
  100% { opacity: 1; transform: translateX(0); }
}